Elgg  Version master
Plugins.php
Go to the documentation of this file.
1 <?php
2 
3 namespace Elgg\Database;
4 
6 use Elgg\Config;
7 use Elgg\Context;
8 use Elgg\Database;
22 
29 class Plugins {
30 
31  use Profilable;
32  use Cacheable;
33  use Loggable;
34 
35  const BUNDLED_PLUGINS = [
36  'activity',
37  'blog',
38  'bookmarks',
39  'ckeditor',
40  'custom_index',
41  'dashboard',
42  'developers',
43  'discussions',
44  'externalpages',
45  'file',
46  'friends',
47  'friends_collections',
48  'garbagecollector',
49  'groups',
50  'invitefriends',
51  'likes',
52  'members',
53  'messageboard',
54  'messages',
55  'notifications',
56  'pages',
57  'profile',
58  'reportedcontent',
59  'search',
60  'site_notifications',
61  'system_log',
62  'tagcloud',
63  'theme_sandbox',
64  'thewire',
65  'uservalidationbyemail',
66  'web_services',
67  ];
68 
72  protected ?array $boot_plugins;
73 
74  protected Database $db;
75 
77 
79 
81 
82  protected ViewsService $views;
83 
84  protected Config $config;
85 
87 
88  protected Context $context;
89 
103  public function __construct(
104  BaseCache $cache,
105  Database $db,
106  SessionManagerService $session_manager,
107  EventsService $events,
108  Translator $translator,
109  ViewsService $views,
110  Config $config,
111  SystemMessagesService $system_messages,
113  ) {
114  $this->cache = $cache;
115  $this->db = $db;
116  $this->session_manager = $session_manager;
117  $this->events = $events;
118  $this->translator = $translator;
119  $this->views = $views;
120  $this->config = $config;
121  $this->system_messages = $system_messages;
122 
123  $this->context = $request->getContextStack();
124  }
125 
131  public function getPath(): string {
132  $path = $this->config->plugins_path;
133  if (!$path) {
134  $path = Paths::project() . 'mod/';
135  }
136 
137  return $path;
138  }
139 
148  public function setBootPlugins(array $plugins = null, bool $order_plugins = true): void {
149  if (!is_array($plugins)) {
150  unset($this->boot_plugins);
151  return;
152  }
153 
154  // Always (re)set the boot_plugins. This makes sure that even if you have no plugins active this is known to the system.
155  $this->boot_plugins = [];
156 
157  if ($order_plugins) {
158  $plugins = $this->orderPluginsByPriority($plugins);
159  }
160 
161  foreach ($plugins as $plugin) {
162  if (!$plugin instanceof \ElggPlugin) {
163  continue;
164  }
165 
166  $plugin_id = $plugin->getID();
167  if (!$plugin_id) {
168  continue;
169  }
170 
171  $plugin->registerLanguages();
172 
173  $this->boot_plugins[$plugin_id] = $plugin;
174  $this->cache->save($plugin_id, $plugin);
175  }
176  }
177 
183  public function clear(): void {
184  $this->cache->clear();
185  }
186 
192  public function invalidate(): void {
193  $this->cache->invalidate();
194  }
195 
204  public function getDirsInDir(string $dir = null): array {
205  if (!$dir) {
206  $dir = $this->getPath();
207  }
208 
209  if (!is_dir($dir)) {
210  return [];
211  }
212 
213  $handle = opendir($dir);
214  if ($handle === false) {
215  return [];
216  }
217 
218  $plugin_dirs = [];
219  while (($plugin_dir = readdir($handle)) !== false) {
220  // must be directory and not begin with a .
221  if (!str_starts_with($plugin_dir, '.') && is_dir($dir . $plugin_dir)) {
222  $plugin_dirs[] = $plugin_dir;
223  }
224  }
225 
226  sort($plugin_dirs);
227 
228  return $plugin_dirs;
229  }
230 
239  public function generateEntities(): bool {
240  $mod_dir = $this->getPath();
241 
242  // ignore access in case this is called with no admin logged in - needed for creating plugins perhaps?
243  $old_ia = $this->session_manager->setIgnoreAccess(true);
244 
245  // show hidden entities so that we can enable them if appropriate
246  $old_access = $this->session_manager->setDisabledEntityVisibility(true);
247 
248  $known_plugins = $this->find('all');
249  if (empty($known_plugins)) {
250  $known_plugins = [];
251  }
252 
253  // keeps track if reindexing is needed
254  $reindex = false;
255 
256  // map paths to indexes
257  $id_map = [];
258  $latest_priority = -1;
259  foreach ($known_plugins as $i => $plugin) {
260  // if the ID is wrong, delete the plugin because we can never load it.
261  $id = $plugin->getID();
262  if (!$id) {
263  $plugin->delete();
264  unset($known_plugins[$i]);
265  continue;
266  }
267 
268  $id_map[$plugin->getID()] = $i;
269  $plugin->cache();
270 
271  // disabled plugins should have no priority, so no need to check if the priority is incorrect
272  if (!$plugin->isEnabled()) {
273  continue;
274  }
275 
276  $current_priority = $plugin->getPriority();
277  if (($current_priority - $latest_priority) > 1) {
278  $reindex = true;
279  }
280 
281  $latest_priority = $current_priority;
282  }
283 
284  $physical_plugins = $this->getDirsInDir($mod_dir);
285  if (empty($physical_plugins)) {
286  $this->session_manager->setIgnoreAccess($old_ia);
287  $this->session_manager->setDisabledEntityVisibility($old_access);
288 
289  return false;
290  }
291 
292  // check real plugins against known ones
293  foreach ($physical_plugins as $plugin_id) {
294  // is this already in the db?
295  if (array_key_exists($plugin_id, $id_map)) {
296  $index = $id_map[$plugin_id];
297  $plugin = $known_plugins[$index];
298  // was this plugin deleted and its entity disabled?
299  if (!$plugin->isEnabled()) {
300  $plugin->enable();
301  try {
302  $plugin->deactivate();
303  } catch (PluginException $e) {
304  // do nothing
305  }
306 
307  $plugin->setPriority('new');
308  }
309 
310  // remove from the list of plugins to disable
311  unset($known_plugins[$index]);
312  } else {
313  // create new plugin
314  // priority is forced to last in save() if not set.
315  $plugin = \ElggPlugin::fromId($plugin_id);
316  $plugin->cache();
317  }
318  }
319 
320  // everything remaining in $known_plugins needs to be disabled
321  // because they are entities, but their dirs were removed.
322  // don't delete the entities because they hold settings.
323  foreach ($known_plugins as $plugin) {
324  if (!$plugin->isEnabled()) {
325  continue;
326  }
327 
328  $reindex = true;
329 
330  if ($plugin->isActive()) {
331  try {
332  $plugin->deactivate();
333  } catch (PluginException $e) {
334  // do nothing
335  }
336  }
337 
338  // remove the priority.
339  $plugin->deleteMetadata(\ElggPlugin::PRIORITY_SETTING_NAME);
340 
341  $plugin->disable();
342  }
343 
344  if ($reindex) {
345  $this->reindexPriorities();
346  }
347 
348  $this->session_manager->setIgnoreAccess($old_ia);
349  $this->session_manager->setDisabledEntityVisibility($old_access);
350 
351  return true;
352  }
353 
361  public function cache(\ElggPlugin $plugin): void {
362  if (!$plugin->getID()) {
363  return;
364  }
365 
366  $this->cache->save($plugin->getID(), $plugin);
367  }
368 
376  public function invalidateCache($plugin_id): void {
377  try {
378  $this->cache->delete($plugin_id);
379  } catch (InvalidArgumentException $ex) {
380  // A plugin must have been deactivated due to missing folder
381  // without proper cleanup
383  }
384  }
385 
393  public function get(string $plugin_id): ?\ElggPlugin {
394  if (empty($plugin_id)) {
395  return null;
396  }
397 
398  $plugin = $this->cache->load($plugin_id);
399  if ($plugin instanceof \ElggPlugin) {
400  return $plugin;
401  }
402 
403  $plugins = elgg_get_entities([
404  'type' => 'object',
405  'subtype' => 'plugin',
406  'metadata_name_value_pairs' => [
407  'name' => 'title',
408  'value' => $plugin_id,
409  ],
410  'limit' => 1,
411  'distinct' => false,
412  ]);
413 
414  if (empty($plugins)) {
415  return null;
416  }
417 
418  $plugins[0]->cache();
419 
420  return $plugins[0];
421  }
422 
434  public function exists(string $id): bool {
435  return $this->get($id) instanceof \ElggPlugin;
436  }
437 
443  public function getMaxPriority(): int {
445  $qb->select('MAX(CAST(md.value AS unsigned)) as max')
446  ->join($qb->getTableAlias(), MetadataTable::TABLE_NAME, 'md', "{$qb->getTableAlias()}.guid = md.entity_guid")
447  ->where($qb->compare('md.name', '=', \ElggPlugin::PRIORITY_SETTING_NAME, ELGG_VALUE_STRING))
448  ->andWhere($qb->compare("{$qb->getTableAlias()}.type", '=', 'object', ELGG_VALUE_STRING))
449  ->andWhere($qb->compare("{$qb->getTableAlias()}.subtype", '=', 'plugin', ELGG_VALUE_STRING));
450 
451  $data = $this->db->getDataRow($qb);
452  if (empty($data)) {
453  return 1;
454  }
455 
456  return max(1, (int) $data->max);
457  }
458 
466  public function isActive(string $plugin_id): bool {
467  if (isset($this->boot_plugins) && is_array($this->boot_plugins)) {
468  return array_key_exists($plugin_id, $this->boot_plugins);
469  }
470 
471  $plugin = $this->get($plugin_id);
472  if (!$plugin instanceof \ElggPlugin) {
473  return false;
474  }
475 
476  return $plugin->hasRelationship(1, 'active_plugin');
477  }
478 
488  public function build(): bool {
489  $plugins_path = $this->getPath();
490 
491  // temporary disable all plugins if there is a file called 'disabled' in the plugin dir
492  if (file_exists("{$plugins_path}/disabled")) {
493  if ($this->session_manager->isAdminLoggedIn() && $this->context->contains('admin')) {
494  $this->system_messages->addSuccessMessage($this->translator->translate('plugins:disabled'));
495  }
496 
497  return false;
498  }
499 
500  $this->events->registerHandler('plugins_load', 'system', [$this, 'register']);
501  $this->events->registerHandler('plugins_boot:before', 'system', [$this, 'boot']);
502  $this->events->registerHandler('init', 'system', [$this, 'init']);
503  $this->events->registerHandler('ready', 'system', [$this, 'ready']);
504  $this->events->registerHandler('upgrade', 'system', [$this, 'upgrade']);
505  $this->events->registerHandler('shutdown', 'system', [$this, 'shutdown']);
506 
507  return true;
508  }
509 
516  public function register(): void {
517  $plugins = $this->find('active');
518  if (empty($plugins)) {
519  return;
520  }
521 
522  $this->beginTimer([__METHOD__]);
523 
524  foreach ($plugins as $plugin) {
525  try {
526  $plugin->register();
527  } catch (\Exception $ex) {
528  $this->disable($plugin, $ex);
529  }
530  }
531 
532  $this->endTimer([__METHOD__]);
533  }
534 
540  public function boot(): void {
541  $plugins = $this->find('active');
542  if (empty($plugins)) {
543  return;
544  }
545 
546  $this->beginTimer([__METHOD__]);
547 
548  foreach ($plugins as $plugin) {
549  try {
550  $plugin->boot();
551  } catch (\Exception $ex) {
552  $this->disable($plugin, $ex);
553  }
554  }
555 
556  $this->endTimer([__METHOD__]);
557  }
558 
564  public function init(): void {
565  $plugins = $this->find('active');
566  if (empty($plugins)) {
567  return;
568  }
569 
570  $this->beginTimer([__METHOD__]);
571 
572  foreach ($plugins as $plugin) {
573  try {
574  $plugin->init();
575  } catch (\Exception $ex) {
576  $this->disable($plugin, $ex);
577  }
578  }
579 
580  $this->endTimer([__METHOD__]);
581  }
582 
588  public function ready(): void {
589  $plugins = $this->find('active');
590  if (empty($plugins)) {
591  return;
592  }
593 
594  $this->beginTimer([__METHOD__]);
595 
596  foreach ($plugins as $plugin) {
597  try {
598  $plugin->getBootstrap()->ready();
599  } catch (\Exception $ex) {
600  $this->disable($plugin, $ex);
601  }
602  }
603 
604  $this->endTimer([__METHOD__]);
605  }
606 
612  public function upgrade(): void {
613  $plugins = $this->find('active');
614  if (empty($plugins)) {
615  return;
616  }
617 
618  $this->beginTimer([__METHOD__]);
619 
620  foreach ($plugins as $plugin) {
621  try {
622  $plugin->getBootstrap()->upgrade();
623  } catch (\Exception $ex) {
624  $this->disable($plugin, $ex);
625  }
626  }
627 
628  $this->endTimer([__METHOD__]);
629  }
630 
636  public function shutdown(): void {
637  $plugins = $this->find('active');
638  if (empty($plugins)) {
639  return;
640  }
641 
642  $this->beginTimer([__METHOD__]);
643 
644  foreach ($plugins as $plugin) {
645  try {
646  $plugin->getBootstrap()->shutdown();
647  } catch (\Exception $ex) {
648  $this->disable($plugin, $ex);
649  }
650  }
651 
652  $this->endTimer([__METHOD__]);
653  }
654 
663  protected function disable(\ElggPlugin $plugin, \Exception $previous): void {
664  $this->getLogger()->log(LogLevel::ERROR, $previous, [
665  'context' => [
666  'plugin' => $plugin,
667  ],
668  ]);
669 
670  if (!$this->config->auto_disable_plugins) {
671  return;
672  }
673 
674  try {
675  $id = $plugin->getID();
676  $plugin->deactivate();
677 
678  $msg = $this->translator->translate(
679  'PluginException:CannotStart',
680  [$id, $plugin->guid, $previous->getMessage()]
681  );
682 
683  elgg_add_admin_notice("cannot_start {$id}", $msg);
684  } catch (PluginException $ex) {
685  $this->getLogger()->log(LogLevel::ERROR, $ex, [
686  'context' => [
687  'plugin' => $plugin,
688  ],
689  ]);
690  }
691  }
692 
700  public function find(string $status = 'active'): array {
701  if (!$this->db || !$this->config->installed) {
702  return [];
703  }
704 
705  if ($status === 'active' && isset($this->boot_plugins)) {
706  // boot_plugins is an already ordered list of plugins
707  return array_values($this->boot_plugins);
708  }
709 
710  $volatile_data_name = null;
711  $site_guid = 1;
712 
713  // grab plugins
714  $options = [
715  'type' => 'object',
716  'subtype' => 'plugin',
717  'limit' => false,
718  'order_by' => false,
719  ];
720 
721  switch ($status) {
722  case 'active':
723  $options['relationship'] = 'active_plugin';
724  $options['relationship_guid'] = $site_guid;
725  $options['inverse_relationship'] = true;
726 
727  // shorten callstack
728  $volatile_data_name = 'select:value';
729  $options['select'] = [MetadataTable::DEFAULT_JOIN_ALIAS . '.value'];
730  $options['metadata_names'] = [
732  ];
733  break;
734 
735  case 'inactive':
736  $options['wheres'][] = function (QueryBuilder $qb, $main_alias) use ($site_guid) {
737  $subquery = $qb->subquery('entity_relationships', 'active_er');
738  $subquery->select('active_er.guid_one')
739  ->where($qb->compare('active_er.relationship', '=', 'active_plugin', ELGG_VALUE_STRING))
740  ->andWhere($qb->compare('active_er.guid_two', '=', $site_guid, ELGG_VALUE_GUID));
741 
742  return $qb->compare("{$main_alias}.guid", 'NOT IN', $subquery->getSQL());
743  };
744  break;
745 
746  case 'all':
747  default:
748  break;
749  }
750 
751  $old_ia = $this->session_manager->setIgnoreAccess(true);
752  $plugins = elgg_get_entities($options) ?: [];
753  $this->session_manager->setIgnoreAccess($old_ia);
754 
755  $result = $this->orderPluginsByPriority($plugins, $volatile_data_name);
756 
757  if ($status === 'active' && !isset($this->boot_plugins)) {
758  // populate local cache if for some reason this is not set yet
759  $this->setBootPlugins($result, false);
760  }
761 
762  return $result;
763  }
764 
773  protected function orderPluginsByPriority(array $plugins = [], string $volatile_data_name = null): array {
774  $priorities = [];
775  $sorted_plugins = [];
776 
777  foreach ($plugins as $plugin) {
778  $priority = null;
779  if (!empty($volatile_data_name)) {
780  $priority = $plugin->getVolatileData($volatile_data_name);
781  }
782 
783  if (!isset($priority)) {
784  $priority = $plugin->getPriority();
785  }
786 
787  $priorities[$plugin->guid] = (int) $priority;
788  $sorted_plugins[$plugin->guid] = $plugin;
789  }
790 
791  asort($priorities);
792 
793  return array_values(array_replace($priorities, $sorted_plugins));
794  }
795 
808  public function setPriorities(array $order): bool {
810 
811  $plugins = $this->find('any');
812  if (empty($plugins)) {
813  return false;
814  }
815 
816  // reindex to get standard counting. no need to increment by 10.
817  // though we do start with 1
818  $order = array_values($order);
819 
820  /* @var \ElggPlugin[] $missing_plugins */
821  $missing_plugins = [];
822 
823  $priority = 0;
824  foreach ($plugins as $plugin) {
825  if (!$plugin->isEnabled()) {
826  // disabled plugins should not have a priority
827  if ($plugin->getPriority() !== null) {
828  // remove the priority
829  unset($plugin->$name);
830  }
831 
832  continue;
833  }
834 
835  $plugin_id = $plugin->getID();
836 
837  if (!in_array($plugin_id, $order)) {
838  $missing_plugins[] = $plugin;
839  continue;
840  }
841 
842  $priority = array_search($plugin_id, $order) + 1;
843 
844  if (!$plugin->setMetadata($name, $priority)) {
845  return false;
846  }
847  }
848 
849  // set the missing plugins' priorities
850  if (empty($missing_plugins)) {
851  return true;
852  }
853 
854  foreach ($missing_plugins as $plugin) {
855  $priority++;
856  if (!$plugin->setMetadata($name, $priority)) {
857  return false;
858  }
859  }
860 
861  return true;
862  }
863 
869  public function reindexPriorities(): bool {
870  return $this->setPriorities([]);
871  }
872 
881  public function setPriority(\ElggPlugin $plugin, int $priority): int|false {
882  $old_priority = $plugin->getPriority() ?: 1;
883 
885 
886  if (!$plugin->setMetadata($name, $priority)) {
887  return false;
888  }
889 
890  if (!$plugin->guid) {
891  return false;
892  }
893 
895  $qb->where($qb->compare('name', '=', $name, ELGG_VALUE_STRING))
896  ->andWhere($qb->compare('entity_guid', '!=', $plugin->guid, ELGG_VALUE_INTEGER));
897 
898  if ($priority > $old_priority) {
899  $qb->set('value', 'CAST(value AS UNSIGNED) - 1');
900  $qb->andWhere($qb->between('CAST(value AS UNSIGNED)', $old_priority, $priority, ELGG_VALUE_INTEGER));
901  } else {
902  $qb->set('value', 'CAST(value AS UNSIGNED) + 1');
903  $qb->andWhere($qb->between('CAST(value AS UNSIGNED)', $priority, $old_priority, ELGG_VALUE_INTEGER));
904  }
905 
906  if (!$this->db->updateData($qb)) {
907  return false;
908  }
909 
910  return $priority;
911  }
912 }
isActive(string $plugin_id)
Returns if a plugin is active for a current site.
Definition: Plugins.php:466
trait Profilable
Make an object accept a timer.
Definition: Profilable.php:12
static project()
Get the project root (where composer is installed) path with "/".
Definition: Paths.php:25
getID()
Returns the ID (dir name) of this plugin.
Definition: ElggPlugin.php:139
setMetadata(string $name, $value, string $value_type= '', bool $multiple=false)
Set metadata on this entity.
Definition: ElggEntity.php:373
$plugin
Elgg HTTP request.
Definition: Request.php:17
reindexPriorities()
Reindexes all plugin priorities starting at 1.
Definition: Plugins.php:869
Exception thrown if an argument is not of the expected type.
getMaxPriority()
Returns the highest priority of the plugins.
Definition: Plugins.php:443
if(!$user||!$user->canDelete()) $name
Definition: delete.php:22
static table($table, $alias=null)
{}
Definition: Update.php:13
subquery(string $table, string $alias=null)
Creates a new SelectQueryBuilder for join/where sub queries using the DB connection of the primary Qu...
build()
Registers lifecycle events for all active plugins sorted by their priority.
Definition: Plugins.php:488
The Elgg database.
Definition: Database.php:25
$request
Definition: livesearch.php:12
const ELGG_VALUE_INTEGER
Value types.
Definition: constants.php:111
c Accompany it with the information you received as to the offer to distribute corresponding source complete source code means all the source code for all modules it plus any associated interface definition plus the scripts used to control compilation and installation of the executable as a special the source code distributed need not include anything that is normally and so on of the operating system on which the executable unless that component itself accompanies the executable If distribution of executable or object code is made by offering access to copy from a designated then offering equivalent access to copy the source code from the same place counts as distribution of the source even though third parties are not compelled to copy the source along with the object code You may not or distribute the Program except as expressly provided under this License Any attempt otherwise to sublicense or distribute the Program is void
Definition: LICENSE.txt:215
Translator $translator
Definition: Plugins.php:80
const ELGG_VALUE_GUID
Definition: constants.php:113
Events service.
Database abstraction query builder.
getDirsInDir(string $dir=null)
Returns a list of plugin directory names from a base directory.
Definition: Plugins.php:204
boot()
Boot the plugins.
Definition: Plugins.php:540
__construct(BaseCache $cache, Database $db, SessionManagerService $session_manager, EventsService $events, Translator $translator, ViewsService $views, Config $config, SystemMessagesService $system_messages, Request $request)
Constructor.
Definition: Plugins.php:103
invalidate()
Invalidate plugin cache.
Definition: Plugins.php:192
disable(\ElggPlugin $plugin,\Exception $previous)
Disable a plugin upon exception.
Definition: Plugins.php:663
$plugin_id
Remove all user and plugin settings from the give plugin ID.
Definition: remove.php:8
elgg_invalidate_caches()
Invalidate all the registered caches.
Definition: cache.php:174
$path
Definition: details.php:70
if($who_can_change_language=== 'nobody') elseif($who_can_change_language=== 'admin_only'&&!elgg_is_admin_logged_in()) $options
Definition: language.php:20
if(!$entity instanceof\ElggUser) $data
Definition: attributes.php:13
ViewsService $views
Definition: Plugins.php:82
trait Loggable
Enables adding a logger.
Definition: Loggable.php:14
exists(string $id)
Returns if a plugin exists in the system.
Definition: Plugins.php:434
setBootPlugins(array $plugins=null, bool $order_plugins=true)
Set the list of active plugins according to the boot data cache.
Definition: Plugins.php:148
orderPluginsByPriority(array $plugins=[], string $volatile_data_name=null)
Sorts plugins by priority.
Definition: Plugins.php:773
elgg_get_entities(array $options=[])
Fetches/counts entities or performs a calculation on their properties.
Definition: entities.php:505
ready()
Run plugin ready handlers.
Definition: Plugins.php:588
init()
Initialize plugins.
Definition: Plugins.php:564
generateEntities()
Discovers plugins in the plugins_path setting and creates entities for them if they don&#39;t exist...
Definition: Plugins.php:239
compare(string $x, string $comparison, $y=null, string $type=null, bool $case_sensitive=null)
Build value comparison clause.
Views service.
SystemMessagesService $system_messages
Definition: Plugins.php:86
upgrade()
Run plugin upgrade handlers.
Definition: Plugins.php:612
The Elgg cache base class.
Definition: BaseCache.php:9
clear()
Clear plugin caches.
Definition: Plugins.php:183
invalidateCache($plugin_id)
Remove plugin from cache.
Definition: Plugins.php:376
const PRIORITY_SETTING_NAME
Definition: ElggPlugin.php:19
static fromTable($table, $alias=null)
{}
Definition: Select.php:13
getLogger()
Returns logger.
Definition: Loggable.php:37
deactivate()
Deactivates the plugin.
Definition: ElggPlugin.php:653
getContextStack()
Returns context stack.
Definition: Request.php:110
setPriority(\ElggPlugin $plugin, int $priority)
Set plugin priority and adjust the priorities of other plugins.
Definition: Plugins.php:881
const ELGG_VALUE_STRING
Definition: constants.php:112
beginTimer(array $keys)
Start the timer (when enabled)
Definition: Profilable.php:43
System messages service.
getPath()
Get the plugin path for this installation, ending with slash.
Definition: Plugins.php:131
getPriority()
Gets the plugin&#39;s load priority.
Definition: ElggPlugin.php:226
setPriorities(array $order)
Reorder plugins to an order specified by the array.
Definition: Plugins.php:808
elgg_add_admin_notice(string $id, string $message)
Write a persistent message to the admin view.
Definition: admin.php:51
shutdown()
Run plugin shutdown handlers.
Definition: Plugins.php:636
EventsService $events
Definition: Plugins.php:78
$index
Definition: gallery.php:40
Persistent, installation-wide key-value storage.
Definition: Plugins.php:29
static fromId(string $plugin_id, string $path=null)
Load a plugin object from its ID Create a new plugin entity if doesn&#39;t exist.
Definition: ElggPlugin.php:82
cache(\ElggPlugin $plugin)
Cache a reference to this plugin by its ID.
Definition: Plugins.php:361
find(string $status= 'active')
Returns an ordered list of plugins.
Definition: Plugins.php:700
$id
Generic annotation delete action.
Definition: delete.php:6
$qb
Definition: queue.php:12
trait Cacheable
Utility trait for injecting cache.
Definition: Cacheable.php:13
$priority
Manages a global stack of strings for sharing information about the current execution context...
Definition: Context.php:27
SessionManagerService $session_manager
Definition: Plugins.php:76
endTimer(array $keys)
Ends the timer (when enabled)
Definition: Profilable.php:59