Elgg  Version 5.1
BootData.php
Go to the documentation of this file.
1 <?php
2 
3 namespace Elgg;
4 
9 
16 class BootData {
17 
21  private $site = false;
22 
26  private $active_plugins;
27 
31  private $plugin_metadata = [];
32 
43  public function populate(EntityTable $entities, Plugins $plugins, bool $installed) {
44  // get site entity
45  $this->site = $entities->get(1, 'site');
46  if (!$this->site && $installed) {
47  throw new InstallationException('Unable to handle this request. This site is not configured or the database is down.');
48  }
49 
50  // get plugins
51  $this->active_plugins = $plugins->find('active');
52 
53  // get plugin settings
54  if (empty($this->active_plugins)) {
55  return;
56  }
57 
58  // find GUIDs with not too many settings
59  $guids = array_map(function (\ElggPlugin $plugin) {
60  return $plugin->guid;
61  }, $this->active_plugins);
62 
63  _elgg_services()->metadataCache->populateFromEntities($guids);
64 
65  foreach ($guids as $guid) {
66  $this->plugin_metadata[$guid] = _elgg_services()->metadataCache->getEntityMetadata($guid);
67  }
68  }
69 
75  public function getSite() {
76  return $this->site;
77  }
78 
84  public function getActivePlugins() {
85  return $this->active_plugins;
86  }
87 
93  public function getPluginMetadata() {
94  return $this->plugin_metadata;
95  }
96 }
$plugin
Plugin class containing helper functions for plugin activation/deactivation, dependency checking capa...
Definition: ElggPlugin.php:16
getSite()
Get the site entity.
Definition: BootData.php:75
getPluginMetadata()
Get plugin metadata.
Definition: BootData.php:93
$plugins
Definition: categories.php:3
$site
Definition: icons.php:5
Updates the basic settings for the primary site object.
get(int $guid, string $type=null, string $subtype=null)
Loads and returns an entity object from a guid.
populate(EntityTable $entities, Plugins $plugins, bool $installed)
Populate the boot data.
Definition: BootData.php:43
Thrown when there is a major problem with the installation.
getActivePlugins()
Get active plugins.
Definition: BootData.php:84
$guids
Activates all specified installed and inactive plugins.
Definition: activate_all.php:9
Serializable collection of data used to boot Elgg.
Definition: BootData.php:16
_elgg_services()
Get the global service provider.
Definition: elgglib.php:346
Persistent, installation-wide key-value storage.
Definition: Plugins.php:29
find(string $status= 'active')
Returns an ordered list of plugins.
Definition: Plugins.php:700
Entity table database service.
Definition: EntityTable.php:26
$guid
Reset an ElggUpgrade.
Definition: reset.php:6