static function update() { if(Piwik::isTimezoneSupportEnabled()) { Piwik_Updater::updateDatabase(__FILE__, self::getSql()); } }
static function update() { Piwik_Updater::updateDatabase(__FILE__, array( 'ALTER TABLE `'. Piwik::prefixTable('user_dashboard') .'` CHANGE `layout` `layout` TEXT NOT NULL' => false, )); }
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()); }
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>"); } }
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); }
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()); }
static function update() { try { Piwik_Updater::updateDatabase(__FILE__, self::getSql()); } catch (Exception $e) { } }
static function update() { Piwik_Updater::updateDatabase(__FILE__, self::getSql()); try { Piwik_PluginsManager::getInstance()->activatePlugin('Transitions'); } catch (Exception $e) { } }
static function update() { Piwik_Updater::updateDatabase(__FILE__, array( 'DELETE FROM `'. Piwik::prefixTable('user_dashboard') ."` WHERE layout LIKE '%.getLastVisitsGraph%' OR layout LIKE '%.getLastVisitsReturningGraph%'" => false, )); }
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)); }
static function update() { $tables = Piwik::getTablesCreateSql(); Piwik_Updater::updateDatabase(__FILE__, array( 'DROP TABLE IF EXISTS `'. Piwik::prefixTable('option') .'`' => false, $tables['option'] => false, )); }
static function update() { // manually remove ExampleFeedburner column Piwik_Updater::updateDatabase(__FILE__, self::getSql()); // remove ExampleFeedburner plugin $pluginToDelete = 'ExampleFeedburner'; self::deletePluginFromConfigFile($pluginToDelete); }
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)); }
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, )); }
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); }
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); } } }
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, )); }
static function update() { try { self::enableMaintenanceMode(); Piwik_Updater::updateDatabase(__FILE__, self::getSql()); self::disableMaintenanceMode(); } catch (Exception $e) { self::disableMaintenanceMode(); throw $e; } }
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, )); }
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', )); }
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); } } }
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', )); }
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', )); }
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) { } }
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); } } }
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()); }
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); }
static function update() { Piwik_Updater::updateDatabase(__FILE__, self::getSql()); if (!Piwik_PluginsManager::getInstance()->isPluginLoaded('PDFReports')) { return; } try { // Piwik_Common::prefixTable('pdf') has been heavily refactored to be more generic // The following actions are taken in this update script : // - create the new generic report table Piwik_Common::prefixTable('report') // - migrate previous reports, if any, from Piwik_Common::prefixTable('pdf') to Piwik_Common::prefixTable('report') // - delete Piwik_Common::prefixTable('pdf') $reports = Piwik_FetchAll('SELECT * FROM `' . Piwik_Common::prefixTable('pdf') . '`'); foreach ($reports as $report) { $idreport = $report['idreport']; $idsite = $report['idsite']; $login = $report['login']; $description = $report['description']; $period = $report['period']; $format = $report['format']; $display_format = $report['display_format']; $email_me = $report['email_me']; $additional_emails = $report['additional_emails']; $reports = $report['reports']; $ts_created = $report['ts_created']; $ts_last_sent = $report['ts_last_sent']; $deleted = $report['deleted']; $parameters = array(); if (!is_null($additional_emails)) { $parameters[Piwik_PDFReports::ADDITIONAL_EMAILS_PARAMETER] = preg_split('/,/', $additional_emails); } $parameters[Piwik_PDFReports::EMAIL_ME_PARAMETER] = is_null($email_me) ? Piwik_PDFReports::EMAIL_ME_PARAMETER_DEFAULT_VALUE : (bool) $email_me; $parameters[Piwik_PDFReports::DISPLAY_FORMAT_PARAMETER] = $display_format; Piwik_Query('INSERT INTO `' . Piwik_Common::prefixTable('report') . '` SET idreport = ?, idsite = ?, login = ?, description = ?, period = ?, type = ?, format = ?, reports = ?, parameters = ?, ts_created = ?, ts_last_sent = ?, deleted = ?', array($idreport, $idsite, $login, $description, is_null($period) ? Piwik_PDFReports::DEFAULT_PERIOD : $period, Piwik_PDFReports::EMAIL_TYPE, is_null($format) ? Piwik_PDFReports::DEFAULT_REPORT_FORMAT : $format, Piwik_Common::json_encode(preg_split('/,/', $reports)), Piwik_Common::json_encode($parameters), $ts_created, $ts_last_sent, $deleted)); } Piwik_Query('DROP TABLE `' . Piwik_Common::prefixTable('pdf') . '`'); } catch (Exception $e) { } }
static function update() { Piwik_Updater::updateDatabase(__FILE__, array('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', 'DROP INDEX index_idaction ON `' . Piwik::prefixTable('log_action') . '`' => '1091', 'ALTER IGNORE TABLE `' . Piwik::prefixTable('log_visit') . '` CHANGE `visit_goal_converted` `visit_goal_converted` TINYINT(1) NOT NULL' => false, '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', '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 `' . 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)); }
static function update() { Piwik_Updater::updateDatabase(__FILE__, self::getSql()); }