/** * Installation Step 1: Welcome */ function welcome($message = false) { // Delete merged js/css files to force regenerations based on updated activated plugin list Piwik::deleteAllCacheOnUpdate(); $view = new Piwik_Installation_View($this->pathView . 'welcome.tpl', $this->getInstallationSteps(), __FUNCTION__); $view->newInstall = !file_exists(Piwik_Config::getLocalConfigPath()); $view->errorMessage = $message; $this->skipThisStep(__FUNCTION__); $view->showNextStep = $view->newInstall; $this->session->currentStepDone = __FUNCTION__; echo $view->render(); }
function dispatch() { $module = Piwik_Common::getRequestVar('module', '', 'string'); $updater = new Piwik_Updater(); $updater->addComponentToCheck('core', Piwik_Version::VERSION); $updates = $updater->getComponentsWithNewVersion(); if (!empty($updates)) { Piwik::deleteAllCacheOnUpdate(); } if (self::getComponentUpdates($updater) !== null && $module != 'CoreUpdater' && $module != 'Proxy') { if (Piwik_FrontController::shouldRethrowException()) { throw new Exception("Piwik and/or some plugins have been upgraded to a new version. Please run the update process first. See documentation: http://piwik.org/docs/update/"); } else { Piwik::redirectToModule('CoreUpdater'); } } }
function dispatch() { $module = Piwik_Common::getRequestVar('module', '', 'string'); $updater = new Piwik_Updater(); $updater->addComponentToCheck('core', Piwik_Version::VERSION); $updates = $updater->getComponentsWithNewVersion(); if(!empty($updates)) { Piwik::deleteAllCacheOnUpdate(); } if(self::getComponentUpdates($updater) !== null && $module != 'CoreUpdater' // Proxy module is used to redirect users to piwik.org, should still work when Piwik must be updated && $module != 'Proxy') { Piwik::redirectToModule('CoreUpdater'); } }
/** * Activate the specified plugin and install (if needed) * * @param string $pluginName Name of plugin * @throws Exception */ public function activatePlugin($pluginName) { $plugins = Piwik_Config::getInstance()->Plugins['Plugins']; if (in_array($pluginName, $plugins)) { throw new Exception("Plugin '{$pluginName}' already activated."); } $existingPlugins = $this->readPluginsDirectory(); if (array_search($pluginName, $existingPlugins) === false) { Piwik::log("Unable to find the plugin '{$pluginName}' in activatePlugin."); return; } $plugin = $this->loadPlugin($pluginName); if ($plugin === null) { return; } $this->installPluginIfNecessary($plugin); $plugin->activate(); // we add the plugin to the list of activated plugins if (!in_array($pluginName, $plugins)) { $plugins[] = $pluginName; } else { // clean up if we find a dupe $plugins = array_unique($plugins); } // the config file will automatically be saved with the new plugin $this->updatePluginsConfig($plugins); Piwik_Config::getInstance()->forceSave(); // Delete merged js/css files to force regenerations to include the activated plugin Piwik::deleteAllCacheOnUpdate(); }
private function doExecuteUpdates($view, $updater, $componentsWithUpdateFile) { $this->loadAndExecuteUpdateFiles($updater, $componentsWithUpdateFile); Piwik::deleteAllCacheOnUpdate(); $view->coreError = $this->coreError; $view->warningMessages = $this->warningMessages; $view->errorMessages = $this->errorMessages; $view->deactivatedPlugins = $this->deactivatedPlugins; echo $view->render(); }
/** * Activate the specified plugin and install (if needed) * * @param string $pluginName Name of plugin */ public function activatePlugin($pluginName) { $plugins = Zend_Registry::get('config')->Plugins->Plugins->toArray(); if(in_array($pluginName,$plugins)) { throw new Exception("Plugin '$pluginName' already activated."); } $existingPlugins = $this->readPluginsDirectory(); if( array_search($pluginName,$existingPlugins) === false) { throw new Exception("Unable to find the plugin '$pluginName'."); } $plugin = $this->loadPlugin($pluginName); $this->installPluginIfNecessary($plugin); // we add the plugin to the list of activated plugins $plugins[] = $pluginName; // the config file will automatically be saved with the new plugin Zend_Registry::get('config')->Plugins = $plugins; // Delete merged js/css files to force regenerations to include the activated plugin Piwik::deleteAllCacheOnUpdate(); }