예제 #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);
	}	
예제 #2
0
 static function update()
 {
     try {
         Piwik_Updater::updateDatabase(__FILE__, self::getSql());
     } catch (Exception $e) {
     }
 }
예제 #3
0
	static function update()
	{
		if(Piwik::isTimezoneSupportEnabled())
		{
			Piwik_Updater::updateDatabase(__FILE__, self::getSql());
		}
	}
예제 #4
0
	static function update()
	{
		Piwik_Updater::updateDatabase(__FILE__, array(
			'ALTER TABLE `'. Piwik::prefixTable('user_dashboard') .'`
				CHANGE `layout` `layout` TEXT NOT NULL' => false,
		));
	}
예제 #5
0
	static function update()
	{
		// first we disable the plugins and keep an array of warnings messages 
		$pluginsToDisableMessage = array(
			'SearchEnginePosition' => "SearchEnginePosition plugin was disabled, because it is not compatible with the new Piwik 0.6. \n You can download the latest version of the plugin, compatible with Piwik 0.6.\n<a target='_blank' href='?module=Proxy&action=redirect&url=http://dev.piwik.org/trac/ticket/502'>Click here.</a>", 
			'GeoIP' => "GeoIP plugin was disabled, because it is not compatible with the new Piwik 0.6. \nYou can download the latest version of the plugin, compatible with Piwik 0.6.\n<a target='_blank' href='?module=Proxy&action=redirect&url=http://dev.piwik.org/trac/ticket/45'>Click here.</a>"
		);
		$disabledPlugins = array();
		foreach($pluginsToDisableMessage as $pluginToDisable => $warningMessage) 
		{
			if(Piwik_PluginsManager::getInstance()->isPluginActivated($pluginToDisable))
			{
				Piwik_PluginsManager::getInstance()->deactivatePlugin($pluginToDisable);
				$disabledPlugins[] = $warningMessage;
			}
		}
		
		// Run the SQL
		Piwik_Updater::updateDatabase(__FILE__, self::getSql());
		
		// Outputs warning message, pointing users to the plugin download page
		if(!empty($disabledPlugins))
		{
			throw new Exception("The following plugins were disabled during the upgrade:"
							."<ul><li>" . 
								implode('</li><li>', $disabledPlugins) . 
							"</li></ul>");
		}
	}
예제 #6
0
파일: 0.5.4.php 프로젝트: nnnnathann/piwik
 static function update()
 {
     $salt = Piwik_Common::generateUniqId();
     if (!isset(Piwik_Config::getInstance()->superuser['salt'])) {
         try {
             if (is_writable(Piwik_Config::getLocalConfigPath())) {
                 Piwik_Config::getInstance()->setConfigOption('superuser', 'salt', $salt);
                 Piwik_Config::getInstance()->forceSave();
             } else {
                 throw new Exception('mandatory update failed');
             }
         } catch (Exception $e) {
             throw new Piwik_Updater_UpdateErrorException("Please edit your config/config.ini.php file and add below <code>[superuser]</code> the following line: <br /><code>salt = {$salt}</code>");
         }
     }
     $plugins = Piwik_Config::getInstance()->Plugins;
     if (!in_array('MultiSites', $plugins)) {
         try {
             if (is_writable(Piwik_Config::getLocalConfigPath())) {
                 $plugins[] = 'MultiSites';
                 Piwik_Config::getInstance()->setConfigSection('Plugins', $plugins);
                 Piwik_Config::getInstance()->forceSave();
             } else {
                 throw new Exception('optional update failed');
             }
         } catch (Exception $e) {
             throw new Exception("You can now enable the new MultiSites plugin in the Plugins screen in the Piwik admin!");
         }
     }
     Piwik_Updater::updateDatabase(__FILE__, self::getSql());
 }
