Returns info regarding all plugins. Loads plugins that can be loaded.
public loadAllPluginsAndGetTheirInfo ( ) : array | ||
return | array | An array that maps plugin names with arrays of plugin information. Plugin information consists of the following entries: - **activated**: Whether the plugin is activated. - **alwaysActivated**: Whether the plugin should always be activated, or not. - **uninstallable**: Whether the plugin is uninstallable or not. - **invalid**: If the plugin is invalid, this property will be set to true. If the plugin is not invalid, this property will not exist. - **info**: If the plugin was loaded, will hold the plugin information. See {@link Piwik\Plugin::getInformation()}. |
/** * @param bool $themesOnly * @return array */ public function getPluginsHavingUpdate() { $this->pluginManager->loadAllPluginsAndGetTheirInfo(); $loadedPlugins = $this->pluginManager->getLoadedPlugins(); try { $pluginsHavingUpdate = $this->marketplaceClient->getInfoOfPluginsHavingUpdate($loadedPlugins); } catch (\Exception $e) { $pluginsHavingUpdate = array(); } foreach ($pluginsHavingUpdate as $key => $updatePlugin) { foreach ($loadedPlugins as $loadedPlugin) { if (!empty($updatePlugin['name']) && $loadedPlugin->getPluginName() == $updatePlugin['name']) { $updatePlugin['currentVersion'] = $loadedPlugin->getVersion(); $updatePlugin['isActivated'] = $this->pluginManager->isPluginActivated($updatePlugin['name']); $pluginsHavingUpdate[$key] = $this->addMissingRequirements($updatePlugin); break; } } } // remove plugins that have updates but for some reason are not loaded foreach ($pluginsHavingUpdate as $key => $updatePlugin) { if (empty($updatePlugin['currentVersion'])) { unset($pluginsHavingUpdate[$key]); } } return $pluginsHavingUpdate; }
public function safemode($lastError = array()) { ob_clean(); $this->tryToRepairPiwik(); if (empty($lastError)) { $lastError = array('message' => Common::getRequestVar('error_message', null, 'string'), 'file' => Common::getRequestVar('error_file', null, 'string'), 'line' => Common::getRequestVar('error_line', null, 'integer')); } $outputFormat = Common::getRequestVar('format', 'html', 'string'); $outputFormat = strtolower($outputFormat); if (!empty($outputFormat) && 'html' !== $outputFormat) { $errorMessage = $lastError['message']; if (Piwik::isUserIsAnonymous()) { $errorMessage = 'A fatal error occurred.'; } $response = new \Piwik\API\ResponseBuilder($outputFormat); $message = $response->getResponseException(new Exception($errorMessage)); return $message; } if (Common::isPhpCliMode()) { // TODO: I can't find how this will ever get called / safeMode is never set for Console throw new Exception("Error: " . var_export($lastError, true)); } $view = new View('@CorePluginsAdmin/safemode'); $view->lastError = $lastError; $view->isSuperUser = Piwik::hasUserSuperUserAccess(); $view->isAnonymousUser = Piwik::isUserIsAnonymous(); $view->plugins = $this->pluginManager->loadAllPluginsAndGetTheirInfo(); $view->deactivateNonce = Nonce::getNonce(static::DEACTIVATE_NONCE); $view->uninstallNonce = Nonce::getNonce(static::UNINSTALL_NONCE); $view->emailSuperUser = implode(',', Piwik::getAllSuperUserAccessEmailAddresses()); $view->piwikVersion = Version::VERSION; $view->showVersion = !Common::getRequestVar('tests_hide_piwik_version', 0); $view->pluginCausesIssue = ''; if (!empty($lastError['file'])) { preg_match('/piwik\\/plugins\\/(.*)\\//', $lastError['file'], $matches); if (!empty($matches[1])) { $view->pluginCausesIssue = $matches[1]; } } return $view->render(); }