Exemplo n.º 1
0
 public function authenticate()
 {
     // we first try if the user is the super user
     $rootLogin = Zend_Registry::get('config')->superuser->login;
     $rootPassword = Zend_Registry::get('config')->superuser->password;
     $rootToken = Piwik_UsersManager_API::getTokenAuth($rootLogin, $rootPassword);
     //		echo $rootToken;
     //		echo "<br>". $this->_credential;exit;
     if ($this->_identity == $rootLogin && $this->_credential == $rootToken) {
         return new Piwik_Auth_Result(Piwik_Auth::SUCCESS_SUPERUSER_AUTH_CODE, $this->_identity, array());
     }
     // we then look if the user is API authenticated
     // API authentication works without login name, but only with the token
     // TODO the logic (sql select) should be in the Login plugin, not here
     // this class should stay simple. Another Login plugin should only have to create an auth entry
     // of this class in the zend_registry and it should work
     if (is_null($this->_identity)) {
         $authenticated = false;
         if ($this->_credential === $rootToken) {
             return new Piwik_Auth_Result(Piwik_Auth::SUCCESS_SUPERUSER_AUTH_CODE, $rootLogin, array());
         }
         $login = Zend_Registry::get('db')->fetchOne('SELECT login FROM ' . Piwik::prefixTable('user') . ' WHERE token_auth = ?', array($this->_credential));
         if ($login !== false) {
             return new Piwik_Auth_Result(Zend_Auth_Result::SUCCESS, $login, array());
         } else {
             return new Piwik_Auth_Result(Zend_Auth_Result::FAILURE, $this->_identity, array());
         }
     }
     // if not then we return the result of the database authentification provided by zend
     return parent::authenticate();
 }
Exemplo n.º 2
0
 public function deleteGoal($idSite, $idGoal)
 {
     Piwik::checkUserHasAdminAccess($idSite);
     Piwik_Query("UPDATE " . Piwik::prefixTable('goal') . "\n\t\t\t\t\t\t\t\t\t\tSET deleted = 1\n\t\t\t\t\t\t\t\t\t\tWHERE idsite = ? \n\t\t\t\t\t\t\t\t\t\t\tAND idgoal = ?", array($idSite, $idGoal));
     Zend_Registry::get('db')->query("DELETE FROM " . Piwik::prefixTable("log_conversion") . " WHERE idgoal = ?", $idGoal);
     Piwik_Common::regenerateCacheWebsiteAttributes($idSite);
 }
Exemplo n.º 3
0
	public function authenticate()
	{
		$rootLogin = Zend_Registry::get('config')->superuser->login;
		$rootPassword = Zend_Registry::get('config')->superuser->password;
		$rootToken = Piwik_UsersManager_API::getTokenAuth($rootLogin, $rootPassword);

		if($this->login == $rootLogin
			&& $this->token_auth == $rootToken)
		{
			return new Piwik_Auth_Result(Piwik_Auth_Result::SUCCESS_SUPERUSER_AUTH_CODE, $this->login, $this->token_auth );
		}

		if($this->token_auth === $rootToken)
		{
			return new Piwik_Auth_Result(Piwik_Auth_Result::SUCCESS_SUPERUSER_AUTH_CODE, $rootLogin, $rootToken );
		}

		$login = Piwik_FetchOne(
					'SELECT login FROM '.Piwik::prefixTable('user').' WHERE token_auth = ?',
					array($this->token_auth)
		);
		if($login !== false)
		{
			if(is_null($this->login)
				|| $this->login == $login)
			{
				return new Piwik_Auth_Result(Piwik_Auth_Result::SUCCESS, $login, $this->token_auth );
			}
		}
		return new Piwik_Auth_Result( Piwik_Auth_Result::FAILURE, $this->login, $this->token_auth );
	}