예제 #7
0
	static function update()
	{
		$sqlarray = array(
			'ALTER TABLE `'. Piwik::prefixTable('log_visit') .'`
				ADD `visit_goal_converted` VARCHAR( 1 ) NOT NULL AFTER `visit_total_time`' => false,
			// 0.2.27 [826]
			'ALTER IGNORE TABLE `'. Piwik::prefixTable('log_visit') .'`
				CHANGE `visit_goal_converted` `visit_goal_converted` TINYINT(1) NOT NULL' => false,
		);

		$tables = Piwik::getTablesCreateSql();
		$sqlarray[ $tables['log_conversion'] ] = false;
		$sqlarray[ $tables['goal'] ] = false;

		$tables = Piwik::getTablesInstalled();
		foreach($tables as $tableName)
		{
			if(preg_match('/archive_/', $tableName) == 1)
			{
				$sqlarray[ 'CREATE INDEX index_all ON '. $tableName .' (`idsite`,`date1`,`date2`,`name`,`ts_archived`)' ] = false;
			}
		}

		Piwik_Updater::updateDatabase(__FILE__, $sqlarray);
	}
예제 #8
0
	static function update()
	{
		$config = Zend_Registry::get('config');
		$dbInfos = $config->database->toArray();
		if(!isset($dbInfos['schema']))
		{
			try {
				if(is_writable( Piwik_Config::getDefaultUserConfigPath() ))
				{
					$dbInfos['schema'] = 'Myisam';
					$config->database = $dbInfos;

					$config->__destruct();
					Piwik::createConfigObject();
				}
				else
				{
					throw new Exception('mandatory update failed');
				}
			} catch(Exception $e) {
				throw new Piwik_Updater_UpdateErrorException("Please edit your config/config.ini.php file and add below <code>[database]</code> the following line: <br /><code>schema = Myisam</code>");
			}
		}

		Piwik_Updater::updateDatabase(__FILE__, self::getSql());
	}
예제 #9
0
 static function update()
 {
     Piwik_Updater::updateDatabase(__FILE__, self::getSql());
     try {
         Piwik_PluginsManager::getInstance()->activatePlugin('Transitions');
     } catch (Exception $e) {
     }
 }
예제 #10
0
    static function update()
    {
        Piwik_Updater::updateDatabase(__FILE__, array('ALTER TABLE `' . Piwik::prefixTable('log_visit') . '`
				ADD `config_java` TINYINT(1) NOT NULL AFTER `config_flash`' => '/1060/', 'ALTER TABLE `' . Piwik::prefixTable('log_visit') . '`
				ADD `config_quicktime` TINYINT(1) NOT NULL AFTER `config_director`' => '/1060/', 'ALTER TABLE `' . Piwik::prefixTable('log_visit') . '`
				ADD `config_gears` TINYINT(1) NOT NULL AFTER  `config_windowsmedia`,
				ADD `config_silverlight` TINYINT(1) NOT NULL AFTER `config_gears`' => false));
    }
예제 #11
0
	static function update()
	{
		Piwik_Updater::updateDatabase(__FILE__, array(
			'DELETE FROM `'.  Piwik::prefixTable('user_dashboard') ."`
				WHERE layout LIKE '%.getLastVisitsGraph%'
				OR layout LIKE '%.getLastVisitsReturningGraph%'" => false,
		));
	}
예제 #12
0
파일: 0.4.php 프로젝트: ntulip/piwik
    static function update()
    {
        Piwik_Updater::updateDatabase(__FILE__, array('UPDATE `' . Piwik::prefixTable('log_visit') . '`
				SET location_ip=location_ip+CAST(POW(2,32) AS UNSIGNED) WHERE location_ip < 0' => false, 'ALTER TABLE `' . Piwik::prefixTable('log_visit') . '`
				CHANGE `location_ip` `location_ip` BIGINT UNSIGNED NOT NULL' => false, 'UPDATE `' . Piwik::prefixTable('logger_api_call') . '`
				SET caller_ip=caller_ip+CAST(POW(2,32) AS UNSIGNED) WHERE caller_ip < 0' => false, 'ALTER TABLE `' . Piwik::prefixTable('logger_api_call') . '`
				CHANGE `caller_ip` `caller_ip` BIGINT UNSIGNED' => false));
    }
예제 #13
0
 static function update()
 {
     // manually remove ExampleFeedburner column
     Piwik_Updater::updateDatabase(__FILE__, self::getSql());
     // remove ExampleFeedburner plugin
     $pluginToDelete = 'ExampleFeedburner';
     self::deletePluginFromConfigFile($pluginToDelete);
 }
예제 #14
0
	static function update()
	{
		$tables = Piwik::getTablesCreateSql();
		Piwik_Updater::updateDatabase(__FILE__, array(
			'DROP TABLE IF EXISTS `'. Piwik::prefixTable('option') .'`' => false,
			$tables['option'] => false,
		));
	}
예제 #15
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');
         }
     }
 }
예제 #16
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');
		}
	}
