Esempio n. 1
0
	function dispatch()
	{
		$language = Piwik_Common::getRequestVar('language', '', 'string');
		if($language != '')
		{
			$updaterController = new Piwik_CoreUpdater_Controller();
			$updaterController->saveLanguage();
			exit;
		}

		$updater = new Piwik_Updater();
		$updater->addComponentToCheck('core', Piwik_Version::VERSION);
		
		$plugins = Piwik_PluginsManager::getInstance()->getInstalledPlugins();
		foreach($plugins as $pluginName => $plugin)
		{
			$updater->addComponentToCheck($pluginName, $plugin->getVersion());
		}
		
		$componentsWithUpdateFile = $updater->getComponentsWithUpdateFile();
		if(count($componentsWithUpdateFile) == 0)
		{
			return;
		}
			
		$updaterController = new Piwik_CoreUpdater_Controller();
		$updaterController->runUpdaterAndExit($updater, $componentsWithUpdateFile);
	}	
Esempio n. 2
0
 public function test_updaterChecksCoreAndPlugin_checkThatCoreIsRanFirst()
 {
     $updater = new Piwik_Updater();
     $updater->pathUpdateFilePlugins = PIWIK_INCLUDE_PATH . '/tests/resources/Updater/%s/';
     $updater->pathUpdateFileCore = PIWIK_INCLUDE_PATH . '/tests/resources/Updater/core/';
     $updater->recordComponentSuccessfullyUpdated('testpluginUpdates', '0.1beta');
     $updater->addComponentToCheck('testpluginUpdates', '0.1');
     $updater->recordComponentSuccessfullyUpdated('core', '0.1');
     $updater->addComponentToCheck('core', '0.3');
     $componentsWithUpdateFile = $updater->getComponentsWithUpdateFile();
     $this->assertTrue(count($componentsWithUpdateFile) == 2);
     reset($componentsWithUpdateFile);
     $this->assertTrue(key($componentsWithUpdateFile) == 'core');
 }
Esempio n. 3
0
 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');
         }
     }
 }
Esempio n. 4
0
	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');
		}
	}
Esempio n. 5
0
 public static function displayScreenForCoreAndPluginsUpdatesIfNecessary()
 {
     $updater = new Piwik_Updater();
     $updater->addComponentToCheck('core', Piwik_Version::VERSION);
     $plugins = Piwik_PluginsManager::getInstance()->getInstalledPlugins();
     foreach ($plugins as $pluginName => $plugin) {
         $updater->addComponentToCheck($pluginName, $plugin->getVersion());
     }
     $componentsWithUpdateFile = $updater->getComponentsWithUpdateFile();
     if (count($componentsWithUpdateFile) == 0) {
         return;
     }
     $updaterController = new Piwik_CoreUpdater_Controller();
     $updaterController->runUpdaterAndExit($updater, $componentsWithUpdateFile);
 }