Exemplo n.º 4
0
	static function update()
	{
		Piwik_Updater::updateDatabase(__FILE__, array(
			'ALTER TABLE `'. Piwik::prefixTable('user_dashboard') .'`
				CHANGE `layout` `layout` TEXT NOT NULL' => false,
		));
	}
Exemplo n.º 5
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);
	}
Exemplo n.º 6
0
Arquivo: 0.4.php Projeto: 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));
    }
Exemplo n.º 7
0
    /**
     * Function called to save the Feedburner ID entered in the form
     *
     */
    function saveFeedburnerName()
    {
        // we save the value in the DB for an authenticated user
        if (Piwik::getCurrentUserLogin() != 'anonymous') {
            Piwik_Query('UPDATE ' . Piwik::prefixTable('site') . ' 
						 SET feedburnerName = ? WHERE idsite = ?', array(Piwik_Common::getRequestVar('name', '', 'string'), Piwik_Common::getRequestVar('idSite', 1, 'int')));
        }
    }
Exemplo n.º 8
0
	static function update()
	{
		$tables = Piwik::getTablesCreateSql();
		Piwik_Updater::updateDatabase(__FILE__, array(
			'DROP TABLE IF EXISTS `'. Piwik::prefixTable('option') .'`' => false,
			$tables['option'] => false,
		));
	}
Exemplo n.º 9
0
    static function getSql()
    {
        return 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);
    }
Exemplo n.º 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));
    }
Exemplo n.º 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,
		));
	}
Exemplo n.º 12
0
    static function getSql()
    {
        return array('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');
    }
Exemplo n.º 13
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,
		));
	}
Exemplo n.º 14
0
 function __construct($logToFileFilename, $fileFormatter, $screenFormatter, $logToDatabaseTableName, $logToDatabaseColumnMapping)
 {
     parent::__construct();
     $this->logToFileFilename = PIWIK_INCLUDE_PATH . '/' . Zend_Registry::get('config')->log->logger_file_path . $logToFileFilename;
     $this->fileFormatter = $fileFormatter;
     $this->screenFormatter = $screenFormatter;
     $this->logToDatabaseTableName = Piwik::prefixTable($logToDatabaseTableName);
     $this->logToDatabaseColumnMapping = $logToDatabaseColumnMapping;
 }
Exemplo n.º 15
0
 /**
  * Returns the layout in the DB for the given user, or false if the layout has not been set yet.
  * Parameters must be checked BEFORE this function call
  *
  * @param string $login
  * @param int $idDashboard
  * @param string|false $layout
  */
 protected function getLayoutForUser($login, $idDashboard)
 {
     $paramsBind = array($login, $idDashboard);
     $return = Piwik_FetchAll('SELECT layout FROM ' . Piwik::prefixTable('user_dashboard') . ' WHERE login = ? AND iddashboard = ?', $paramsBind);
     if (count($return) == 0) {
         return false;
     }
     return $return[0]['layout'];
 }
Exemplo n.º 16
0
 function __construct($logToFileFilename, $fileFormatter, $screenFormatter, $logToDatabaseTableName, $logToDatabaseColumnMapping)
 {
     parent::__construct();
     $this->logToFileFilename = Zend_Registry::get('config')->path->log . $logToFileFilename;
     $this->fileFormatter = $fileFormatter;
     $this->screenFormatter = $screenFormatter;
     $this->logToDatabaseTableName = Piwik::prefixTable($logToDatabaseTableName);
     $this->logToDatabaseColumnMapping = $logToDatabaseColumnMapping;
 }
Exemplo n.º 17
0
 public function deleteGoal($idSite, $idGoal)
 {
     Piwik::checkUserHasAdminAccess($idSite);
     $where[] = 'idsite = ' . Zend_Registry::get('db')->quote($idSite);
     $where[] = 'idgoal = ' . Zend_Registry::get('db')->quote($idGoal);
     Zend_Registry::get('db')->update(Piwik::prefixTable('goal'), array('deleted' => 1), $where);
     Zend_Registry::get('db')->delete(Piwik::prefixTable("log_conversion"), "idgoal={$idGoal}");
     Piwik_Common::regenerateCacheWebsiteAttributes($idSite);
 }