예제 #17
0
	static function update()
	{
		Piwik_Updater::updateDatabase(__FILE__, array(
			'ALTER TABLE `'. Piwik::prefixTable('log_conversion') .'`
				CHANGE `idlink_va` `idlink_va` INT(11) DEFAULT NULL' => false,
			'ALTER TABLE `'. Piwik::prefixTable('log_conversion') .'`
				CHANGE `idaction` `idaction` INT(11) DEFAULT NULL' => false,
		));
	}
예제 #18
0
파일: 0.2.33.php 프로젝트: ntulip/piwik
    static function update()
    {
        // alter table to set the utf8 collation
        $tablesToAlter = Piwik::getTablesInstalled(true);
        foreach ($tablesToAlter as $table) {
            $sqlarray['ALTER TABLE `' . $table . '`
				CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci '] = false;
        }
        Piwik_Updater::updateDatabase(__FILE__, $sqlarray);
    }
예제 #19
0
	static function update()
	{
		Piwik_Updater::updateDatabase(__FILE__, array(
			'CREATE INDEX index_type_name
				ON '. Piwik::prefixTable('log_action') .' (type, name(15))' => false,
			'CREATE INDEX index_idsite_date
				ON '. Piwik::prefixTable('log_visit') .' (idsite, visit_server_date)' => false,
			'DROP INDEX index_idsite ON '. Piwik::prefixTable('log_visit') => false,
			'DROP INDEX index_visit_server_date ON '. Piwik::prefixTable('log_visit') => false,
		));
	}
예제 #20
0
파일: 0.2.10.php 프로젝트: ntulip/piwik
 static function update()
 {
     $tables = Piwik::getTablesCreateSql();
     Piwik_Updater::updateDatabase(__FILE__, array($tables['option'] => false));
     $obsoleteDirectories = array('/plugins/AdminHome', '/plugins/Home', '/plugins/PluginsAdmin');
     foreach ($obsoleteDirectories as $dir) {
         if (file_exists(PIWIK_INCLUDE_PATH . $dir)) {
             Piwik::unlinkRecursive(PIWIK_INCLUDE_PATH . $dir, true);
         }
     }
 }
예제 #21
0
 static function update()
 {
     try {
         self::enableMaintenanceMode();
         Piwik_Updater::updateDatabase(__FILE__, self::getSql());
         self::disableMaintenanceMode();
     } catch (Exception $e) {
         self::disableMaintenanceMode();
         throw $e;
     }
 }
예제 #22
0
	static function update()
	{
		$config = Zend_Registry::get('config');
		$salt = Piwik_Common::generateUniqId();
		if(!isset($config->superuser->salt))
		{
			try {
				if(is_writable( Piwik_Config::getDefaultUserConfigPath() ))
				{
					$superuser_info = $config->superuser->toArray();
					$superuser_info['salt'] = $salt;
					$config->superuser = $superuser_info;

					$config->__destruct();
					Piwik::createConfigObject();
				}
				else
				{
					throw new Exception('mandatory update failed');
				}
			} catch(Exception $e) {
				throw new Piwik_Updater_UpdateErrorException("Please edit your config/config.ini.php file and add below <code>[superuser]</code> the following line: <br/><code>salt = $salt</code>");
			}
		}

		$config = Zend_Registry::get('config');
		$plugins = $config->Plugins->toArray();
		if(!in_array('MultiSites', $plugins))
		{
			try {
				if(is_writable( Piwik_Config::getDefaultUserConfigPath() ))
				{
					$plugins[] = 'MultiSites';
					$config->Plugins = $plugins;

					$config->__destruct();
					Piwik::createConfigObject();
				}
				else
				{
					throw new Exception('optional update failed');
				}
			} catch(Exception $e) {
				throw new Exception("You can now enable the new MultiSites plugin in the Plugins screen in the Piwik admin!");
			}
		}
		
		Piwik_Updater::updateDatabase(__FILE__, array(
			'ALTER TABLE `'. Piwik::prefixTable('log_action') .'` 
				CHANGE `name` `name` TEXT' => false,
		));
		
	}
예제 #23
0
	static function update()
	{
		Piwik_Updater::updateDatabase(__FILE__, array(
			'ALTER TABLE `'. Piwik::prefixTable('site') .'`
				CHANGE `ts_created` `ts_created` TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL' => false,
			'ALTER TABLE `'. Piwik::prefixTable('log_visit') .'`
				DROP `config_color_depth`' => false,
			// 0.2.12 [673]
			// Note: requires INDEX privilege
			'DROP INDEX index_idaction ON `'. Piwik::prefixTable('log_action') .'`' => '1091',
		));
	}
예제 #24
0
	static function update()
	{
		Piwik_Updater::updateDatabase(__FILE__, array(
			// 0.2.32 [941]
			'ALTER TABLE `'. Piwik::prefixTable('access') .'`
				CHANGE `login` `login` VARCHAR( 100 ) NOT NULL' => false,
			'ALTER TABLE `'. Piwik::prefixTable('user') .'`
				CHANGE `login` `login` VARCHAR( 100 ) NOT NULL' => false,
			'ALTER TABLE `'. Piwik::prefixTable('user_dashboard') .'`
				CHANGE `login` `login` VARCHAR( 100 ) NOT NULL' => '1146',
			'ALTER TABLE `'. Piwik::prefixTable('user_language') .'`
				CHANGE `login` `login` VARCHAR( 100 ) NOT NULL' => '1146',
		));
	}
예제 #25
0
 static function update()
 {
     Piwik_Updater::updateDatabase(__FILE__, self::getSql());
     $obsoleteFile = '/plugins/ExamplePlugin/API.php';
     if (file_exists(PIWIK_INCLUDE_PATH . $obsoleteFile)) {
         @unlink(PIWIK_INCLUDE_PATH . $obsoleteFile);
     }
     $obsoleteDirectories = array('/plugins/AdminHome', '/plugins/Home', '/plugins/PluginsAdmin');
     foreach ($obsoleteDirectories as $dir) {
         if (file_exists(PIWIK_INCLUDE_PATH . $dir)) {
             Piwik::unlinkRecursive(PIWIK_INCLUDE_PATH . $dir, true);
         }
     }
 }
예제 #26
0
	static function update()
	{
		Piwik_Updater::updateDatabase(__FILE__, array(
			'ALTER TABLE ' . Piwik::prefixTable('log_action') . ' ADD COLUMN `hash` INTEGER(10) UNSIGNED NOT NULL AFTER `name`;' => '1060',
			'ALTER TABLE ' . Piwik::prefixTable('log_visit') . ' CHANGE visit_exit_idaction visit_exit_idaction_url INTEGER(11) NOT NULL;' => '1054',
			'ALTER TABLE ' . Piwik::prefixTable('log_visit') . ' CHANGE visit_entry_idaction visit_entry_idaction_url INTEGER(11) NOT NULL;' => '1054',
			'ALTER TABLE ' . Piwik::prefixTable('log_link_visit_action') . ' CHANGE `idaction_ref` `idaction_url_ref` INTEGER(10) UNSIGNED NOT NULL;' => '1054',
			'ALTER TABLE ' . Piwik::prefixTable('log_link_visit_action') . ' CHANGE `idaction` `idaction_url` INTEGER(10) UNSIGNED NOT NULL;' => '1054', 
			'ALTER TABLE ' . Piwik::prefixTable('log_link_visit_action') . ' ADD COLUMN `idaction_name` INTEGER(10) UNSIGNED AFTER `idaction_url_ref`;' => '1060',
			'ALTER TABLE ' . Piwik::prefixTable('log_conversion') . ' CHANGE `idaction` `idaction_url` INTEGER(11) UNSIGNED NOT NULL;' => '1054',
			'UPDATE ' . Piwik::prefixTable('log_action') . ' SET `hash` = CRC32(name);' => false,
			'CREATE INDEX index_type_hash ON ' . Piwik::prefixTable('log_action') . ' (type, hash);' => '1061',
			'DROP INDEX index_type_name ON ' . Piwik::prefixTable('log_action') . ';' => '1091',
		));
	}
예제 #27
0
 static function update()
 {
     try {
         $dashboards = Piwik_FetchAll('SELECT * FROM `' . Piwik_Common::prefixTable('user_dashboard') . '`');
         foreach ($dashboards as $dashboard) {
             $idDashboard = $dashboard['iddashboard'];
             $login = $dashboard['login'];
             $layout = $dashboard['layout'];
             $layout = html_entity_decode($layout);
             $layout = str_replace("\\\"", "\"", $layout);
             Piwik_Query('UPDATE `' . Piwik_Common::prefixTable('user_dashboard') . '` SET layout = ? WHERE iddashboard = ? AND login = ?', array($layout, $idDashboard, $login));
         }
         Piwik_Updater::updateDatabase(__FILE__, self::getSql());
     } catch (Exception $e) {
     }
 }
예제 #28
0
	static function update()
	{
		$tables = Piwik::getTablesCreateSql();
		Piwik_Updater::updateDatabase(__FILE__, array(
			$tables['option'] => false,
		));

		Piwik_Updater::updateDatabase(__FILE__, array(
			// 0.1.7 [463]
			'ALTER IGNORE TABLE `'. Piwik::prefixTable('log_visit') .'`
				 CHANGE `location_provider` `location_provider` VARCHAR( 100 ) DEFAULT NULL' => '1054',
			// 0.1.7 [470]
			'ALTER TABLE `'. Piwik::prefixTable('logger_api_call') .'`
				CHANGE `parameter_names_default_values` `parameter_names_default_values` TEXT,
				CHANGE `parameter_values` `parameter_values` TEXT,
				CHANGE `returned_value` `returned_value` TEXT' => false,
			'ALTER TABLE `'. Piwik::prefixTable('logger_error') .'`
				CHANGE `message` `message` TEXT' => false,
			'ALTER TABLE `'. Piwik::prefixTable('logger_exception') .'`
				CHANGE `message` `message` TEXT' => false,
			'ALTER TABLE `'. Piwik::prefixTable('logger_message') .'`
				CHANGE `message` `message` TEXT' => false,
			// 0.2.2 [489]
			'ALTER IGNORE TABLE `'. Piwik::prefixTable('site') .'`
				 CHANGE `feedburnerName` `feedburnerName` VARCHAR( 100 ) DEFAULT NULL' => '1054',
		));

		$obsoleteFile = '/plugins/ExamplePlugin/API.php';
		if(file_exists(PIWIK_INCLUDE_PATH . $obsoleteFile))
		{
			@unlink(PIWIK_INCLUDE_PATH . $obsoleteFile);
		}

		$obsoleteDirectories = array(
			'/plugins/AdminHome',
			'/plugins/Home',
			'/plugins/PluginsAdmin',
		);
		foreach($obsoleteDirectories as $dir)
		{
			if(file_exists(PIWIK_INCLUDE_PATH . $dir))
			{
				Piwik::unlinkRecursive(PIWIK_INCLUDE_PATH . $dir, true);
			}
		}
	}
예제 #29
0
파일: 0.6.3.php 프로젝트: nnnnathann/piwik
 static function update()
 {
     $dbInfos = Piwik_Config::getInstance()->database;
     if (!isset($dbInfos['schema'])) {
         try {
             if (is_writable(Piwik_Config::getLocalConfigPath())) {
                 Piwik_Config::getInstance()->setConfigOption('database', 'schema', 'Myisam');
                 Piwik_Config::getInstance()->forceSave();
             } else {
                 throw new Exception('mandatory update failed');
             }
         } catch (Exception $e) {
             throw new Piwik_Updater_UpdateErrorException("Please edit your config/config.ini.php file and add below <code>[database]</code> the following line: <br /><code>schema = Myisam</code>");
         }
     }
     Piwik_Updater::updateDatabase(__FILE__, self::getSql());
 }
예제 #30
0
	static function update()
	{
		$sqlarray = array(
			// 0.2.33 [1020]
			'ALTER TABLE `'. Piwik::prefixTable('user_dashboard') .'`
				CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci ' => '1146',
			'ALTER TABLE `'. Piwik::prefixTable('user_language') .'`
				CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci ' => '1146',
		);

		// alter table to set the utf8 collation
		$tablesToAlter = Piwik::getTablesInstalled(true);
		foreach($tablesToAlter as $table) {
			$sqlarray[ 'ALTER TABLE `'. $table .'`
				CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci ' ] = false;
		}

		Piwik_Updater::updateDatabase(__FILE__, $sqlarray);
	}