public function pluginDetails() { $view = $this->configureViewAndCheckPermission('@Marketplace/plugin-details'); $pluginName = new PluginName(); $pluginName = $pluginName->getPluginName(); $activeTab = Common::getRequestVar('activeTab', '', 'string'); if ('changelog' !== $activeTab) { $activeTab = ''; } try { $plugin = $this->plugins->getPluginInfo($pluginName); if (empty($plugin['name'])) { throw new Exception('Plugin does not exist'); } } catch (Exception $e) { $plugin = null; $view->errorMessage = $e->getMessage(); } $view->plugin = $plugin; $view->isSuperUser = Piwik::hasUserSuperUserAccess(); $view->installNonce = Nonce::getNonce(static::INSTALL_NONCE); $view->updateNonce = Nonce::getNonce(static::UPDATE_NONCE); $view->activeTab = $activeTab; $view->isAutoUpdatePossible = SettingsPiwik::isAutoUpdatePossible(); $view->isAutoUpdateEnabled = SettingsPiwik::isAutoUpdateEnabled(); $view->numUsers = $this->environment->getNumUsers(); return $view->render(); }
private function fetch($action, $params) { ksort($params); // sort params so cache is reused more often even if param order is different $releaseChannel = $this->environment->getReleaseChannel(); if (!empty($releaseChannel)) { $params['release_channel'] = $releaseChannel; } $params['prefer_stable'] = (int) $this->environment->doesPreferStable(); $params['piwik'] = $this->environment->getPiwikVersion(); $params['php'] = $this->environment->getPhpVersion(); $params['mysql'] = $this->environment->getMySQLVersion(); $params['num_users'] = $this->environment->getNumUsers(); $params['num_websites'] = $this->environment->getNumWebsites(); $query = http_build_query($params); $cacheId = $this->getCacheKey($action, $query); $result = $this->cache->fetch($cacheId); if ($result !== false) { return $result; } try { $result = $this->service->fetch($action, $params); } catch (Service\Exception $e) { throw new Exception($e->getMessage(), $e->getCode()); } $this->cache->save($cacheId, $result, self::CACHE_TIMEOUT_IN_SECONDS); return $result; }