Exemplo n.º 18
0
    static function getSql()
    {
        return 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, 'ALTER TABLE `' . Piwik::prefixTable('log_visit') . '`
				CHANGE `location_ip` `location_ip` BIGINT UNSIGNED NOT NULL' => false, 'ALTER TABLE `' . Piwik::prefixTable('logger_api_call') . '`
				CHANGE `caller_ip` `caller_ip` BIGINT UNSIGNED' => false);
    }
Exemplo n.º 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,
		));
	}
Exemplo n.º 20
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,
		));
		
	}
Exemplo n.º 21
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',
		));
	}
Exemplo n.º 22
0
 function __construct($logToFileFilename, $fileFormatter, $screenFormatter, $logToDatabaseTableName, $logToDatabaseColumnMapping)
 {
     parent::__construct();
     $log_dir = Zend_Registry::get('config')->log->logger_file_path;
     if ($log_dir[0] != '/' && $log_dir[0] != DIRECTORY_SEPARATOR) {
         $log_dir = PIWIK_USER_PATH . '/' . $log_dir;
     }
     $this->logToFileFilename = $log_dir . '/' . $logToFileFilename;
     $this->fileFormatter = $fileFormatter;
     $this->screenFormatter = $screenFormatter;
     $this->logToDatabaseTableName = Piwik::prefixTable($logToDatabaseTableName);
     $this->logToDatabaseColumnMapping = $logToDatabaseColumnMapping;
 }
Exemplo n.º 23
0
    static function getSql()
    {
        $sqlarray = array('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;
        }
        return $sqlarray;
    }
Exemplo n.º 24
0
    static function getSql()
    {
        $tables = Piwik::getTablesCreateSql();
        return array($tables['option'] => false, 'ALTER IGNORE TABLE `' . Piwik::prefixTable('log_visit') . '`
				 CHANGE `location_provider` `location_provider` VARCHAR( 100 ) DEFAULT NULL' => '1054', '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, 'ALTER IGNORE TABLE `' . Piwik::prefixTable('site') . '`
				 CHANGE `feedburnerName` `feedburnerName` VARCHAR( 100 ) DEFAULT NULL' => '1054');
    }
Exemplo n.º 25
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',
		));
	}
Exemplo n.º 26
0
    private function autoload()
    {
        static $loaded = false;
        if ($loaded) {
            return;
        }
        $all = Piwik_FetchAll('SELECT option_value, option_name
								FROM `' . Piwik::prefixTable('option') . '` 
								WHERE autoload = 1');
        foreach ($all as $option) {
            $this->all[$option['option_name']] = $option['option_value'];
        }
        $loaded = true;
    }
Exemplo n.º 27
0
 static function getSql()
 {
     $sqlarray = array('DROP INDEX index_idsite_date ON ' . Piwik::prefixTable('log_visit') => '1091', 'CREATE INDEX index_idsite_date_config ON ' . Piwik::prefixTable('log_visit') . ' (idsite, visit_server_date, config_md5config(8))' => '1061');
     $tables = Piwik::getTablesInstalled();
     foreach ($tables as $tableName) {
         if (preg_match('/archive_/', $tableName) == 1) {
             $sqlarray['DROP INDEX index_all ON ' . $tableName] = '1091';
         }
         if (preg_match('/archive_numeric_/', $tableName) == 1) {
             $sqlarray['CREATE INDEX index_idsite_dates_period ON ' . $tableName . ' (idsite, date1, date2, period)'] = '1061';
         }
     }
     return $sqlarray;
 }
Exemplo n.º 28
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',
		));
	}
Exemplo n.º 29
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);
			}
		}
	}
Exemplo n.º 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);
	}