/** * Builds plugins list that will be passed to templates engine. * * @return array */ protected function buildPluginsList() { $plugins = array(); foreach (PluginUtils::discoverPlugins() as $plugin_name) { $plugin = new PluginInfo($plugin_name); $plugins[] = array('name' => $plugin_name, 'version' => $plugin->isInstalled() ? $plugin->getInstalledVersion() : $plugin->getVersion(), 'dependencies' => array_merge($plugin->getSystemRequirements(), $plugin->getDependencies()), 'enabled' => $plugin->isEnabled(), 'installed' => $plugin->isInstalled(), 'needsUpdate' => $plugin->needsUpdate(), 'canBeEnabled' => $plugin->canBeEnabled(), 'canBeDisabled' => $plugin->canBeDisabled(), 'canBeUninstalled' => $plugin->canBeUninstalled(), 'canBeUpdated' => $plugin->canBeUpdated(), 'state' => $this->getPluginState($plugin)); } return $plugins; }
/** * Retrieves info about plugins available in the system. * * @return array Associative array of plugins info. Each key of the array is * fully qualified plugin's name and each value is an array with the * fillowing keys: * - "version": string, version of the plugin which presents in the system. * - "installed": boolean, indicates if the plugin is installed. * - "enabled": boolean, indicates if the plugin is enabled. */ protected function getPluginsInfo() { if (is_null($this->pluginsInfo)) { $this->pluginsInfo = []; $names = PluginUtils::discoverPlugins(); foreach ($names as $plugin_name) { $info = new PluginInfo($plugin_name); $this->pluginsInfo[$plugin_name] = array('version' => $info->getVersion(), 'installed' => $info->getState()->installed, 'enabled' => $info->getState()->enabled); } } return $this->pluginsInfo; }
/** * Returns list of dependent plugins. * * @return array List of plugins names. */ public function getDependentPlugins() { $dependent_plugins = array(); foreach (Utils::discoverPlugins() as $plugin_name) { $plugin = new PluginInfo($plugin_name); if (array_key_exists($this->getName(), $plugin->getDependencies())) { $dependent_plugins[] = $plugin_name; } } return $dependent_plugins; }