add piwik installation
This commit is contained in:
parent
90aa4ef157
commit
8c5d4f0c31
3197 changed files with 563902 additions and 0 deletions
73
www/analytics/core/Updates/0.2.10.php
Normal file
73
www/analytics/core/Updates/0.2.10.php
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - Open source web analytics
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Piwik\Updates;
|
||||
|
||||
use Piwik\Common;
|
||||
use Piwik\Filesystem;
|
||||
use Piwik\Updater;
|
||||
use Piwik\Updates;
|
||||
|
||||
/**
|
||||
*/
|
||||
class Updates_0_2_10 extends Updates
|
||||
{
|
||||
static function getSql()
|
||||
{
|
||||
return array(
|
||||
'CREATE TABLE `' . Common::prefixTable('option') . '` (
|
||||
idoption BIGINT NOT NULL AUTO_INCREMENT ,
|
||||
option_name VARCHAR( 64 ) NOT NULL ,
|
||||
option_value LONGTEXT NOT NULL ,
|
||||
PRIMARY KEY ( idoption , option_name )
|
||||
)' => false,
|
||||
|
||||
// 0.1.7 [463]
|
||||
'ALTER IGNORE TABLE `' . Common::prefixTable('log_visit') . '`
|
||||
CHANGE `location_provider` `location_provider` VARCHAR( 100 ) DEFAULT NULL' => '1054',
|
||||
|
||||
// 0.1.7 [470]
|
||||
'ALTER TABLE `' . Common::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 `' . Common::prefixTable('logger_error') . '`
|
||||
CHANGE `message` `message` TEXT' => false,
|
||||
'ALTER TABLE `' . Common::prefixTable('logger_exception') . '`
|
||||
CHANGE `message` `message` TEXT' => false,
|
||||
'ALTER TABLE `' . Common::prefixTable('logger_message') . '`
|
||||
CHANGE `message` `message` TEXT' => false,
|
||||
|
||||
// 0.2.2 [489]
|
||||
'ALTER IGNORE TABLE `' . Common::prefixTable('site') . '`
|
||||
CHANGE `feedburnerName` `feedburnerName` VARCHAR( 100 ) DEFAULT NULL' => '1054',
|
||||
);
|
||||
}
|
||||
|
||||
static function update()
|
||||
{
|
||||
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)) {
|
||||
Filesystem::unlinkRecursive(PIWIK_INCLUDE_PATH . $dir, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
38
www/analytics/core/Updates/0.2.12.php
Normal file
38
www/analytics/core/Updates/0.2.12.php
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - Open source web analytics
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Piwik\Updates;
|
||||
|
||||
use Piwik\Common;
|
||||
use Piwik\Updater;
|
||||
use Piwik\Updates;
|
||||
|
||||
/**
|
||||
*/
|
||||
class Updates_0_2_12 extends Updates
|
||||
{
|
||||
static function getSql()
|
||||
{
|
||||
return array(
|
||||
'ALTER TABLE `' . Common::prefixTable('site') . '`
|
||||
CHANGE `ts_created` `ts_created` TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL' => false,
|
||||
'ALTER TABLE `' . Common::prefixTable('log_visit') . '`
|
||||
DROP `config_color_depth`' => false,
|
||||
|
||||
// 0.2.12 [673]
|
||||
// Note: requires INDEX privilege
|
||||
'DROP INDEX index_idaction ON `' . Common::prefixTable('log_action') . '`' => '1091',
|
||||
);
|
||||
}
|
||||
|
||||
static function update()
|
||||
{
|
||||
Updater::updateDatabase(__FILE__, self::getSql());
|
||||
}
|
||||
}
|
||||
38
www/analytics/core/Updates/0.2.13.php
Normal file
38
www/analytics/core/Updates/0.2.13.php
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - Open source web analytics
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Piwik\Updates;
|
||||
|
||||
use Piwik\Common;
|
||||
use Piwik\Updater;
|
||||
use Piwik\Updates;
|
||||
|
||||
/**
|
||||
*/
|
||||
class Updates_0_2_13 extends Updates
|
||||
{
|
||||
static function getSql()
|
||||
{
|
||||
return array(
|
||||
'DROP TABLE IF EXISTS `' . Common::prefixTable('option') . '`' => false,
|
||||
|
||||
'CREATE TABLE `' . Common::prefixTable('option') . "` (
|
||||
option_name VARCHAR( 64 ) NOT NULL ,
|
||||
option_value LONGTEXT NOT NULL ,
|
||||
autoload TINYINT NOT NULL DEFAULT '1',
|
||||
PRIMARY KEY ( option_name )
|
||||
)" => false,
|
||||
);
|
||||
}
|
||||
|
||||
static function update()
|
||||
{
|
||||
Updater::updateDatabase(__FILE__, self::getSql());
|
||||
}
|
||||
}
|
||||
36
www/analytics/core/Updates/0.2.24.php
Normal file
36
www/analytics/core/Updates/0.2.24.php
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - Open source web analytics
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Piwik\Updates;
|
||||
|
||||
use Piwik\Common;
|
||||
use Piwik\Updater;
|
||||
use Piwik\Updates;
|
||||
|
||||
/**
|
||||
*/
|
||||
class Updates_0_2_24 extends Updates
|
||||
{
|
||||
static function getSql()
|
||||
{
|
||||
return array(
|
||||
'CREATE INDEX index_type_name
|
||||
ON ' . Common::prefixTable('log_action') . ' (type, name(15))' => false,
|
||||
'CREATE INDEX index_idsite_date
|
||||
ON ' . Common::prefixTable('log_visit') . ' (idsite, visit_server_date)' => false,
|
||||
'DROP INDEX index_idsite ON ' . Common::prefixTable('log_visit') => false,
|
||||
'DROP INDEX index_visit_server_date ON ' . Common::prefixTable('log_visit') => false,
|
||||
);
|
||||
}
|
||||
|
||||
static function update()
|
||||
{
|
||||
Updater::updateDatabase(__FILE__, self::getSql());
|
||||
}
|
||||
}
|
||||
81
www/analytics/core/Updates/0.2.27.php
Normal file
81
www/analytics/core/Updates/0.2.27.php
Normal file
|
|
@ -0,0 +1,81 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - Open source web analytics
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Piwik\Updates;
|
||||
|
||||
use Piwik\Common;
|
||||
use Piwik\DbHelper;
|
||||
use Piwik\Updater;
|
||||
use Piwik\Updates;
|
||||
|
||||
/**
|
||||
*/
|
||||
class Updates_0_2_27 extends Updates
|
||||
{
|
||||
static function getSql()
|
||||
{
|
||||
$sqlarray = array(
|
||||
'ALTER TABLE `' . Common::prefixTable('log_visit') . '`
|
||||
ADD `visit_goal_converted` VARCHAR( 1 ) NOT NULL AFTER `visit_total_time`' => false,
|
||||
// 0.2.27 [826]
|
||||
'ALTER IGNORE TABLE `' . Common::prefixTable('log_visit') . '`
|
||||
CHANGE `visit_goal_converted` `visit_goal_converted` TINYINT(1) NOT NULL' => false,
|
||||
|
||||
'CREATE TABLE `' . Common::prefixTable('goal') . "` (
|
||||
`idsite` int(11) NOT NULL,
|
||||
`idgoal` int(11) NOT NULL,
|
||||
`name` varchar(50) NOT NULL,
|
||||
`match_attribute` varchar(20) NOT NULL,
|
||||
`pattern` varchar(255) NOT NULL,
|
||||
`pattern_type` varchar(10) NOT NULL,
|
||||
`case_sensitive` tinyint(4) NOT NULL,
|
||||
`revenue` float NOT NULL,
|
||||
`deleted` tinyint(4) NOT NULL default '0',
|
||||
PRIMARY KEY (`idsite`,`idgoal`)
|
||||
)" => false,
|
||||
|
||||
'CREATE TABLE `' . Common::prefixTable('log_conversion') . '` (
|
||||
`idvisit` int(10) unsigned NOT NULL,
|
||||
`idsite` int(10) unsigned NOT NULL,
|
||||
`visitor_idcookie` char(32) NOT NULL,
|
||||
`server_time` datetime NOT NULL,
|
||||
`visit_server_date` date NOT NULL,
|
||||
`idaction` int(11) NOT NULL,
|
||||
`idlink_va` int(11) NOT NULL,
|
||||
`referer_idvisit` int(10) unsigned default NULL,
|
||||
`referer_visit_server_date` date default NULL,
|
||||
`referer_type` int(10) unsigned default NULL,
|
||||
`referer_name` varchar(70) default NULL,
|
||||
`referer_keyword` varchar(255) default NULL,
|
||||
`visitor_returning` tinyint(1) NOT NULL,
|
||||
`location_country` char(3) NOT NULL,
|
||||
`location_continent` char(3) NOT NULL,
|
||||
`url` text NOT NULL,
|
||||
`idgoal` int(10) unsigned NOT NULL,
|
||||
`revenue` float default NULL,
|
||||
PRIMARY KEY (`idvisit`,`idgoal`),
|
||||
KEY `index_idsite_date` (`idsite`,`visit_server_date`)
|
||||
)' => false,
|
||||
);
|
||||
|
||||
$tables = DbHelper::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;
|
||||
}
|
||||
}
|
||||
|
||||
return $sqlarray;
|
||||
}
|
||||
|
||||
static function update()
|
||||
{
|
||||
Updater::updateDatabase(__FILE__, self::getSql());
|
||||
}
|
||||
}
|
||||
39
www/analytics/core/Updates/0.2.32.php
Normal file
39
www/analytics/core/Updates/0.2.32.php
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - Open source web analytics
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Piwik\Updates;
|
||||
|
||||
use Piwik\Common;
|
||||
use Piwik\Updater;
|
||||
use Piwik\Updates;
|
||||
|
||||
/**
|
||||
*/
|
||||
class Updates_0_2_32 extends Updates
|
||||
{
|
||||
static function getSql()
|
||||
{
|
||||
return array(
|
||||
// 0.2.32 [941]
|
||||
'ALTER TABLE `' . Common::prefixTable('access') . '`
|
||||
CHANGE `login` `login` VARCHAR( 100 ) NOT NULL' => false,
|
||||
'ALTER TABLE `' . Common::prefixTable('user') . '`
|
||||
CHANGE `login` `login` VARCHAR( 100 ) NOT NULL' => false,
|
||||
'ALTER TABLE `' . Common::prefixTable('user_dashboard') . '`
|
||||
CHANGE `login` `login` VARCHAR( 100 ) NOT NULL' => '1146',
|
||||
'ALTER TABLE `' . Common::prefixTable('user_language') . '`
|
||||
CHANGE `login` `login` VARCHAR( 100 ) NOT NULL' => '1146',
|
||||
);
|
||||
}
|
||||
|
||||
static function update()
|
||||
{
|
||||
Updater::updateDatabase(__FILE__, self::getSql());
|
||||
}
|
||||
}
|
||||
45
www/analytics/core/Updates/0.2.33.php
Normal file
45
www/analytics/core/Updates/0.2.33.php
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - Open source web analytics
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Piwik\Updates;
|
||||
|
||||
use Piwik\Common;
|
||||
use Piwik\DbHelper;
|
||||
use Piwik\Updater;
|
||||
use Piwik\Updates;
|
||||
|
||||
/**
|
||||
*/
|
||||
class Updates_0_2_33 extends Updates
|
||||
{
|
||||
static function getSql()
|
||||
{
|
||||
$sqlarray = array(
|
||||
// 0.2.33 [1020]
|
||||
'ALTER TABLE `' . Common::prefixTable('user_dashboard') . '`
|
||||
CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci ' => '1146',
|
||||
'ALTER TABLE `' . Common::prefixTable('user_language') . '`
|
||||
CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci ' => '1146',
|
||||
);
|
||||
|
||||
// alter table to set the utf8 collation
|
||||
$tablesToAlter = DbHelper::getTablesInstalled(true);
|
||||
foreach ($tablesToAlter as $table) {
|
||||
$sqlarray['ALTER TABLE `' . $table . '`
|
||||
CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci '] = false;
|
||||
}
|
||||
|
||||
return $sqlarray;
|
||||
}
|
||||
|
||||
static function update()
|
||||
{
|
||||
Updater::updateDatabase(__FILE__, self::getSql());
|
||||
}
|
||||
}
|
||||
28
www/analytics/core/Updates/0.2.34.php
Normal file
28
www/analytics/core/Updates/0.2.34.php
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - Open source web analytics
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Piwik\Updates;
|
||||
|
||||
use Piwik\Piwik;
|
||||
use Piwik\Plugins\SitesManager\API;
|
||||
use Piwik\Tracker\Cache;
|
||||
use Piwik\Updates;
|
||||
|
||||
/**
|
||||
*/
|
||||
class Updates_0_2_34 extends Updates
|
||||
{
|
||||
static function update()
|
||||
{
|
||||
// force regeneration of cache files following #648
|
||||
Piwik::setUserHasSuperUserAccess();
|
||||
$allSiteIds = API::getInstance()->getAllSitesId();
|
||||
Cache::regenerateCacheWebsiteAttributes($allSiteIds);
|
||||
}
|
||||
}
|
||||
32
www/analytics/core/Updates/0.2.35.php
Normal file
32
www/analytics/core/Updates/0.2.35.php
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - Open source web analytics
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Piwik\Updates;
|
||||
|
||||
use Piwik\Common;
|
||||
use Piwik\Updater;
|
||||
use Piwik\Updates;
|
||||
|
||||
/**
|
||||
*/
|
||||
class Updates_0_2_35 extends Updates
|
||||
{
|
||||
static function getSql()
|
||||
{
|
||||
return array(
|
||||
'ALTER TABLE `' . Common::prefixTable('user_dashboard') . '`
|
||||
CHANGE `layout` `layout` TEXT NOT NULL' => false,
|
||||
);
|
||||
}
|
||||
|
||||
static function update()
|
||||
{
|
||||
Updater::updateDatabase(__FILE__, self::getSql());
|
||||
}
|
||||
}
|
||||
33
www/analytics/core/Updates/0.2.37.php
Normal file
33
www/analytics/core/Updates/0.2.37.php
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - Open source web analytics
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Piwik\Updates;
|
||||
|
||||
use Piwik\Common;
|
||||
use Piwik\Updater;
|
||||
use Piwik\Updates;
|
||||
|
||||
/**
|
||||
*/
|
||||
class Updates_0_2_37 extends Updates
|
||||
{
|
||||
static function getSql()
|
||||
{
|
||||
return array(
|
||||
'DELETE FROM `' . Common::prefixTable('user_dashboard') . "`
|
||||
WHERE layout LIKE '%.getLastVisitsGraph%'
|
||||
OR layout LIKE '%.getLastVisitsReturningGraph%'" => false,
|
||||
);
|
||||
}
|
||||
|
||||
static function update()
|
||||
{
|
||||
Updater::updateDatabase(__FILE__, self::getSql());
|
||||
}
|
||||
}
|
||||
34
www/analytics/core/Updates/0.4.1.php
Normal file
34
www/analytics/core/Updates/0.4.1.php
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - Open source web analytics
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Piwik\Updates;
|
||||
|
||||
use Piwik\Common;
|
||||
use Piwik\Updater;
|
||||
use Piwik\Updates;
|
||||
|
||||
/**
|
||||
*/
|
||||
class Updates_0_4_1 extends Updates
|
||||
{
|
||||
static function getSql()
|
||||
{
|
||||
return array(
|
||||
'ALTER TABLE `' . Common::prefixTable('log_conversion') . '`
|
||||
CHANGE `idlink_va` `idlink_va` INT(11) DEFAULT NULL' => false,
|
||||
'ALTER TABLE `' . Common::prefixTable('log_conversion') . '`
|
||||
CHANGE `idaction` `idaction` INT(11) DEFAULT NULL' => '1054',
|
||||
);
|
||||
}
|
||||
|
||||
static function update()
|
||||
{
|
||||
Updater::updateDatabase(__FILE__, self::getSql());
|
||||
}
|
||||
}
|
||||
38
www/analytics/core/Updates/0.4.2.php
Normal file
38
www/analytics/core/Updates/0.4.2.php
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - Open source web analytics
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Piwik\Updates;
|
||||
|
||||
use Piwik\Common;
|
||||
use Piwik\Updater;
|
||||
use Piwik\Updates;
|
||||
|
||||
/**
|
||||
*/
|
||||
class Updates_0_4_2 extends Updates
|
||||
{
|
||||
static function getSql()
|
||||
{
|
||||
return array(
|
||||
'ALTER TABLE `' . Common::prefixTable('log_visit') . '`
|
||||
ADD `config_java` TINYINT(1) NOT NULL AFTER `config_flash`' => '1060',
|
||||
'ALTER TABLE `' . Common::prefixTable('log_visit') . '`
|
||||
ADD `config_quicktime` TINYINT(1) NOT NULL AFTER `config_director`' => '1060',
|
||||
'ALTER TABLE `' . Common::prefixTable('log_visit') . '`
|
||||
ADD `config_gears` TINYINT(1) NOT NULL AFTER `config_windowsmedia`,
|
||||
ADD `config_silverlight` TINYINT(1) NOT NULL AFTER `config_gears`' => false,
|
||||
);
|
||||
}
|
||||
|
||||
// when restoring (possibly) previousy dropped columns, ignore mysql code error 1060: duplicate column
|
||||
static function update()
|
||||
{
|
||||
Updater::updateDatabase(__FILE__, self::getSql());
|
||||
}
|
||||
}
|
||||
29
www/analytics/core/Updates/0.4.4.php
Normal file
29
www/analytics/core/Updates/0.4.4.php
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - Open source web analytics
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Piwik\Updates;
|
||||
|
||||
use Piwik\Piwik;
|
||||
use Piwik\Updates;
|
||||
|
||||
/**
|
||||
*/
|
||||
class Updates_0_4_4 extends Updates
|
||||
{
|
||||
static function update()
|
||||
{
|
||||
$obsoleteFile = PIWIK_DOCUMENT_ROOT . '/libs/open-flash-chart/php-ofc-library/ofc_upload_image.php';
|
||||
if (file_exists($obsoleteFile)) {
|
||||
$rc = @unlink($obsoleteFile);
|
||||
if (!$rc) {
|
||||
throw new \Exception(Piwik::translate('General_ExceptionUndeletableFile', array($obsoleteFile)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
39
www/analytics/core/Updates/0.4.php
Normal file
39
www/analytics/core/Updates/0.4.php
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - Open source web analytics
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Piwik\Updates;
|
||||
|
||||
use Piwik\Common;
|
||||
use Piwik\Updater;
|
||||
use Piwik\Updates;
|
||||
|
||||
/**
|
||||
*/
|
||||
class Updates_0_4 extends Updates
|
||||
{
|
||||
static function getSql()
|
||||
{
|
||||
return array(
|
||||
// 0.4 [1140]
|
||||
'UPDATE `' . Common::prefixTable('log_visit') . '`
|
||||
SET location_ip=location_ip+CAST(POW(2,32) AS UNSIGNED) WHERE location_ip < 0' => false,
|
||||
'ALTER TABLE `' . Common::prefixTable('log_visit') . '`
|
||||
CHANGE `location_ip` `location_ip` BIGINT UNSIGNED NOT NULL' => false,
|
||||
'UPDATE `' . Common::prefixTable('logger_api_call') . '`
|
||||
SET caller_ip=caller_ip+CAST(POW(2,32) AS UNSIGNED) WHERE caller_ip < 0' => false,
|
||||
'ALTER TABLE `' . Common::prefixTable('logger_api_call') . '`
|
||||
CHANGE `caller_ip` `caller_ip` BIGINT UNSIGNED' => false,
|
||||
);
|
||||
}
|
||||
|
||||
static function update()
|
||||
{
|
||||
Updater::updateDatabase(__FILE__, self::getSql());
|
||||
}
|
||||
}
|
||||
65
www/analytics/core/Updates/0.5.4.php
Normal file
65
www/analytics/core/Updates/0.5.4.php
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - Open source web analytics
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Piwik\Updates;
|
||||
|
||||
use Piwik\Common;
|
||||
use Piwik\Config;
|
||||
use Piwik\Updater;
|
||||
use Piwik\Updates;
|
||||
|
||||
/**
|
||||
*/
|
||||
class Updates_0_5_4 extends Updates
|
||||
{
|
||||
static function getSql()
|
||||
{
|
||||
return array(
|
||||
'ALTER TABLE `' . Common::prefixTable('log_action') . '`
|
||||
CHANGE `name` `name` TEXT' => false,
|
||||
);
|
||||
}
|
||||
|
||||
static function update()
|
||||
{
|
||||
$salt = Common::generateUniqId();
|
||||
$config = Config::getInstance();
|
||||
$superuser = $config->superuser;
|
||||
if (!isset($superuser['salt'])) {
|
||||
try {
|
||||
if (is_writable(Config::getLocalConfigPath())) {
|
||||
$superuser['salt'] = $salt;
|
||||
$config->superuser = $superuser;
|
||||
$config->forceSave();
|
||||
} else {
|
||||
throw new \Exception('mandatory update failed');
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
throw new \Piwik\UpdaterErrorException("Please edit your config/config.ini.php file and add below <code>[superuser]</code> the following line: <br /><code>salt = $salt</code>");
|
||||
}
|
||||
}
|
||||
|
||||
$plugins = $config->Plugins;
|
||||
if (!in_array('MultiSites', $plugins)) {
|
||||
try {
|
||||
if (is_writable(Config::getLocalConfigPath())) {
|
||||
$plugins[] = 'MultiSites';
|
||||
$config->Plugins = $plugins;
|
||||
$config->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!");
|
||||
}
|
||||
}
|
||||
|
||||
Updater::updateDatabase(__FILE__, self::getSql());
|
||||
}
|
||||
}
|
||||
46
www/analytics/core/Updates/0.5.5.php
Normal file
46
www/analytics/core/Updates/0.5.5.php
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - Open source web analytics
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Piwik\Updates;
|
||||
|
||||
use Piwik\Common;
|
||||
use Piwik\DbHelper;
|
||||
use Piwik\Updater;
|
||||
use Piwik\Updates;
|
||||
|
||||
/**
|
||||
*/
|
||||
class Updates_0_5_5 extends Updates
|
||||
{
|
||||
static function getSql()
|
||||
{
|
||||
$sqlarray = array(
|
||||
'DROP INDEX index_idsite_date ON ' . Common::prefixTable('log_visit') => '1091',
|
||||
'CREATE INDEX index_idsite_date_config ON ' . Common::prefixTable('log_visit') . ' (idsite, visit_server_date, config_md5config(8))' => '1061',
|
||||
);
|
||||
|
||||
$tables = DbHelper::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;
|
||||
}
|
||||
|
||||
static function update()
|
||||
{
|
||||
Updater::updateDatabase(__FILE__, self::getSql());
|
||||
|
||||
}
|
||||
}
|
||||
40
www/analytics/core/Updates/0.5.php
Normal file
40
www/analytics/core/Updates/0.5.php
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - Open source web analytics
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Piwik\Updates;
|
||||
|
||||
use Piwik\Common;
|
||||
use Piwik\Updater;
|
||||
use Piwik\Updates;
|
||||
|
||||
/**
|
||||
*/
|
||||
class Updates_0_5 extends Updates
|
||||
{
|
||||
static function getSql()
|
||||
{
|
||||
return array(
|
||||
'ALTER TABLE ' . Common::prefixTable('log_action') . ' ADD COLUMN `hash` INTEGER(10) UNSIGNED NOT NULL AFTER `name`;' => '1060',
|
||||
'ALTER TABLE ' . Common::prefixTable('log_visit') . ' CHANGE visit_exit_idaction visit_exit_idaction_url INTEGER(11) NOT NULL;' => '1054',
|
||||
'ALTER TABLE ' . Common::prefixTable('log_visit') . ' CHANGE visit_entry_idaction visit_entry_idaction_url INTEGER(11) NOT NULL;' => '1054',
|
||||
'ALTER TABLE ' . Common::prefixTable('log_link_visit_action') . ' CHANGE `idaction_ref` `idaction_url_ref` INTEGER(10) UNSIGNED NOT NULL;' => '1054',
|
||||
'ALTER TABLE ' . Common::prefixTable('log_link_visit_action') . ' CHANGE `idaction` `idaction_url` INTEGER(10) UNSIGNED NOT NULL;' => '1054',
|
||||
'ALTER TABLE ' . Common::prefixTable('log_link_visit_action') . ' ADD COLUMN `idaction_name` INTEGER(10) UNSIGNED AFTER `idaction_url_ref`;' => '1060',
|
||||
'ALTER TABLE ' . Common::prefixTable('log_conversion') . ' CHANGE `idaction` `idaction_url` INTEGER(11) UNSIGNED NOT NULL;' => '1054',
|
||||
'UPDATE ' . Common::prefixTable('log_action') . ' SET `hash` = CRC32(name);' => false,
|
||||
'CREATE INDEX index_type_hash ON ' . Common::prefixTable('log_action') . ' (type, hash);' => '1061',
|
||||
'DROP INDEX index_type_name ON ' . Common::prefixTable('log_action') . ';' => '1091',
|
||||
);
|
||||
}
|
||||
|
||||
static function update()
|
||||
{
|
||||
Updater::updateDatabase(__FILE__, self::getSql());
|
||||
}
|
||||
}
|
||||
67
www/analytics/core/Updates/0.6-rc1.php
Normal file
67
www/analytics/core/Updates/0.6-rc1.php
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - Open source web analytics
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Piwik\Updates;
|
||||
|
||||
use Piwik\Common;
|
||||
use Piwik\Updater;
|
||||
use Piwik\Updates;
|
||||
|
||||
/**
|
||||
*/
|
||||
class Updates_0_6_rc1 extends Updates
|
||||
{
|
||||
static function getSql()
|
||||
{
|
||||
$defaultTimezone = 'UTC';
|
||||
$defaultCurrency = 'USD';
|
||||
return array(
|
||||
'ALTER TABLE ' . Common::prefixTable('user') . ' CHANGE date_registered date_registered TIMESTAMP NULL' => false,
|
||||
'ALTER TABLE ' . Common::prefixTable('site') . ' CHANGE ts_created ts_created TIMESTAMP NULL' => false,
|
||||
'ALTER TABLE ' . Common::prefixTable('site') . ' ADD `timezone` VARCHAR( 50 ) NOT NULL AFTER `ts_created` ;' => false,
|
||||
'UPDATE ' . Common::prefixTable('site') . ' SET `timezone` = "' . $defaultTimezone . '";' => false,
|
||||
'ALTER TABLE ' . Common::prefixTable('site') . ' ADD currency CHAR( 3 ) NOT NULL AFTER `timezone` ;' => false,
|
||||
'UPDATE ' . Common::prefixTable('site') . ' SET `currency` = "' . $defaultCurrency . '";' => false,
|
||||
'ALTER TABLE ' . Common::prefixTable('site') . ' ADD `excluded_ips` TEXT NOT NULL AFTER `currency` ;' => false,
|
||||
'ALTER TABLE ' . Common::prefixTable('site') . ' ADD excluded_parameters VARCHAR( 255 ) NOT NULL AFTER `excluded_ips` ;' => false,
|
||||
'ALTER TABLE ' . Common::prefixTable('log_visit') . ' ADD INDEX `index_idsite_datetime_config` ( `idsite` , `visit_last_action_time` , `config_md5config` ( 8 ) ) ;' => false,
|
||||
'ALTER TABLE ' . Common::prefixTable('log_visit') . ' ADD INDEX index_idsite_idvisit (idsite, idvisit) ;' => false,
|
||||
'ALTER TABLE ' . Common::prefixTable('log_conversion') . ' DROP INDEX index_idsite_date' => false,
|
||||
'ALTER TABLE ' . Common::prefixTable('log_conversion') . ' DROP visit_server_date;' => false,
|
||||
'ALTER TABLE ' . Common::prefixTable('log_conversion') . ' ADD INDEX index_idsite_datetime ( `idsite` , `server_time` )' => false,
|
||||
);
|
||||
}
|
||||
|
||||
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\Plugin\Manager::getInstance()->isPluginActivated($pluginToDisable)) {
|
||||
\Piwik\Plugin\Manager::getInstance()->deactivatePlugin($pluginToDisable);
|
||||
$disabledPlugins[] = $warningMessage;
|
||||
}
|
||||
}
|
||||
|
||||
// Run the SQL
|
||||
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>");
|
||||
}
|
||||
}
|
||||
}
|
||||
47
www/analytics/core/Updates/0.6.2.php
Normal file
47
www/analytics/core/Updates/0.6.2.php
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - Open source web analytics
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Piwik\Updates;
|
||||
|
||||
use Piwik\Filesystem;
|
||||
use Piwik\Piwik;
|
||||
use Piwik\Plugins\SitesManager\API;
|
||||
use Piwik\Tracker\Cache;
|
||||
use Piwik\Updates;
|
||||
|
||||
/**
|
||||
*/
|
||||
class Updates_0_6_2 extends Updates
|
||||
{
|
||||
static function update()
|
||||
{
|
||||
$obsoleteFiles = array(
|
||||
PIWIK_INCLUDE_PATH . '/core/Db/Mysqli.php',
|
||||
);
|
||||
foreach ($obsoleteFiles as $obsoleteFile) {
|
||||
if (file_exists($obsoleteFile)) {
|
||||
@unlink($obsoleteFile);
|
||||
}
|
||||
}
|
||||
|
||||
$obsoleteDirectories = array(
|
||||
PIWIK_INCLUDE_PATH . '/core/Db/Pdo',
|
||||
);
|
||||
foreach ($obsoleteDirectories as $dir) {
|
||||
if (file_exists($dir)) {
|
||||
Filesystem::unlinkRecursive($dir, true);
|
||||
}
|
||||
}
|
||||
|
||||
// force regeneration of cache files
|
||||
Piwik::setUserHasSuperUserAccess();
|
||||
$allSiteIds = API::getInstance()->getAllSitesId();
|
||||
Cache::regenerateCacheWebsiteAttributes($allSiteIds);
|
||||
}
|
||||
}
|
||||
49
www/analytics/core/Updates/0.6.3.php
Normal file
49
www/analytics/core/Updates/0.6.3.php
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - Open source web analytics
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Piwik\Updates;
|
||||
|
||||
use Piwik\Common;
|
||||
use Piwik\Config;
|
||||
use Piwik\Updater;
|
||||
use Piwik\Updates;
|
||||
|
||||
/**
|
||||
*/
|
||||
class Updates_0_6_3 extends Updates
|
||||
{
|
||||
static function getSql()
|
||||
{
|
||||
return array(
|
||||
'ALTER TABLE `' . Common::prefixTable('log_visit') . '`
|
||||
CHANGE `location_ip` `location_ip` INT UNSIGNED NOT NULL' => false,
|
||||
'ALTER TABLE `' . Common::prefixTable('logger_api_call') . '`
|
||||
CHANGE `caller_ip` `caller_ip` INT UNSIGNED' => false,
|
||||
);
|
||||
}
|
||||
|
||||
static function update()
|
||||
{
|
||||
$config = Config::getInstance();
|
||||
$dbInfos = $config->database;
|
||||
if (!isset($dbInfos['schema'])) {
|
||||
try {
|
||||
if (is_writable(Config::getLocalConfigPath())) {
|
||||
$config->database = $dbInfos;
|
||||
$config->forceSave();
|
||||
} else {
|
||||
throw new \Exception('mandatory update failed');
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
}
|
||||
}
|
||||
|
||||
Updater::updateDatabase(__FILE__, self::getSql());
|
||||
}
|
||||
}
|
||||
32
www/analytics/core/Updates/0.7.php
Normal file
32
www/analytics/core/Updates/0.7.php
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - Open source web analytics
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Piwik\Updates;
|
||||
|
||||
use Piwik\Common;
|
||||
use Piwik\Updater;
|
||||
use Piwik\Updates;
|
||||
|
||||
/**
|
||||
*/
|
||||
class Updates_0_7 extends Updates
|
||||
{
|
||||
static function getSql()
|
||||
{
|
||||
return array(
|
||||
'ALTER TABLE `' . Common::prefixTable('option') . '`
|
||||
CHANGE `option_name` `option_name` VARCHAR(255) NOT NULL' => false,
|
||||
);
|
||||
}
|
||||
|
||||
static function update()
|
||||
{
|
||||
Updater::updateDatabase(__FILE__, self::getSql());
|
||||
}
|
||||
}
|
||||
57
www/analytics/core/Updates/0.9.1.php
Normal file
57
www/analytics/core/Updates/0.9.1.php
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - Open source web analytics
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Piwik\Updates;
|
||||
|
||||
use Piwik\Common;
|
||||
use Piwik\SettingsServer;
|
||||
use Piwik\Updater;
|
||||
use Piwik\Updates;
|
||||
|
||||
/**
|
||||
*/
|
||||
class Updates_0_9_1 extends Updates
|
||||
{
|
||||
static function getSql()
|
||||
{
|
||||
if (!SettingsServer::isTimezoneSupportEnabled()) {
|
||||
return array();
|
||||
}
|
||||
// @see http://bugs.php.net/46111
|
||||
$timezones = timezone_identifiers_list();
|
||||
$brokenTZ = array();
|
||||
|
||||
foreach ($timezones as $timezone) {
|
||||
$testDate = "2008-08-19 13:00:00 " . $timezone;
|
||||
|
||||
if (!strtotime($testDate)) {
|
||||
$brokenTZ[] = $timezone;
|
||||
}
|
||||
}
|
||||
$timezoneList = '"' . implode('","', $brokenTZ) . '"';
|
||||
|
||||
return array(
|
||||
'UPDATE ' . Common::prefixTable('site') . '
|
||||
SET timezone = "UTC"
|
||||
WHERE timezone IN (' . $timezoneList . ')' => false,
|
||||
|
||||
'UPDATE `' . Common::prefixTable('option') . '`
|
||||
SET option_value = "UTC"
|
||||
WHERE option_name = "SitesManager_DefaultTimezone"
|
||||
AND option_value IN (' . $timezoneList . ')' => false,
|
||||
);
|
||||
}
|
||||
|
||||
static function update()
|
||||
{
|
||||
if (SettingsServer::isTimezoneSupportEnabled()) {
|
||||
Updater::updateDatabase(__FILE__, self::getSql());
|
||||
}
|
||||
}
|
||||
}
|
||||
44
www/analytics/core/Updates/1.1.php
Normal file
44
www/analytics/core/Updates/1.1.php
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - Open source web analytics
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Piwik\Updates;
|
||||
|
||||
use Piwik\Config;
|
||||
use Piwik\Piwik;
|
||||
use Piwik\Updates;
|
||||
|
||||
/**
|
||||
*/
|
||||
class Updates_1_1 extends Updates
|
||||
{
|
||||
static function update()
|
||||
{
|
||||
$config = Config::getInstance();
|
||||
|
||||
try {
|
||||
$superuser = $config->superuser;
|
||||
} catch (\Exception $e) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (empty($superuser['login'])) {
|
||||
return;
|
||||
}
|
||||
|
||||
$rootLogin = $superuser['login'];
|
||||
try {
|
||||
// throws an exception if invalid
|
||||
Piwik::checkValidLoginString($rootLogin);
|
||||
} catch (\Exception $e) {
|
||||
throw new \Exception('Superuser login name "' . $rootLogin . '" is no longer a valid format. '
|
||||
. $e->getMessage()
|
||||
. ' Edit your config/config.ini.php to change it.');
|
||||
}
|
||||
}
|
||||
}
|
||||
31
www/analytics/core/Updates/1.10-b4.php
Executable file
31
www/analytics/core/Updates/1.10-b4.php
Executable file
|
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - Open source web analytics
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Piwik\Updates;
|
||||
|
||||
use Piwik\Updates;
|
||||
|
||||
/**
|
||||
*/
|
||||
class Updates_1_10_b4 extends Updates
|
||||
{
|
||||
static function isMajorUpdate()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
static function update()
|
||||
{
|
||||
try {
|
||||
\Piwik\Plugin\Manager::getInstance()->activatePlugin('MobileMessaging');
|
||||
} catch (\Exception $e) {
|
||||
// pass
|
||||
}
|
||||
}
|
||||
}
|
||||
31
www/analytics/core/Updates/1.10.1.php
Executable file
31
www/analytics/core/Updates/1.10.1.php
Executable file
|
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - Open source web analytics
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Piwik\Updates;
|
||||
|
||||
use Piwik\Updates;
|
||||
|
||||
/**
|
||||
*/
|
||||
class Updates_1_10_1 extends Updates
|
||||
{
|
||||
static function isMajorUpdate()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
static function update()
|
||||
{
|
||||
try {
|
||||
\Piwik\Plugin\Manager::getInstance()->activatePlugin('Overlay');
|
||||
} catch (\Exception $e) {
|
||||
// pass
|
||||
}
|
||||
}
|
||||
}
|
||||
33
www/analytics/core/Updates/1.10.2-b1.php
Executable file
33
www/analytics/core/Updates/1.10.2-b1.php
Executable file
|
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - Open source web analytics
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Piwik\Updates;
|
||||
|
||||
use Piwik\Common;
|
||||
use Piwik\Updater;
|
||||
use Piwik\Updates;
|
||||
|
||||
/**
|
||||
*/
|
||||
class Updates_1_10_2_b1 extends Updates
|
||||
{
|
||||
static function getSql()
|
||||
{
|
||||
return array(
|
||||
// ignore existing column name error (1060)
|
||||
'ALTER TABLE ' . Common::prefixTable('report')
|
||||
. " ADD COLUMN hour tinyint NOT NULL default 0 AFTER period" => 1060,
|
||||
);
|
||||
}
|
||||
|
||||
static function update()
|
||||
{
|
||||
Updater::updateDatabase(__FILE__, self::getSql());
|
||||
}
|
||||
}
|
||||
33
www/analytics/core/Updates/1.10.2-b2.php
Normal file
33
www/analytics/core/Updates/1.10.2-b2.php
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - Open source web analytics
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Piwik\Updates;
|
||||
|
||||
use Piwik\Common;
|
||||
use Piwik\Updater;
|
||||
use Piwik\Updates;
|
||||
|
||||
/**
|
||||
*/
|
||||
class Updates_1_10_2_b2 extends Updates
|
||||
{
|
||||
static function getSql()
|
||||
{
|
||||
return array(
|
||||
// ignore existing column name error (1060)
|
||||
'ALTER TABLE ' . Common::prefixTable('site')
|
||||
. " ADD COLUMN `keep_url_fragment` TINYINT NOT NULL DEFAULT 0 AFTER `group`" => 1060,
|
||||
);
|
||||
}
|
||||
|
||||
static function update()
|
||||
{
|
||||
Updater::updateDatabase(__FILE__, self::getSql());
|
||||
}
|
||||
}
|
||||
31
www/analytics/core/Updates/1.11-b1.php
Normal file
31
www/analytics/core/Updates/1.11-b1.php
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - Open source web analytics
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Piwik\Updates;
|
||||
|
||||
use Piwik\Updates;
|
||||
|
||||
/**
|
||||
*/
|
||||
class Updates_1_11_b1 extends Updates
|
||||
{
|
||||
static function isMajorUpdate()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
static function update()
|
||||
{
|
||||
try {
|
||||
\Piwik\Plugin\Manager::getInstance()->activatePlugin('UserCountryMap');
|
||||
} catch (\Exception $e) {
|
||||
// pass
|
||||
}
|
||||
}
|
||||
}
|
||||
38
www/analytics/core/Updates/1.12-b1.php
Normal file
38
www/analytics/core/Updates/1.12-b1.php
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - Open source web analytics
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Piwik\Updates;
|
||||
|
||||
use Piwik\Common;
|
||||
use Piwik\Updater;
|
||||
use Piwik\Updates;
|
||||
|
||||
/**
|
||||
*/
|
||||
class Updates_1_12_b1 extends Updates
|
||||
{
|
||||
static function isMajorUpdate()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
static function getSql()
|
||||
{
|
||||
return array(
|
||||
'ALTER TABLE `' . Common::prefixTable('log_link_visit_action') . '`
|
||||
ADD `custom_float` FLOAT NULL DEFAULT NULL' => 1060
|
||||
);
|
||||
}
|
||||
|
||||
static function update()
|
||||
{
|
||||
Updater::updateDatabase(__FILE__, self::getSql());
|
||||
}
|
||||
|
||||
}
|
||||
26
www/analytics/core/Updates/1.12-b15.php
Normal file
26
www/analytics/core/Updates/1.12-b15.php
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - Open source web analytics
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Piwik\Updates;
|
||||
|
||||
use Piwik\Updates;
|
||||
|
||||
/**
|
||||
*/
|
||||
class Updates_1_12_b15 extends Updates
|
||||
{
|
||||
static function update()
|
||||
{
|
||||
try {
|
||||
\Piwik\Plugin\Manager::getInstance()->activatePlugin('SegmentEditor');
|
||||
} catch (\Exception $e) {
|
||||
// pass
|
||||
}
|
||||
}
|
||||
}
|
||||
33
www/analytics/core/Updates/1.12-b16.php
Normal file
33
www/analytics/core/Updates/1.12-b16.php
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - Open source web analytics
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Piwik\Updates;
|
||||
|
||||
use Piwik\Common;
|
||||
use Piwik\Updater;
|
||||
use Piwik\Updates;
|
||||
|
||||
/**
|
||||
*/
|
||||
class Updates_1_12_b16 extends Updates
|
||||
{
|
||||
static function getSql()
|
||||
{
|
||||
return array(
|
||||
// ignore existing column name error (1060)
|
||||
'ALTER TABLE ' . Common::prefixTable('report')
|
||||
. " ADD COLUMN idsegment INT(11) AFTER description" => 1060,
|
||||
);
|
||||
}
|
||||
|
||||
static function update()
|
||||
{
|
||||
Updater::updateDatabase(__FILE__, self::getSql());
|
||||
}
|
||||
}
|
||||
150
www/analytics/core/Updates/1.2-rc1.php
Normal file
150
www/analytics/core/Updates/1.2-rc1.php
Normal file
|
|
@ -0,0 +1,150 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - Open source web analytics
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Piwik\Updates;
|
||||
|
||||
use Piwik\Common;
|
||||
use Piwik\Updater;
|
||||
use Piwik\Updates;
|
||||
|
||||
/**
|
||||
*/
|
||||
class Updates_1_2_rc1 extends Updates
|
||||
{
|
||||
static function getSql()
|
||||
{
|
||||
return array(
|
||||
// Various performance improvements schema updates
|
||||
'ALTER TABLE `' . Common::prefixTable('log_visit') . '`
|
||||
DROP `visit_server_date`,
|
||||
DROP INDEX `index_idsite_date_config`,
|
||||
DROP INDEX `index_idsite_datetime_config`,
|
||||
ADD `visit_entry_idaction_name` INT UNSIGNED NOT NULL AFTER `visit_entry_idaction_url`,
|
||||
ADD `visit_exit_idaction_name` INT UNSIGNED NOT NULL AFTER `visit_exit_idaction_url`,
|
||||
CHANGE `visit_exit_idaction_url` `visit_exit_idaction_url` INT UNSIGNED NOT NULL,
|
||||
CHANGE `visit_entry_idaction_url` `visit_entry_idaction_url` INT UNSIGNED NOT NULL,
|
||||
CHANGE `referer_type` `referer_type` TINYINT UNSIGNED NULL DEFAULT NULL,
|
||||
ADD `idvisitor` BINARY(8) NOT NULL AFTER `idsite`,
|
||||
ADD visitor_count_visits SMALLINT(5) UNSIGNED NOT NULL AFTER `visitor_returning`,
|
||||
ADD visitor_days_since_last SMALLINT(5) UNSIGNED NOT NULL,
|
||||
ADD visitor_days_since_first SMALLINT(5) UNSIGNED NOT NULL,
|
||||
ADD `config_id` BINARY(8) NOT NULL AFTER `config_md5config`
|
||||
' => false,
|
||||
'ALTER TABLE `' . Common::prefixTable('log_visit') . '`
|
||||
ADD custom_var_k1 VARCHAR(100) DEFAULT NULL,
|
||||
ADD custom_var_v1 VARCHAR(100) DEFAULT NULL,
|
||||
ADD custom_var_k2 VARCHAR(100) DEFAULT NULL,
|
||||
ADD custom_var_v2 VARCHAR(100) DEFAULT NULL,
|
||||
ADD custom_var_k3 VARCHAR(100) DEFAULT NULL,
|
||||
ADD custom_var_v3 VARCHAR(100) DEFAULT NULL,
|
||||
ADD custom_var_k4 VARCHAR(100) DEFAULT NULL,
|
||||
ADD custom_var_v4 VARCHAR(100) DEFAULT NULL,
|
||||
ADD custom_var_k5 VARCHAR(100) DEFAULT NULL,
|
||||
ADD custom_var_v5 VARCHAR(100) DEFAULT NULL
|
||||
' => 1060,
|
||||
'ALTER TABLE `' . Common::prefixTable('log_link_visit_action') . '`
|
||||
ADD `idsite` INT( 10 ) UNSIGNED NOT NULL AFTER `idlink_va` ,
|
||||
ADD `server_time` DATETIME AFTER `idsite`,
|
||||
ADD `idvisitor` BINARY(8) NOT NULL AFTER `idsite`,
|
||||
ADD `idaction_name_ref` INT UNSIGNED NOT NULL AFTER `idaction_name`,
|
||||
ADD INDEX `index_idsite_servertime` ( `idsite` , `server_time` )
|
||||
' => false,
|
||||
|
||||
'ALTER TABLE `' . Common::prefixTable('log_conversion') . '`
|
||||
DROP `referer_idvisit`,
|
||||
ADD `idvisitor` BINARY(8) NOT NULL AFTER `idsite`,
|
||||
ADD visitor_count_visits SMALLINT(5) UNSIGNED NOT NULL,
|
||||
ADD visitor_days_since_first SMALLINT(5) UNSIGNED NOT NULL
|
||||
' => false,
|
||||
'ALTER TABLE `' . Common::prefixTable('log_conversion') . '`
|
||||
ADD custom_var_k1 VARCHAR(100) DEFAULT NULL,
|
||||
ADD custom_var_v1 VARCHAR(100) DEFAULT NULL,
|
||||
ADD custom_var_k2 VARCHAR(100) DEFAULT NULL,
|
||||
ADD custom_var_v2 VARCHAR(100) DEFAULT NULL,
|
||||
ADD custom_var_k3 VARCHAR(100) DEFAULT NULL,
|
||||
ADD custom_var_v3 VARCHAR(100) DEFAULT NULL,
|
||||
ADD custom_var_k4 VARCHAR(100) DEFAULT NULL,
|
||||
ADD custom_var_v4 VARCHAR(100) DEFAULT NULL,
|
||||
ADD custom_var_k5 VARCHAR(100) DEFAULT NULL,
|
||||
ADD custom_var_v5 VARCHAR(100) DEFAULT NULL
|
||||
' => 1060,
|
||||
|
||||
// Migrate 128bits IDs inefficiently stored as 8bytes (256 bits) into 64bits
|
||||
'UPDATE ' . Common::prefixTable('log_visit') . '
|
||||
SET idvisitor = binary(unhex(substring(visitor_idcookie,1,16))),
|
||||
config_id = binary(unhex(substring(config_md5config,1,16)))
|
||||
' => false,
|
||||
'UPDATE ' . Common::prefixTable('log_conversion') . '
|
||||
SET idvisitor = binary(unhex(substring(visitor_idcookie,1,16)))
|
||||
' => false,
|
||||
|
||||
// Drop migrated fields
|
||||
'ALTER TABLE `' . Common::prefixTable('log_visit') . '`
|
||||
DROP visitor_idcookie,
|
||||
DROP config_md5config
|
||||
' => false,
|
||||
'ALTER TABLE `' . Common::prefixTable('log_conversion') . '`
|
||||
DROP visitor_idcookie
|
||||
' => false,
|
||||
|
||||
// Recreate INDEX on new field
|
||||
'ALTER TABLE `' . Common::prefixTable('log_visit') . '`
|
||||
ADD INDEX `index_idsite_datetime_config` (idsite, visit_last_action_time, config_id)
|
||||
' => false,
|
||||
|
||||
// Backfill action logs as best as we can
|
||||
'UPDATE ' . Common::prefixTable('log_link_visit_action') . ' as action,
|
||||
' . Common::prefixTable('log_visit') . ' as visit
|
||||
SET action.idsite = visit.idsite,
|
||||
action.server_time = visit.visit_last_action_time,
|
||||
action.idvisitor = visit.idvisitor
|
||||
WHERE action.idvisit=visit.idvisit
|
||||
' => false,
|
||||
|
||||
'ALTER TABLE `' . Common::prefixTable('log_link_visit_action') . '`
|
||||
CHANGE `server_time` `server_time` DATETIME NOT NULL
|
||||
' => false,
|
||||
|
||||
// New index used max once per request, in case this table grows significantly in the future
|
||||
'ALTER TABLE `' . Common::prefixTable('option') . '` ADD INDEX ( `autoload` ) ' => false,
|
||||
|
||||
// new field for websites
|
||||
'ALTER TABLE `' . Common::prefixTable('site') . '` ADD `group` VARCHAR( 250 ) NOT NULL' => false,
|
||||
);
|
||||
}
|
||||
|
||||
static function update()
|
||||
{
|
||||
// first we disable the plugins and keep an array of warnings messages
|
||||
$pluginsToDisableMessage = array(
|
||||
'GeoIP' => "GeoIP plugin was disabled, because it is not compatible with the new Piwik 1.2. \nYou can download the latest version of the plugin, compatible with Piwik 1.2.\n<a target='_blank' href='?module=Proxy&action=redirect&url=http://dev.piwik.org/trac/ticket/45'>Click here.</a>",
|
||||
'EntryPage' => "EntryPage plugin is not compatible with this version of Piwik, it was disabled.",
|
||||
);
|
||||
$disabledPlugins = array();
|
||||
foreach ($pluginsToDisableMessage as $pluginToDisable => $warningMessage) {
|
||||
if (\Piwik\Plugin\Manager::getInstance()->isPluginActivated($pluginToDisable)) {
|
||||
\Piwik\Plugin\Manager::getInstance()->deactivatePlugin($pluginToDisable);
|
||||
$disabledPlugins[] = $warningMessage;
|
||||
}
|
||||
}
|
||||
|
||||
// Run the SQL
|
||||
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>");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
26
www/analytics/core/Updates/1.2-rc2.php
Normal file
26
www/analytics/core/Updates/1.2-rc2.php
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - Open source web analytics
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Piwik\Updates;
|
||||
|
||||
use Piwik\Updates;
|
||||
|
||||
/**
|
||||
*/
|
||||
class Updates_1_2_rc2 extends Updates
|
||||
{
|
||||
static function update()
|
||||
{
|
||||
try {
|
||||
\Piwik\Plugin\Manager::getInstance()->activatePlugin('CustomVariables');
|
||||
} catch (\Exception $e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
41
www/analytics/core/Updates/1.2.3.php
Normal file
41
www/analytics/core/Updates/1.2.3.php
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - Open source web analytics
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Piwik\Updates;
|
||||
|
||||
use Piwik\Common;
|
||||
use Piwik\Config;
|
||||
use Piwik\Updater;
|
||||
use Piwik\Updates;
|
||||
|
||||
/**
|
||||
*/
|
||||
class Updates_1_2_3 extends Updates
|
||||
{
|
||||
static function getSql()
|
||||
{
|
||||
return array(
|
||||
// LOAD DATA INFILE uses the database's charset
|
||||
'ALTER DATABASE `' . Config::getInstance()->database['dbname'] . '` DEFAULT CHARACTER SET utf8' => false,
|
||||
|
||||
// Various performance improvements schema updates
|
||||
'ALTER TABLE `' . Common::prefixTable('log_visit') . '`
|
||||
DROP INDEX index_idsite_datetime_config,
|
||||
DROP INDEX index_idsite_idvisit,
|
||||
ADD INDEX index_idsite_config_datetime (idsite, config_id, visit_last_action_time),
|
||||
ADD INDEX index_idsite_datetime (idsite, visit_last_action_time)' => false,
|
||||
);
|
||||
}
|
||||
|
||||
static function update()
|
||||
{
|
||||
Updater::updateDatabase(__FILE__, self::getSql());
|
||||
}
|
||||
}
|
||||
|
||||
37
www/analytics/core/Updates/1.2.5-rc1.php
Normal file
37
www/analytics/core/Updates/1.2.5-rc1.php
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - Open source web analytics
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Piwik\Updates;
|
||||
|
||||
use Piwik\Common;
|
||||
use Piwik\Updater;
|
||||
use Piwik\Updates;
|
||||
|
||||
/**
|
||||
*/
|
||||
class Updates_1_2_5_rc1 extends Updates
|
||||
{
|
||||
static function getSql()
|
||||
{
|
||||
return array(
|
||||
'ALTER TABLE `' . Common::prefixTable('goal') . '`
|
||||
ADD `allow_multiple` tinyint(4) NOT NULL AFTER case_sensitive' => false,
|
||||
'ALTER TABLE `' . Common::prefixTable('log_conversion') . '`
|
||||
ADD buster int unsigned NOT NULL AFTER revenue,
|
||||
DROP PRIMARY KEY,
|
||||
ADD PRIMARY KEY (idvisit, idgoal, buster)' => false,
|
||||
);
|
||||
}
|
||||
|
||||
static function update()
|
||||
{
|
||||
Updater::updateDatabase(__FILE__, self::getSql());
|
||||
}
|
||||
}
|
||||
|
||||
34
www/analytics/core/Updates/1.2.5-rc7.php
Normal file
34
www/analytics/core/Updates/1.2.5-rc7.php
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - Open source web analytics
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Piwik\Updates;
|
||||
|
||||
use Piwik\Common;
|
||||
use Piwik\Updater;
|
||||
use Piwik\Updates;
|
||||
|
||||
/**
|
||||
*/
|
||||
class Updates_1_2_5_rc7 extends Updates
|
||||
{
|
||||
static function getSql()
|
||||
{
|
||||
return array(
|
||||
'ALTER TABLE `' . Common::prefixTable('log_visit') . '`
|
||||
ADD INDEX index_idsite_idvisitor (idsite, idvisitor)' => false,
|
||||
);
|
||||
}
|
||||
|
||||
static function update()
|
||||
{
|
||||
Updater::updateDatabase(__FILE__, self::getSql());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
37
www/analytics/core/Updates/1.4-rc1.php
Normal file
37
www/analytics/core/Updates/1.4-rc1.php
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - Open source web analytics
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Piwik\Updates;
|
||||
|
||||
use Piwik\Common;
|
||||
use Piwik\Updater;
|
||||
use Piwik\Updates;
|
||||
|
||||
/**
|
||||
*/
|
||||
class Updates_1_4_rc1 extends Updates
|
||||
{
|
||||
static function getSql()
|
||||
{
|
||||
return array(
|
||||
'UPDATE `' . Common::prefixTable('pdf') . '`
|
||||
SET format = "pdf"' => '42S22',
|
||||
'ALTER TABLE `' . Common::prefixTable('pdf') . '`
|
||||
ADD COLUMN `format` VARCHAR(10)' => '42S22',
|
||||
);
|
||||
}
|
||||
|
||||
static function update()
|
||||
{
|
||||
try {
|
||||
Updater::updateDatabase(__FILE__, self::getSql());
|
||||
} catch (\Exception $e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
44
www/analytics/core/Updates/1.4-rc2.php
Normal file
44
www/analytics/core/Updates/1.4-rc2.php
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - Open source web analytics
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Piwik\Updates;
|
||||
|
||||
use Piwik\Common;
|
||||
use Piwik\Updater;
|
||||
use Piwik\Updates;
|
||||
|
||||
/**
|
||||
*/
|
||||
class Updates_1_4_rc2 extends Updates
|
||||
{
|
||||
static function getSql()
|
||||
{
|
||||
return array(
|
||||
"SET sql_mode=''" => false,
|
||||
// this converts the 32-bit UNSIGNED INT column to a 16 byte VARBINARY;
|
||||
// _but_ MySQL does string conversion! (e.g., integer 1 is converted to 49 -- the ASCII code for "1")
|
||||
'ALTER TABLE ' . Common::prefixTable('log_visit') . '
|
||||
MODIFY location_ip VARBINARY(16) NOT NULL' => false,
|
||||
'ALTER TABLE ' . Common::prefixTable('logger_api_call') . '
|
||||
MODIFY caller_ip VARBINARY(16) NOT NULL' => false,
|
||||
|
||||
// fortunately, 2^32 is 10 digits long and fits in the VARBINARY(16) without truncation;
|
||||
// to fix this, we cast to an integer, convert to hex, pad out leading zeros, and unhex it
|
||||
'UPDATE ' . Common::prefixTable('log_visit') . "
|
||||
SET location_ip = UNHEX(LPAD(HEX(CONVERT(location_ip, UNSIGNED)), 8, '0'))" => false,
|
||||
'UPDATE ' . Common::prefixTable('logger_api_call') . "
|
||||
SET caller_ip = UNHEX(LPAD(HEX(CONVERT(caller_ip, UNSIGNED)), 8, '0'))" => false,
|
||||
);
|
||||
}
|
||||
|
||||
static function update()
|
||||
{
|
||||
Updater::updateDatabase(__FILE__, self::getSql());
|
||||
}
|
||||
}
|
||||
63
www/analytics/core/Updates/1.5-b1.php
Normal file
63
www/analytics/core/Updates/1.5-b1.php
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - Open source web analytics
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Piwik\Updates;
|
||||
|
||||
|
||||
use Piwik\Common;
|
||||
use Piwik\Updater;
|
||||
use Piwik\Updates;
|
||||
|
||||
/**
|
||||
*/
|
||||
class Updates_1_5_b1 extends Updates
|
||||
{
|
||||
static function getSql()
|
||||
{
|
||||
return array(
|
||||
'CREATE TABLE `' . Common::prefixTable('log_conversion_item') . '` (
|
||||
idsite int(10) UNSIGNED NOT NULL,
|
||||
idvisitor BINARY(8) NOT NULL,
|
||||
server_time DATETIME NOT NULL,
|
||||
idvisit INTEGER(10) UNSIGNED NOT NULL,
|
||||
idorder varchar(100) NOT NULL,
|
||||
|
||||
idaction_sku INTEGER(10) UNSIGNED NOT NULL,
|
||||
idaction_name INTEGER(10) UNSIGNED NOT NULL,
|
||||
idaction_category INTEGER(10) UNSIGNED NOT NULL,
|
||||
price FLOAT NOT NULL,
|
||||
quantity INTEGER(10) UNSIGNED NOT NULL,
|
||||
deleted TINYINT(1) UNSIGNED NOT NULL,
|
||||
|
||||
PRIMARY KEY(idvisit, idorder, idaction_sku),
|
||||
INDEX index_idsite_servertime ( idsite, server_time )
|
||||
) DEFAULT CHARSET=utf8 ' => false,
|
||||
|
||||
'ALTER IGNORE TABLE `' . Common::prefixTable('log_visit') . '`
|
||||
ADD visitor_days_since_order SMALLINT(5) UNSIGNED NOT NULL AFTER visitor_days_since_last,
|
||||
ADD visit_goal_buyer TINYINT(1) NOT NULL AFTER visit_goal_converted' => false,
|
||||
|
||||
'ALTER IGNORE TABLE `' . Common::prefixTable('log_conversion') . '`
|
||||
ADD visitor_days_since_order SMALLINT(5) UNSIGNED NOT NULL AFTER visitor_days_since_first,
|
||||
ADD idorder varchar(100) default NULL AFTER buster,
|
||||
ADD items SMALLINT UNSIGNED DEFAULT NULL,
|
||||
ADD revenue_subtotal float default NULL,
|
||||
ADD revenue_tax float default NULL,
|
||||
ADD revenue_shipping float default NULL,
|
||||
ADD revenue_discount float default NULL,
|
||||
ADD UNIQUE KEY unique_idsite_idorder (idsite, idorder),
|
||||
MODIFY idgoal int(10) NOT NULL' => false,
|
||||
);
|
||||
}
|
||||
|
||||
static function update()
|
||||
{
|
||||
Updater::updateDatabase(__FILE__, self::getSql());
|
||||
}
|
||||
}
|
||||
41
www/analytics/core/Updates/1.5-b2.php
Normal file
41
www/analytics/core/Updates/1.5-b2.php
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - Open source web analytics
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Piwik\Updates;
|
||||
|
||||
use Piwik\Common;
|
||||
use Piwik\Updater;
|
||||
use Piwik\Updates;
|
||||
|
||||
/**
|
||||
*/
|
||||
class Updates_1_5_b2 extends Updates
|
||||
{
|
||||
static function getSql()
|
||||
{
|
||||
return array(
|
||||
'ALTER TABLE `' . Common::prefixTable('log_link_visit_action') . '`
|
||||
ADD custom_var_k1 VARCHAR(100) DEFAULT NULL AFTER time_spent_ref_action,
|
||||
ADD custom_var_v1 VARCHAR(100) DEFAULT NULL,
|
||||
ADD custom_var_k2 VARCHAR(100) DEFAULT NULL,
|
||||
ADD custom_var_v2 VARCHAR(100) DEFAULT NULL,
|
||||
ADD custom_var_k3 VARCHAR(100) DEFAULT NULL,
|
||||
ADD custom_var_v3 VARCHAR(100) DEFAULT NULL,
|
||||
ADD custom_var_k4 VARCHAR(100) DEFAULT NULL,
|
||||
ADD custom_var_v4 VARCHAR(100) DEFAULT NULL,
|
||||
ADD custom_var_k5 VARCHAR(100) DEFAULT NULL,
|
||||
ADD custom_var_v5 VARCHAR(100) DEFAULT NULL' => 1060,
|
||||
);
|
||||
}
|
||||
|
||||
static function update()
|
||||
{
|
||||
Updater::updateDatabase(__FILE__, self::getSql());
|
||||
}
|
||||
}
|
||||
63
www/analytics/core/Updates/1.5-b3.php
Normal file
63
www/analytics/core/Updates/1.5-b3.php
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - Open source web analytics
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Piwik\Updates;
|
||||
|
||||
use Piwik\Common;
|
||||
use Piwik\Updater;
|
||||
use Piwik\Updates;
|
||||
|
||||
/**
|
||||
*/
|
||||
class Updates_1_5_b3 extends Updates
|
||||
{
|
||||
static function getSql()
|
||||
{
|
||||
return array(
|
||||
'ALTER TABLE `' . Common::prefixTable('log_visit') . '`
|
||||
CHANGE custom_var_k1 custom_var_k1 VARCHAR(100) DEFAULT NULL,
|
||||
CHANGE custom_var_v1 custom_var_v1 VARCHAR(100) DEFAULT NULL,
|
||||
CHANGE custom_var_k2 custom_var_k2 VARCHAR(100) DEFAULT NULL,
|
||||
CHANGE custom_var_v2 custom_var_v2 VARCHAR(100) DEFAULT NULL,
|
||||
CHANGE custom_var_k3 custom_var_k3 VARCHAR(100) DEFAULT NULL,
|
||||
CHANGE custom_var_v3 custom_var_v3 VARCHAR(100) DEFAULT NULL,
|
||||
CHANGE custom_var_k4 custom_var_k4 VARCHAR(100) DEFAULT NULL,
|
||||
CHANGE custom_var_v4 custom_var_v4 VARCHAR(100) DEFAULT NULL,
|
||||
CHANGE custom_var_k5 custom_var_k5 VARCHAR(100) DEFAULT NULL,
|
||||
CHANGE custom_var_v5 custom_var_v5 VARCHAR(100) DEFAULT NULL' => false,
|
||||
'ALTER TABLE `' . Common::prefixTable('log_conversion') . '`
|
||||
CHANGE custom_var_k1 custom_var_k1 VARCHAR(100) DEFAULT NULL,
|
||||
CHANGE custom_var_v1 custom_var_v1 VARCHAR(100) DEFAULT NULL,
|
||||
CHANGE custom_var_k2 custom_var_k2 VARCHAR(100) DEFAULT NULL,
|
||||
CHANGE custom_var_v2 custom_var_v2 VARCHAR(100) DEFAULT NULL,
|
||||
CHANGE custom_var_k3 custom_var_k3 VARCHAR(100) DEFAULT NULL,
|
||||
CHANGE custom_var_v3 custom_var_v3 VARCHAR(100) DEFAULT NULL,
|
||||
CHANGE custom_var_k4 custom_var_k4 VARCHAR(100) DEFAULT NULL,
|
||||
CHANGE custom_var_v4 custom_var_v4 VARCHAR(100) DEFAULT NULL,
|
||||
CHANGE custom_var_k5 custom_var_k5 VARCHAR(100) DEFAULT NULL,
|
||||
CHANGE custom_var_v5 custom_var_v5 VARCHAR(100) DEFAULT NULL' => false,
|
||||
'ALTER TABLE `' . Common::prefixTable('log_link_visit_action') . '`
|
||||
CHANGE custom_var_k1 custom_var_k1 VARCHAR(100) DEFAULT NULL,
|
||||
CHANGE custom_var_v1 custom_var_v1 VARCHAR(100) DEFAULT NULL,
|
||||
CHANGE custom_var_k2 custom_var_k2 VARCHAR(100) DEFAULT NULL,
|
||||
CHANGE custom_var_v2 custom_var_v2 VARCHAR(100) DEFAULT NULL,
|
||||
CHANGE custom_var_k3 custom_var_k3 VARCHAR(100) DEFAULT NULL,
|
||||
CHANGE custom_var_v3 custom_var_v3 VARCHAR(100) DEFAULT NULL,
|
||||
CHANGE custom_var_k4 custom_var_k4 VARCHAR(100) DEFAULT NULL,
|
||||
CHANGE custom_var_v4 custom_var_v4 VARCHAR(100) DEFAULT NULL,
|
||||
CHANGE custom_var_k5 custom_var_k5 VARCHAR(100) DEFAULT NULL,
|
||||
CHANGE custom_var_v5 custom_var_v5 VARCHAR(100) DEFAULT NULL' => false,
|
||||
);
|
||||
}
|
||||
|
||||
static function update()
|
||||
{
|
||||
Updater::updateDatabase(__FILE__, self::getSql());
|
||||
}
|
||||
}
|
||||
32
www/analytics/core/Updates/1.5-b4.php
Normal file
32
www/analytics/core/Updates/1.5-b4.php
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - Open source web analytics
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Piwik\Updates;
|
||||
|
||||
use Piwik\Common;
|
||||
use Piwik\Updater;
|
||||
use Piwik\Updates;
|
||||
|
||||
/**
|
||||
*/
|
||||
class Updates_1_5_b4 extends Updates
|
||||
{
|
||||
static function getSql()
|
||||
{
|
||||
return array(
|
||||
'ALTER TABLE `' . Common::prefixTable('site') . '`
|
||||
ADD ecommerce TINYINT DEFAULT 0' => false,
|
||||
);
|
||||
}
|
||||
|
||||
static function update()
|
||||
{
|
||||
Updater::updateDatabase(__FILE__, self::getSql());
|
||||
}
|
||||
}
|
||||
37
www/analytics/core/Updates/1.5-b5.php
Normal file
37
www/analytics/core/Updates/1.5-b5.php
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - Open source web analytics
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Piwik\Updates;
|
||||
|
||||
use Piwik\Common;
|
||||
use Piwik\Updater;
|
||||
use Piwik\Updates;
|
||||
|
||||
/**
|
||||
*/
|
||||
class Updates_1_5_b5 extends Updates
|
||||
{
|
||||
static function getSql()
|
||||
{
|
||||
return array(
|
||||
'CREATE TABLE `' . Common::prefixTable('session') . '` (
|
||||
id CHAR(32) NOT NULL,
|
||||
modified INTEGER,
|
||||
lifetime INTEGER,
|
||||
data TEXT,
|
||||
PRIMARY KEY ( id )
|
||||
) DEFAULT CHARSET=utf8' => false,
|
||||
);
|
||||
}
|
||||
|
||||
static function update()
|
||||
{
|
||||
Updater::updateDatabase(__FILE__, self::getSql());
|
||||
}
|
||||
}
|
||||
26
www/analytics/core/Updates/1.5-rc6.php
Normal file
26
www/analytics/core/Updates/1.5-rc6.php
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - Open source web analytics
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Piwik\Updates;
|
||||
|
||||
use Piwik\Updates;
|
||||
|
||||
/**
|
||||
*/
|
||||
class Updates_1_5_rc6 extends Updates
|
||||
{
|
||||
static function update()
|
||||
{
|
||||
try {
|
||||
\Piwik\Plugin\Manager::getInstance()->activatePlugin('PrivacyManager');
|
||||
} catch (\Exception $e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
68
www/analytics/core/Updates/1.6-b1.php
Normal file
68
www/analytics/core/Updates/1.6-b1.php
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - Open source web analytics
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Piwik\Updates;
|
||||
|
||||
use Piwik\Common;
|
||||
use Piwik\Updater;
|
||||
use Piwik\Updates;
|
||||
|
||||
/**
|
||||
*/
|
||||
class Updates_1_6_b1 extends Updates
|
||||
{
|
||||
static function getSql()
|
||||
{
|
||||
return array(
|
||||
'ALTER TABLE `' . Common::prefixTable('log_conversion_item') . '`
|
||||
ADD idaction_category2 INTEGER(10) UNSIGNED NOT NULL AFTER idaction_category,
|
||||
ADD idaction_category3 INTEGER(10) UNSIGNED NOT NULL,
|
||||
ADD idaction_category4 INTEGER(10) UNSIGNED NOT NULL,
|
||||
ADD idaction_category5 INTEGER(10) UNSIGNED NOT NULL' => false,
|
||||
'ALTER TABLE `' . Common::prefixTable('log_visit') . '`
|
||||
CHANGE custom_var_k1 custom_var_k1 VARCHAR(200) DEFAULT NULL,
|
||||
CHANGE custom_var_v1 custom_var_v1 VARCHAR(200) DEFAULT NULL,
|
||||
CHANGE custom_var_k2 custom_var_k2 VARCHAR(200) DEFAULT NULL,
|
||||
CHANGE custom_var_v2 custom_var_v2 VARCHAR(200) DEFAULT NULL,
|
||||
CHANGE custom_var_k3 custom_var_k3 VARCHAR(200) DEFAULT NULL,
|
||||
CHANGE custom_var_v3 custom_var_v3 VARCHAR(200) DEFAULT NULL,
|
||||
CHANGE custom_var_k4 custom_var_k4 VARCHAR(200) DEFAULT NULL,
|
||||
CHANGE custom_var_v4 custom_var_v4 VARCHAR(200) DEFAULT NULL,
|
||||
CHANGE custom_var_k5 custom_var_k5 VARCHAR(200) DEFAULT NULL,
|
||||
CHANGE custom_var_v5 custom_var_v5 VARCHAR(200) DEFAULT NULL' => 1060,
|
||||
'ALTER TABLE `' . Common::prefixTable('log_conversion') . '`
|
||||
CHANGE custom_var_k1 custom_var_k1 VARCHAR(200) DEFAULT NULL,
|
||||
CHANGE custom_var_v1 custom_var_v1 VARCHAR(200) DEFAULT NULL,
|
||||
CHANGE custom_var_k2 custom_var_k2 VARCHAR(200) DEFAULT NULL,
|
||||
CHANGE custom_var_v2 custom_var_v2 VARCHAR(200) DEFAULT NULL,
|
||||
CHANGE custom_var_k3 custom_var_k3 VARCHAR(200) DEFAULT NULL,
|
||||
CHANGE custom_var_v3 custom_var_v3 VARCHAR(200) DEFAULT NULL,
|
||||
CHANGE custom_var_k4 custom_var_k4 VARCHAR(200) DEFAULT NULL,
|
||||
CHANGE custom_var_v4 custom_var_v4 VARCHAR(200) DEFAULT NULL,
|
||||
CHANGE custom_var_k5 custom_var_k5 VARCHAR(200) DEFAULT NULL,
|
||||
CHANGE custom_var_v5 custom_var_v5 VARCHAR(200) DEFAULT NULL' => 1060,
|
||||
'ALTER TABLE `' . Common::prefixTable('log_link_visit_action') . '`
|
||||
CHANGE custom_var_k1 custom_var_k1 VARCHAR(200) DEFAULT NULL,
|
||||
CHANGE custom_var_v1 custom_var_v1 VARCHAR(200) DEFAULT NULL,
|
||||
CHANGE custom_var_k2 custom_var_k2 VARCHAR(200) DEFAULT NULL,
|
||||
CHANGE custom_var_v2 custom_var_v2 VARCHAR(200) DEFAULT NULL,
|
||||
CHANGE custom_var_k3 custom_var_k3 VARCHAR(200) DEFAULT NULL,
|
||||
CHANGE custom_var_v3 custom_var_v3 VARCHAR(200) DEFAULT NULL,
|
||||
CHANGE custom_var_k4 custom_var_k4 VARCHAR(200) DEFAULT NULL,
|
||||
CHANGE custom_var_v4 custom_var_v4 VARCHAR(200) DEFAULT NULL,
|
||||
CHANGE custom_var_k5 custom_var_k5 VARCHAR(200) DEFAULT NULL,
|
||||
CHANGE custom_var_v5 custom_var_v5 VARCHAR(200) DEFAULT NULL' => 1060,
|
||||
);
|
||||
}
|
||||
|
||||
static function update()
|
||||
{
|
||||
Updater::updateDatabase(__FILE__, self::getSql());
|
||||
}
|
||||
}
|
||||
26
www/analytics/core/Updates/1.6-rc1.php
Normal file
26
www/analytics/core/Updates/1.6-rc1.php
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - Open source web analytics
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Piwik\Updates;
|
||||
|
||||
use Piwik\Updates;
|
||||
|
||||
/**
|
||||
*/
|
||||
class Updates_1_6_rc1 extends Updates
|
||||
{
|
||||
static function update()
|
||||
{
|
||||
try {
|
||||
\Piwik\Plugin\Manager::getInstance()->activatePlugin('ImageGraph');
|
||||
} catch (\Exception $e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
37
www/analytics/core/Updates/1.7-b1.php
Normal file
37
www/analytics/core/Updates/1.7-b1.php
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - Open source web analytics
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Piwik\Updates;
|
||||
|
||||
use Piwik\Common;
|
||||
use Piwik\Updater;
|
||||
use Piwik\Updates;
|
||||
|
||||
/**
|
||||
*/
|
||||
class Updates_1_7_b1 extends Updates
|
||||
{
|
||||
static function getSql()
|
||||
{
|
||||
return array(
|
||||
'ALTER TABLE `' . Common::prefixTable('pdf') . '`
|
||||
ADD COLUMN `aggregate_reports_format` TINYINT(1) NOT NULL AFTER `reports`' => false,
|
||||
'UPDATE `' . Common::prefixTable('pdf') . '`
|
||||
SET `aggregate_reports_format` = 1' => false,
|
||||
);
|
||||
}
|
||||
|
||||
static function update()
|
||||
{
|
||||
try {
|
||||
Updater::updateDatabase(__FILE__, self::getSql());
|
||||
} catch (\Exception $e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
35
www/analytics/core/Updates/1.7.2-rc5.php
Normal file
35
www/analytics/core/Updates/1.7.2-rc5.php
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - Open source web analytics
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Piwik\Updates;
|
||||
|
||||
use Piwik\Common;
|
||||
use Piwik\Updater;
|
||||
use Piwik\Updates;
|
||||
|
||||
/**
|
||||
*/
|
||||
class Updates_1_7_2_rc5 extends Updates
|
||||
{
|
||||
static function getSql()
|
||||
{
|
||||
return array(
|
||||
'ALTER TABLE `' . Common::prefixTable('pdf') . '`
|
||||
CHANGE `aggregate_reports_format` `display_format` TINYINT(1) NOT NULL' => false
|
||||
);
|
||||
}
|
||||
|
||||
static function update()
|
||||
{
|
||||
try {
|
||||
Updater::updateDatabase(__FILE__, self::getSql());
|
||||
} catch (\Exception $e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
45
www/analytics/core/Updates/1.7.2-rc7.php
Executable file
45
www/analytics/core/Updates/1.7.2-rc7.php
Executable file
|
|
@ -0,0 +1,45 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - Open source web analytics
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Piwik\Updates;
|
||||
|
||||
use Piwik\Common;
|
||||
use Piwik\Db;
|
||||
use Piwik\Updater;
|
||||
use Piwik\Updates;
|
||||
|
||||
/**
|
||||
*/
|
||||
class Updates_1_7_2_rc7 extends Updates
|
||||
{
|
||||
static function getSql()
|
||||
{
|
||||
return array(
|
||||
'ALTER TABLE `' . Common::prefixTable('user_dashboard') . '`
|
||||
ADD `name` VARCHAR( 100 ) NULL DEFAULT NULL AFTER `iddashboard`' => false,
|
||||
);
|
||||
}
|
||||
|
||||
static function update()
|
||||
{
|
||||
try {
|
||||
$dashboards = Db::fetchAll('SELECT * FROM `' . 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);
|
||||
Db::query('UPDATE `' . Common::prefixTable('user_dashboard') . '` SET layout = ? WHERE iddashboard = ? AND login = ?', array($layout, $idDashboard, $login));
|
||||
}
|
||||
Updater::updateDatabase(__FILE__, self::getSql());
|
||||
} catch (\Exception $e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
115
www/analytics/core/Updates/1.8.3-b1.php
Normal file
115
www/analytics/core/Updates/1.8.3-b1.php
Normal file
|
|
@ -0,0 +1,115 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - Open source web analytics
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Piwik\Updates;
|
||||
|
||||
use Piwik\Common;
|
||||
use Piwik\Db;
|
||||
use Piwik\Plugins\ScheduledReports\ScheduledReports;
|
||||
use Piwik\Updater;
|
||||
use Piwik\Updates;
|
||||
|
||||
/**
|
||||
*/
|
||||
class Updates_1_8_3_b1 extends Updates
|
||||
{
|
||||
|
||||
static function getSql()
|
||||
{
|
||||
return array(
|
||||
'ALTER TABLE `' . Common::prefixTable('site') . '`
|
||||
CHANGE `excluded_parameters` `excluded_parameters` TEXT NOT NULL' => false,
|
||||
|
||||
'CREATE TABLE `' . Common::prefixTable('report') . '` (
|
||||
`idreport` INT(11) NOT NULL AUTO_INCREMENT,
|
||||
`idsite` INTEGER(11) NOT NULL,
|
||||
`login` VARCHAR(100) NOT NULL,
|
||||
`description` VARCHAR(255) NOT NULL,
|
||||
`period` VARCHAR(10) NOT NULL,
|
||||
`type` VARCHAR(10) NOT NULL,
|
||||
`format` VARCHAR(10) NOT NULL,
|
||||
`reports` TEXT NOT NULL,
|
||||
`parameters` TEXT NULL,
|
||||
`ts_created` TIMESTAMP NULL,
|
||||
`ts_last_sent` TIMESTAMP NULL,
|
||||
`deleted` tinyint(4) NOT NULL default 0,
|
||||
PRIMARY KEY (`idreport`)
|
||||
) DEFAULT CHARSET=utf8' => 1050,
|
||||
);
|
||||
}
|
||||
|
||||
static function update()
|
||||
{
|
||||
Updater::updateDatabase(__FILE__, self::getSql());
|
||||
if (!\Piwik\Plugin\Manager::getInstance()->isPluginLoaded('ScheduledReports')) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
// 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 Common::prefixTable('report')
|
||||
// - migrate previous reports, if any, from Common::prefixTable('pdf') to Common::prefixTable('report')
|
||||
// - delete Common::prefixTable('pdf')
|
||||
|
||||
$reports = Db::fetchAll('SELECT * FROM `' . 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[ScheduledReports::ADDITIONAL_EMAILS_PARAMETER] = preg_split('/,/', $additional_emails);
|
||||
}
|
||||
|
||||
$parameters[ScheduledReports::EMAIL_ME_PARAMETER] = is_null($email_me) ? ScheduledReports::EMAIL_ME_PARAMETER_DEFAULT_VALUE : (bool)$email_me;
|
||||
$parameters[ScheduledReports::DISPLAY_FORMAT_PARAMETER] = $display_format;
|
||||
|
||||
Db::query(
|
||||
'INSERT INTO `' . 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) ? ScheduledReports::DEFAULT_PERIOD : $period,
|
||||
ScheduledReports::EMAIL_TYPE,
|
||||
is_null($format) ? ScheduledReports::DEFAULT_REPORT_FORMAT : $format,
|
||||
Common::json_encode(preg_split('/,/', $reports)),
|
||||
Common::json_encode($parameters),
|
||||
$ts_created,
|
||||
$ts_last_sent,
|
||||
$deleted
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
Db::query('DROP TABLE `' . Common::prefixTable('pdf') . '`');
|
||||
} catch (\Exception $e) {
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
190
www/analytics/core/Updates/1.8.4-b1.php
Normal file
190
www/analytics/core/Updates/1.8.4-b1.php
Normal file
|
|
@ -0,0 +1,190 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - Open source web analytics
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Piwik\Updates;
|
||||
|
||||
use Piwik\Common;
|
||||
use Piwik\Updater;
|
||||
use Piwik\Updates;
|
||||
|
||||
/**
|
||||
*/
|
||||
class Updates_1_8_4_b1 extends Updates
|
||||
{
|
||||
|
||||
static function isMajorUpdate()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
static function getSql()
|
||||
{
|
||||
$action = Common::prefixTable('log_action');
|
||||
$duplicates = Common::prefixTable('log_action_duplicates');
|
||||
$visitAction = Common::prefixTable('log_link_visit_action');
|
||||
$conversion = Common::prefixTable('log_conversion');
|
||||
$visit = Common::prefixTable('log_visit');
|
||||
|
||||
return array(
|
||||
|
||||
// add url_prefix column
|
||||
" ALTER TABLE `$action`
|
||||
ADD `url_prefix` TINYINT(2) NULL AFTER `type`;
|
||||
" => 1060, // ignore error 1060 Duplicate column name 'url_prefix'
|
||||
|
||||
// remove protocol and www and store information in url_prefix
|
||||
" UPDATE `$action`
|
||||
SET
|
||||
url_prefix = IF (
|
||||
LEFT(name, 11) = 'http://www.', 1, IF (
|
||||
LEFT(name, 7) = 'http://', 0, IF (
|
||||
LEFT(name, 12) = 'https://www.', 3, IF (
|
||||
LEFT(name, 8) = 'https://', 2, NULL
|
||||
)
|
||||
)
|
||||
)
|
||||
),
|
||||
name = IF (
|
||||
url_prefix = 0, SUBSTRING(name, 8), IF (
|
||||
url_prefix = 1, SUBSTRING(name, 12), IF (
|
||||
url_prefix = 2, SUBSTRING(name, 9), IF (
|
||||
url_prefix = 3, SUBSTRING(name, 13), name
|
||||
)
|
||||
)
|
||||
)
|
||||
),
|
||||
hash = CRC32(name)
|
||||
WHERE
|
||||
type = 1 AND
|
||||
url_prefix IS NULL;
|
||||
" => false,
|
||||
|
||||
// find duplicates
|
||||
" DROP TABLE IF EXISTS `$duplicates`;
|
||||
" => false,
|
||||
" CREATE TABLE `$duplicates` (
|
||||
`before` int(10) unsigned NOT NULL,
|
||||
`after` int(10) unsigned NOT NULL,
|
||||
KEY `mainkey` (`before`)
|
||||
) ENGINE=InnoDB;
|
||||
" => false,
|
||||
|
||||
// grouping by name only would be case-insensitive, so we GROUP BY name,hash
|
||||
// ON (action.type = 1 AND canonical.hash = action.hash) will use index (type, hash)
|
||||
" INSERT INTO `$duplicates` (
|
||||
SELECT
|
||||
action.idaction AS `before`,
|
||||
canonical.idaction AS `after`
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
name,
|
||||
hash,
|
||||
MIN(idaction) AS idaction
|
||||
FROM
|
||||
`$action` AS action_canonical_base
|
||||
WHERE
|
||||
type = 1 AND
|
||||
url_prefix IS NOT NULL
|
||||
GROUP BY name, hash
|
||||
HAVING COUNT(idaction) > 1
|
||||
)
|
||||
AS canonical
|
||||
LEFT JOIN
|
||||
`$action` AS action
|
||||
ON (action.type = 1 AND canonical.hash = action.hash)
|
||||
AND canonical.name = action.name
|
||||
AND canonical.idaction != action.idaction
|
||||
);
|
||||
" => false,
|
||||
|
||||
// replace idaction in log_link_visit_action
|
||||
" UPDATE
|
||||
`$visitAction` AS link
|
||||
LEFT JOIN
|
||||
`$duplicates` AS duplicates_idaction_url
|
||||
ON link.idaction_url = duplicates_idaction_url.before
|
||||
SET
|
||||
link.idaction_url = duplicates_idaction_url.after
|
||||
WHERE
|
||||
duplicates_idaction_url.after IS NOT NULL;
|
||||
" => false,
|
||||
" UPDATE
|
||||
`$visitAction` AS link
|
||||
LEFT JOIN
|
||||
`$duplicates` AS duplicates_idaction_url_ref
|
||||
ON link.idaction_url_ref = duplicates_idaction_url_ref.before
|
||||
SET
|
||||
link.idaction_url_ref = duplicates_idaction_url_ref.after
|
||||
WHERE
|
||||
duplicates_idaction_url_ref.after IS NOT NULL;
|
||||
" => false,
|
||||
|
||||
// replace idaction in log_conversion
|
||||
" UPDATE
|
||||
`$conversion` AS conversion
|
||||
LEFT JOIN
|
||||
`$duplicates` AS duplicates
|
||||
ON conversion.idaction_url = duplicates.before
|
||||
SET
|
||||
conversion.idaction_url = duplicates.after
|
||||
WHERE
|
||||
duplicates.after IS NOT NULL;
|
||||
" => false,
|
||||
|
||||
// replace idaction in log_visit
|
||||
" UPDATE
|
||||
`$visit` AS visit
|
||||
LEFT JOIN
|
||||
`$duplicates` AS duplicates_entry
|
||||
ON visit.visit_entry_idaction_url = duplicates_entry.before
|
||||
SET
|
||||
visit.visit_entry_idaction_url = duplicates_entry.after
|
||||
WHERE
|
||||
duplicates_entry.after IS NOT NULL;
|
||||
" => false,
|
||||
" UPDATE
|
||||
`$visit` AS visit
|
||||
LEFT JOIN
|
||||
`$duplicates` AS duplicates_exit
|
||||
ON visit.visit_exit_idaction_url = duplicates_exit.before
|
||||
SET
|
||||
visit.visit_exit_idaction_url = duplicates_exit.after
|
||||
WHERE
|
||||
duplicates_exit.after IS NOT NULL;
|
||||
" => false,
|
||||
|
||||
// remove duplicates from log_action
|
||||
" DELETE action FROM
|
||||
`$action` AS action
|
||||
LEFT JOIN
|
||||
`$duplicates` AS duplicates
|
||||
ON action.idaction = duplicates.before
|
||||
WHERE
|
||||
duplicates.after IS NOT NULL;
|
||||
" => false,
|
||||
|
||||
// remove the duplicates table
|
||||
" DROP TABLE `$duplicates`;
|
||||
" => false
|
||||
);
|
||||
}
|
||||
|
||||
static function update()
|
||||
{
|
||||
try {
|
||||
self::enableMaintenanceMode();
|
||||
Updater::updateDatabase(__FILE__, self::getSql());
|
||||
self::disableMaintenanceMode();
|
||||
} catch (\Exception $e) {
|
||||
self::disableMaintenanceMode();
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
}
|
||||
54
www/analytics/core/Updates/1.9-b16.php
Executable file
54
www/analytics/core/Updates/1.9-b16.php
Executable file
|
|
@ -0,0 +1,54 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - Open source web analytics
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Piwik\Updates;
|
||||
|
||||
use Piwik\Common;
|
||||
use Piwik\Updater;
|
||||
use Piwik\Updates;
|
||||
|
||||
/**
|
||||
*/
|
||||
class Updates_1_9_b16 extends Updates
|
||||
{
|
||||
static function isMajorUpdate()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
static function getSql()
|
||||
{
|
||||
return array(
|
||||
'ALTER TABLE `' . Common::prefixTable('log_link_visit_action') . '`
|
||||
CHANGE `idaction_url` `idaction_url` INT( 10 ) UNSIGNED NULL DEFAULT NULL'
|
||||
=> false,
|
||||
|
||||
|
||||
'ALTER TABLE `' . Common::prefixTable('log_visit') . '`
|
||||
ADD visit_total_searches SMALLINT(5) UNSIGNED NOT NULL AFTER `visit_total_actions`'
|
||||
=> 1060,
|
||||
|
||||
'ALTER TABLE `' . Common::prefixTable('site') . '`
|
||||
ADD sitesearch TINYINT DEFAULT 1 AFTER `excluded_parameters`,
|
||||
ADD sitesearch_keyword_parameters TEXT NOT NULL AFTER `sitesearch`,
|
||||
ADD sitesearch_category_parameters TEXT NOT NULL AFTER `sitesearch_keyword_parameters`'
|
||||
=> 1060,
|
||||
|
||||
// enable Site Search for all websites, users can manually disable the setting
|
||||
'UPDATE `' . Common::prefixTable('site') . '`
|
||||
SET `sitesearch` = 1' => false,
|
||||
);
|
||||
}
|
||||
|
||||
static function update()
|
||||
{
|
||||
Updater::updateDatabase(__FILE__, self::getSql());
|
||||
}
|
||||
}
|
||||
|
||||
43
www/analytics/core/Updates/1.9-b19.php
Executable file
43
www/analytics/core/Updates/1.9-b19.php
Executable file
|
|
@ -0,0 +1,43 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - Open source web analytics
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Piwik\Updates;
|
||||
|
||||
use Piwik\Common;
|
||||
use Piwik\Updater;
|
||||
use Piwik\Updates;
|
||||
|
||||
/**
|
||||
*/
|
||||
class Updates_1_9_b19 extends Updates
|
||||
{
|
||||
static function getSql()
|
||||
{
|
||||
return array(
|
||||
'ALTER TABLE `' . Common::prefixTable('log_link_visit_action') . '`
|
||||
CHANGE `idaction_url_ref` `idaction_url_ref` INT( 10 ) UNSIGNED NULL DEFAULT 0'
|
||||
=> false,
|
||||
'ALTER TABLE `' . Common::prefixTable('log_visit') . '`
|
||||
CHANGE `visit_exit_idaction_url` `visit_exit_idaction_url` INT( 10 ) UNSIGNED NULL DEFAULT 0'
|
||||
=> false
|
||||
);
|
||||
}
|
||||
|
||||
static function update()
|
||||
{
|
||||
Updater::updateDatabase(__FILE__, self::getSql());
|
||||
|
||||
|
||||
try {
|
||||
\Piwik\Plugin\Manager::getInstance()->activatePlugin('Transitions');
|
||||
} catch (\Exception $e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
57
www/analytics/core/Updates/1.9-b9.php
Executable file
57
www/analytics/core/Updates/1.9-b9.php
Executable file
|
|
@ -0,0 +1,57 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - Open source web analytics
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Piwik\Updates;
|
||||
|
||||
use Piwik\Common;
|
||||
use Piwik\Updater;
|
||||
use Piwik\Updates;
|
||||
|
||||
/**
|
||||
*/
|
||||
class Updates_1_9_b9 extends Updates
|
||||
{
|
||||
static function isMajorUpdate()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
static function getSql()
|
||||
{
|
||||
$logVisit = Common::prefixTable('log_visit');
|
||||
$logConversion = Common::prefixTable('log_conversion');
|
||||
|
||||
$addColumns = "DROP `location_continent`,
|
||||
ADD `location_region` CHAR(2) NULL AFTER `location_country`,
|
||||
ADD `location_city` VARCHAR(255) NULL AFTER `location_region`,
|
||||
ADD `location_latitude` FLOAT(10, 6) NULL AFTER `location_city`,
|
||||
ADD `location_longitude` FLOAT(10, 6) NULL AFTER `location_latitude`";
|
||||
|
||||
return array(
|
||||
// add geoip columns to log_visit
|
||||
"ALTER TABLE `$logVisit` $addColumns" => 1091,
|
||||
|
||||
// add geoip columns to log_conversion
|
||||
"ALTER TABLE `$logConversion` $addColumns" => 1091,
|
||||
);
|
||||
}
|
||||
|
||||
static function update()
|
||||
{
|
||||
try {
|
||||
self::enableMaintenanceMode();
|
||||
Updater::updateDatabase(__FILE__, self::getSql());
|
||||
self::disableMaintenanceMode();
|
||||
} catch (\Exception $e) {
|
||||
self::disableMaintenanceMode();
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
36
www/analytics/core/Updates/1.9.1-b2.php
Normal file
36
www/analytics/core/Updates/1.9.1-b2.php
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - Open source web analytics
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Piwik\Updates;
|
||||
|
||||
use Piwik\Common;
|
||||
use Piwik\Updater;
|
||||
use Piwik\Updates;
|
||||
|
||||
/**
|
||||
*/
|
||||
class Updates_1_9_1_b2 extends Updates
|
||||
{
|
||||
static function getSql()
|
||||
{
|
||||
return array(
|
||||
'ALTER TABLE ' . Common::prefixTable('site') . " DROP `feedburnerName`" => 1091
|
||||
);
|
||||
}
|
||||
|
||||
static function update()
|
||||
{
|
||||
// manually remove ExampleFeedburner column
|
||||
Updater::updateDatabase(__FILE__, self::getSql());
|
||||
|
||||
// remove ExampleFeedburner plugin
|
||||
$pluginToDelete = 'ExampleFeedburner';
|
||||
self::deletePluginFromConfigFile($pluginToDelete);
|
||||
}
|
||||
}
|
||||
31
www/analytics/core/Updates/1.9.3-b10.php
Executable file
31
www/analytics/core/Updates/1.9.3-b10.php
Executable file
|
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - Open source web analytics
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Piwik\Updates;
|
||||
|
||||
use Piwik\Updates;
|
||||
|
||||
/**
|
||||
*/
|
||||
class Updates_1_9_3_b10 extends Updates
|
||||
{
|
||||
static function isMajorUpdate()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
static function update()
|
||||
{
|
||||
try {
|
||||
\Piwik\Plugin\Manager::getInstance()->activatePlugin('Annotations');
|
||||
} catch (\Exception $e) {
|
||||
// pass
|
||||
}
|
||||
}
|
||||
}
|
||||
28
www/analytics/core/Updates/1.9.3-b3.php
Normal file
28
www/analytics/core/Updates/1.9.3-b3.php
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - Open source web analytics
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Piwik\Updates;
|
||||
|
||||
use Piwik\Updates;
|
||||
|
||||
/**
|
||||
*/
|
||||
class Updates_1_9_3_b3 extends Updates
|
||||
{
|
||||
static function update()
|
||||
{
|
||||
// Insight was a temporary code name for Overlay
|
||||
$pluginToDelete = 'Insight';
|
||||
self::deletePluginFromConfigFile($pluginToDelete);
|
||||
\Piwik\Plugin\Manager::getInstance()->deletePluginFromFilesystem($pluginToDelete);
|
||||
|
||||
// We also clean up 1.9.1 and delete Feedburner plugin
|
||||
\Piwik\Plugin\Manager::getInstance()->deletePluginFromFilesystem('Feedburner');
|
||||
}
|
||||
}
|
||||
34
www/analytics/core/Updates/1.9.3-b8.php
Executable file
34
www/analytics/core/Updates/1.9.3-b8.php
Executable file
|
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - Open source web analytics
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Piwik\Updates;
|
||||
|
||||
use Piwik\Common;
|
||||
use Piwik\Updater;
|
||||
use Piwik\Updates;
|
||||
|
||||
/**
|
||||
*/
|
||||
class Updates_1_9_3_b8 extends Updates
|
||||
{
|
||||
static function getSql()
|
||||
{
|
||||
return array(
|
||||
// ignore existing column name error (1060)
|
||||
'ALTER TABLE ' . Common::prefixTable('site')
|
||||
. " ADD COLUMN excluded_user_agents TEXT NOT NULL AFTER excluded_parameters" => 1060,
|
||||
);
|
||||
}
|
||||
|
||||
static function update()
|
||||
{
|
||||
// add excluded_user_agents column to site table
|
||||
Updater::updateDatabase(__FILE__, self::getSql());
|
||||
}
|
||||
}
|
||||
48
www/analytics/core/Updates/2.0-a12.php
Normal file
48
www/analytics/core/Updates/2.0-a12.php
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - Open source web analytics
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
namespace Piwik\Updates;
|
||||
|
||||
use Piwik\Common;
|
||||
use Piwik\Db;
|
||||
use Piwik\Updater;
|
||||
use Piwik\Updates;
|
||||
|
||||
/**
|
||||
*/
|
||||
class Updates_2_0_a12 extends Updates
|
||||
{
|
||||
public static function getSql()
|
||||
{
|
||||
$result = array(
|
||||
'ALTER TABLE ' . Common::prefixTable('logger_message') . ' MODIFY level VARCHAR(16) NULL' => false
|
||||
);
|
||||
|
||||
$unneededLogTables = array('logger_exception', 'logger_error', 'logger_api_call');
|
||||
foreach ($unneededLogTables as $table) {
|
||||
$tableName = Common::prefixTable($table);
|
||||
|
||||
try {
|
||||
$rows = Db::fetchOne("SELECT COUNT(*) FROM $tableName");
|
||||
if ($rows == 0) {
|
||||
$result["DROP TABLE $tableName"] = false;
|
||||
}
|
||||
} catch (\Exception $ex) {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
public static function update()
|
||||
{
|
||||
// change level column in logger_message table to string & remove other logging tables if empty
|
||||
Updater::updateDatabase(__FILE__, self::getSql());
|
||||
}
|
||||
}
|
||||
66
www/analytics/core/Updates/2.0-a13.php
Normal file
66
www/analytics/core/Updates/2.0-a13.php
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - Open source web analytics
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
namespace Piwik\Updates;
|
||||
|
||||
use Piwik\Common;
|
||||
use Piwik\Db;
|
||||
use Piwik\Option;
|
||||
use Piwik\Updater;
|
||||
use Piwik\Updates;
|
||||
|
||||
/**
|
||||
*/
|
||||
class Updates_2_0_a13 extends Updates
|
||||
{
|
||||
public static function getSql()
|
||||
{
|
||||
// Renaming old archived records now that the plugin is called Referrers
|
||||
$sql = array();
|
||||
$tables = \Piwik\DbHelper::getTablesInstalled();
|
||||
foreach ($tables as $tableName) {
|
||||
if (strpos($tableName, 'archive_') !== false) {
|
||||
$sql['UPDATE `' . $tableName . '` SET `name`=REPLACE(`name`, \'Referers_\', \'Referrers_\') WHERE `name` LIKE \'Referers_%\''] = false;
|
||||
}
|
||||
}
|
||||
$errorCodeTableNotFound = '1146';
|
||||
|
||||
// Rename custom segments containing Referers segments
|
||||
$sql['UPDATE `' . Common::prefixTable('segment') . '` SET `definition`=REPLACE(`definition`, \'referer\', \'referrer\') WHERE `definition` LIKE \'%referer%\''] = $errorCodeTableNotFound;
|
||||
|
||||
// Rename Referrers reports within scheduled reports
|
||||
$sql['UPDATE `' . Common::prefixTable('report') . '` SET `reports`=REPLACE(`reports`, \'Referer\', \'Referrer\') WHERE `reports` LIKE \'%Referer%\''] = $errorCodeTableNotFound;
|
||||
|
||||
// Rename Referrers widgets in custom dashboards
|
||||
$sql['UPDATE `' . Common::prefixTable('user_dashboard') . '` SET `layout`=REPLACE(`layout`, \'Referer\', \'Referrer\') WHERE `layout` LIKE \'%Referer%\''] = $errorCodeTableNotFound;
|
||||
|
||||
$sql['UPDATE `' . Common::prefixTable('option') . '` SET `option_name` = \'version_ScheduledReports\' WHERE `option_name` = \'version_PDFReports\' '] = '1062'; // http://forum.piwik.org/read.php?2,106895
|
||||
|
||||
return $sql;
|
||||
}
|
||||
|
||||
public static function update()
|
||||
{
|
||||
// delete schema version_
|
||||
Option::delete('version_Referers');
|
||||
|
||||
Updater::updateDatabase(__FILE__, self::getSql());
|
||||
|
||||
// old plugins deleted in 2.0-a17 update file
|
||||
|
||||
try {
|
||||
\Piwik\Plugin\Manager::getInstance()->activatePlugin('Referrers');
|
||||
} catch (\Exception $e) {
|
||||
}
|
||||
try {
|
||||
\Piwik\Plugin\Manager::getInstance()->activatePlugin('ScheduledReports');
|
||||
} catch (\Exception $e) {
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
42
www/analytics/core/Updates/2.0-a17.php
Normal file
42
www/analytics/core/Updates/2.0-a17.php
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - Open source web analytics
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
namespace Piwik\Updates;
|
||||
|
||||
use Piwik\Db;
|
||||
use Piwik\Filesystem;
|
||||
use Piwik\Updates;
|
||||
|
||||
/**
|
||||
*/
|
||||
class Updates_2_0_a17 extends Updates
|
||||
{
|
||||
public static function update()
|
||||
{
|
||||
$errors = array();
|
||||
|
||||
// Deleting old plugins
|
||||
$obsoleteDirectories = array(
|
||||
PIWIK_INCLUDE_PATH . '/plugins/Referers',
|
||||
PIWIK_INCLUDE_PATH . '/plugins/PDFReports',
|
||||
);
|
||||
foreach ($obsoleteDirectories as $dir) {
|
||||
if (file_exists($dir)) {
|
||||
Filesystem::unlinkRecursive($dir, true);
|
||||
}
|
||||
|
||||
if (file_exists($dir)) {
|
||||
$errors[] = "Please delete this directory manually (eg. using your FTP software): $dir \n";
|
||||
}
|
||||
|
||||
}
|
||||
if(!empty($errors)) {
|
||||
throw new \Exception("Warnings during the update: <br>" . implode("<br>", $errors));
|
||||
}
|
||||
}
|
||||
}
|
||||
37
www/analytics/core/Updates/2.0-a7.php
Normal file
37
www/analytics/core/Updates/2.0-a7.php
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - Open source web analytics
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Piwik\Updates;
|
||||
|
||||
use Piwik\Common;
|
||||
use Piwik\Updater;
|
||||
use Piwik\Updates;
|
||||
|
||||
/**
|
||||
*/
|
||||
class Updates_2_0_a7 extends Updates
|
||||
{
|
||||
static function getSql()
|
||||
{
|
||||
return array(
|
||||
// ignore existing column name error (1060)
|
||||
'ALTER TABLE ' . Common::prefixTable('logger_message')
|
||||
. " ADD COLUMN tag VARCHAR(50) NULL AFTER idlogger_message" => 1060,
|
||||
|
||||
'ALTER TABLE ' . Common::prefixTable('logger_message')
|
||||
. " ADD COLUMN level TINYINT AFTER timestamp" => 1060,
|
||||
);
|
||||
}
|
||||
|
||||
static function update()
|
||||
{
|
||||
// add tag & level columns to logger_message table
|
||||
Updater::updateDatabase(__FILE__, self::getSql());
|
||||
}
|
||||
}
|
||||
23
www/analytics/core/Updates/2.0-b10.php
Normal file
23
www/analytics/core/Updates/2.0-b10.php
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - Open source web analytics
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Piwik\Updates;
|
||||
|
||||
use Piwik\Updates;
|
||||
|
||||
/**
|
||||
*/
|
||||
class Updates_2_0_b10 extends Updates
|
||||
{
|
||||
static function update()
|
||||
{
|
||||
parent::deletePluginFromConfigFile('Referers');
|
||||
parent::deletePluginFromConfigFile('PDFReports');
|
||||
}
|
||||
}
|
||||
42
www/analytics/core/Updates/2.0-b13.php
Normal file
42
www/analytics/core/Updates/2.0-b13.php
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - Open source web analytics
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
namespace Piwik\Updates;
|
||||
|
||||
use Piwik\Filesystem;
|
||||
use Piwik\Updates;
|
||||
|
||||
/**
|
||||
*/
|
||||
class Updates_2_0_b13 extends Updates
|
||||
{
|
||||
public static function update()
|
||||
{
|
||||
$errors = array();
|
||||
|
||||
// Deleting old libs
|
||||
$obsoleteDirectories = array(
|
||||
PIWIK_INCLUDE_PATH . '/libs/Smarty',
|
||||
PIWIK_INCLUDE_PATH . '/libs/Event',
|
||||
);
|
||||
|
||||
foreach ($obsoleteDirectories as $dir) {
|
||||
if (file_exists($dir)) {
|
||||
Filesystem::unlinkRecursive($dir, true);
|
||||
}
|
||||
|
||||
if (file_exists($dir)) {
|
||||
$errors[] = "Please delete this directory manually (eg. using your FTP software): $dir \n";
|
||||
}
|
||||
|
||||
}
|
||||
if(!empty($errors)) {
|
||||
throw new \Exception("Warnings during the update: <br>" . implode("<br>", $errors));
|
||||
}
|
||||
}
|
||||
}
|
||||
46
www/analytics/core/Updates/2.0-b3.php
Normal file
46
www/analytics/core/Updates/2.0-b3.php
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - Open source web analytics
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Piwik\Updates;
|
||||
|
||||
use Piwik\Common;
|
||||
use Piwik\Updater;
|
||||
use Piwik\Updates;
|
||||
|
||||
/**
|
||||
*/
|
||||
class Updates_2_0_b3 extends Updates
|
||||
{
|
||||
static function isMajorUpdate()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
static function getSql()
|
||||
{
|
||||
return array(
|
||||
'ALTER TABLE ' . Common::prefixTable('log_visit')
|
||||
. " ADD COLUMN visit_total_events SMALLINT(5) UNSIGNED NOT NULL AFTER visit_total_searches" => 1060,
|
||||
|
||||
'ALTER TABLE ' . Common::prefixTable('log_link_visit_action')
|
||||
. " ADD COLUMN idaction_event_category INTEGER(10) UNSIGNED AFTER idaction_name_ref,
|
||||
ADD COLUMN idaction_event_action INTEGER(10) UNSIGNED AFTER idaction_event_category" => 1060,
|
||||
);
|
||||
}
|
||||
|
||||
static function update()
|
||||
{
|
||||
Updater::updateDatabase(__FILE__, self::getSql());
|
||||
|
||||
try {
|
||||
\Piwik\Plugin\Manager::getInstance()->activatePlugin('Events');
|
||||
} catch (\Exception $e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
33
www/analytics/core/Updates/2.0-b9.php
Normal file
33
www/analytics/core/Updates/2.0-b9.php
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - Open source web analytics
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Piwik\Updates;
|
||||
|
||||
use Piwik\Common;
|
||||
use Piwik\Site;
|
||||
use Piwik\Updater;
|
||||
use Piwik\Updates;
|
||||
|
||||
/**
|
||||
*/
|
||||
class Updates_2_0_b9 extends Updates
|
||||
{
|
||||
static function getSql()
|
||||
{
|
||||
return array(
|
||||
"ALTER TABLE `" . Common::prefixTable('site')
|
||||
. "` ADD `type` VARCHAR(255) NOT NULL DEFAULT '". Site::DEFAULT_SITE_TYPE ."' AFTER `group` " => 1060,
|
||||
);
|
||||
}
|
||||
|
||||
static function update()
|
||||
{
|
||||
Updater::updateDatabase(__FILE__, self::getSql());
|
||||
}
|
||||
}
|
||||
24
www/analytics/core/Updates/2.0-rc1.php
Normal file
24
www/analytics/core/Updates/2.0-rc1.php
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - Open source web analytics
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
namespace Piwik\Updates;
|
||||
|
||||
use Piwik\Updates;
|
||||
|
||||
/**
|
||||
*/
|
||||
class Updates_2_0_rc1 extends Updates
|
||||
{
|
||||
public static function update()
|
||||
{
|
||||
try {
|
||||
\Piwik\Plugin\Manager::getInstance()->activatePlugin('Morpheus');
|
||||
} catch(\Exception $e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
67
www/analytics/core/Updates/2.0.3-b7.php
Normal file
67
www/analytics/core/Updates/2.0.3-b7.php
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - Open source web analytics
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Piwik\Updates;
|
||||
|
||||
use Piwik\Common;
|
||||
use Piwik\Site;
|
||||
use Piwik\Updater;
|
||||
use Piwik\Updates;
|
||||
use Piwik\Filesystem;
|
||||
|
||||
use Piwik\Plugins\PrivacyManager\DoNotTrackHeaderChecker;
|
||||
use Piwik\Plugins\PrivacyManager\IPAnonymizer;
|
||||
|
||||
/**
|
||||
*/
|
||||
class Updates_2_0_3_b7 extends Updates
|
||||
{
|
||||
static function update()
|
||||
{
|
||||
$errors = array();
|
||||
|
||||
try {
|
||||
// enable DoNotTrack check in PrivacyManager if DoNotTrack plugin was enabled
|
||||
if (\Piwik\Plugin\Manager::getInstance()->isPluginActivated('DoNotTrack')) {
|
||||
DoNotTrackHeaderChecker::activate();
|
||||
}
|
||||
|
||||
// enable IP anonymization if AnonymizeIP plugin was enabled
|
||||
if (\Piwik\Plugin\Manager::getInstance()->isPluginActivated('AnonymizeIP')) {
|
||||
IPAnonymizer::activate();
|
||||
}
|
||||
} catch (\Exception $ex) {
|
||||
// pass
|
||||
}
|
||||
|
||||
// disable & delete old plugins
|
||||
$oldPlugins = array('DoNotTrack', 'AnonymizeIP');
|
||||
foreach ($oldPlugins as $plugin) {
|
||||
try {
|
||||
\Piwik\Plugin\Manager::getInstance()->deactivatePlugin($plugin);
|
||||
} catch(\Exception $e) {
|
||||
|
||||
}
|
||||
|
||||
$dir = PIWIK_INCLUDE_PATH . "/plugins/$plugin";
|
||||
|
||||
if (file_exists($dir)) {
|
||||
Filesystem::unlinkRecursive($dir, true);
|
||||
}
|
||||
|
||||
if (file_exists($dir)) {
|
||||
$errors[] = "Please delete this directory manually (eg. using your FTP software): $dir \n";
|
||||
}
|
||||
|
||||
}
|
||||
if(!empty($errors)) {
|
||||
throw new \Exception("Warnings during the update: <br>" . implode("<br>", $errors));
|
||||
}
|
||||
}
|
||||
}
|
||||
92
www/analytics/core/Updates/2.0.4-b5.php
Normal file
92
www/analytics/core/Updates/2.0.4-b5.php
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - Open source web analytics
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Piwik\Updates;
|
||||
|
||||
use Piwik\Common;
|
||||
use Piwik\Date;
|
||||
use Piwik\Db;
|
||||
use Piwik\Plugins\UsersManager\API as UsersManagerApi;
|
||||
use Piwik\Updater;
|
||||
use Piwik\UpdaterErrorException;
|
||||
use Piwik\Updates;
|
||||
use Piwik\Config;
|
||||
|
||||
/**
|
||||
*/
|
||||
class Updates_2_0_4_b5 extends Updates
|
||||
{
|
||||
static function getSql()
|
||||
{
|
||||
return array(
|
||||
// ignore existing column name error (1060)
|
||||
'ALTER TABLE ' . Common::prefixTable('user')
|
||||
. " ADD COLUMN `superuser_access` tinyint(2) unsigned NOT NULL DEFAULT '0' AFTER token_auth" => 1060,
|
||||
);
|
||||
}
|
||||
|
||||
static function update()
|
||||
{
|
||||
Updater::updateDatabase(__FILE__, self::getSql());
|
||||
|
||||
try {
|
||||
self::migrateConfigSuperUserToDb();
|
||||
} catch (\Exception $e) {
|
||||
throw new UpdaterErrorException($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private static function migrateConfigSuperUserToDb()
|
||||
{
|
||||
$config = Config::getInstance();
|
||||
|
||||
if (!$config->existsLocalConfig()) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
$superUser = $config->superuser;
|
||||
} catch (\Exception $e) {
|
||||
$superUser = null;
|
||||
}
|
||||
|
||||
if (!empty($superUser['bridge']) || empty($superUser)) {
|
||||
// there is a super user which is not from the config but from the bridge, that means we already have
|
||||
// a super user in the database
|
||||
return;
|
||||
}
|
||||
|
||||
$userApi = UsersManagerApi::getInstance();
|
||||
|
||||
try {
|
||||
Db::get()->insert(Common::prefixTable('user'), array(
|
||||
'login' => $superUser['login'],
|
||||
'password' => $superUser['password'],
|
||||
'alias' => $superUser['login'],
|
||||
'email' => $superUser['email'],
|
||||
'token_auth' => $userApi->getTokenAuth($superUser['login'], $superUser['password']),
|
||||
'date_registered' => Date::now()->getDatetime(),
|
||||
'superuser_access' => 1
|
||||
)
|
||||
);
|
||||
} catch(\Exception $e) {
|
||||
echo "There was an issue, but we proceed: " . $e->getMessage();
|
||||
}
|
||||
|
||||
if (array_key_exists('salt', $superUser)) {
|
||||
$salt = $superUser['salt'];
|
||||
} else {
|
||||
$salt = Common::generateUniqId();
|
||||
}
|
||||
|
||||
$config->General['salt'] = $salt;
|
||||
$config->superuser = array();
|
||||
$config->forceSave();
|
||||
}
|
||||
}
|
||||
73
www/analytics/core/Updates/2.0.4-b7.php
Normal file
73
www/analytics/core/Updates/2.0.4-b7.php
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - Open source web analytics
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Piwik\Updates;
|
||||
|
||||
use Piwik\Common;
|
||||
use Piwik\Date;
|
||||
use Piwik\Db;
|
||||
use Piwik\Option;
|
||||
use Piwik\Plugins\UsersManager\API as UsersManagerApi;
|
||||
use Piwik\Plugins\MobileMessaging\MobileMessaging;
|
||||
use Piwik\Updater;
|
||||
use Piwik\Config;
|
||||
use Piwik\UpdaterErrorException;
|
||||
use Piwik\Updates;
|
||||
|
||||
/**
|
||||
*/
|
||||
class Updates_2_0_4_b7 extends Updates
|
||||
{
|
||||
static function getSql()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
static function update()
|
||||
{
|
||||
try {
|
||||
self::migrateExistingMobileMessagingOptions();
|
||||
} catch (\Exception $e) {
|
||||
throw new UpdaterErrorException($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private static function migrateExistingMobileMessagingOptions()
|
||||
{
|
||||
if (Option::get(MobileMessaging::DELEGATED_MANAGEMENT_OPTION) == 'true') {
|
||||
return;
|
||||
}
|
||||
|
||||
// copy $superUserLogin_MobileMessagingSettings -> _MobileMessagingSettings as settings are managed globally
|
||||
|
||||
$optionName = MobileMessaging::USER_SETTINGS_POSTFIX_OPTION;
|
||||
$superUsers = UsersManagerApi::getInstance()->getUsersHavingSuperUserAccess();
|
||||
|
||||
if (empty($superUsers)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$firstSuperUser = array_shift($superUsers);
|
||||
|
||||
if (empty($firstSuperUser)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$superUserLogin = $firstSuperUser['login'];
|
||||
$optionPrefixed = $superUserLogin . $optionName;
|
||||
|
||||
// $superUserLogin_MobileMessagingSettings
|
||||
$value = Option::get($optionPrefixed);
|
||||
|
||||
if (false !== $value) {
|
||||
// _MobileMessagingSettings
|
||||
Option::set($optionName, $value);
|
||||
}
|
||||
}
|
||||
}
|
||||
78
www/analytics/core/Updates/2.0.4-b8.php
Normal file
78
www/analytics/core/Updates/2.0.4-b8.php
Normal file
|
|
@ -0,0 +1,78 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - Open source web analytics
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Piwik\Updates;
|
||||
|
||||
use Piwik\Db;
|
||||
use Piwik\Config;
|
||||
use Piwik\Updates;
|
||||
use Piwik\UpdaterErrorException;
|
||||
use Piwik\Plugins\CoreAdminHome\CustomLogo;
|
||||
use Piwik\Plugins\PrivacyManager\Config as PrivacyManagerConfig;
|
||||
|
||||
/**
|
||||
*/
|
||||
class Updates_2_0_4_b8 extends Updates
|
||||
{
|
||||
static function getSql()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
static function update()
|
||||
{
|
||||
try {
|
||||
$config = Config::getInstance();
|
||||
|
||||
self::migrateBrandingConfig($config);
|
||||
self::migratePrivacyManagerConfig($config, new PrivacyManagerConfig());
|
||||
|
||||
$config->forceSave();
|
||||
|
||||
} catch (\Exception $e) {
|
||||
throw new UpdaterErrorException($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private static function migrateBrandingConfig(Config $config)
|
||||
{
|
||||
$useCustomLogo = self::getValueAndDelete($config, 'branding', 'use_custom_logo');
|
||||
|
||||
$customLogo = new CustomLogo();
|
||||
$useCustomLogo ? $customLogo->enable() : $customLogo->disable();
|
||||
}
|
||||
|
||||
private static function migratePrivacyManagerConfig(Config $oldConfig, PrivacyManagerConfig $newConfig)
|
||||
{
|
||||
$ipVisitEnrichment = self::getValueAndDelete($oldConfig, 'Tracker', 'use_anonymized_ip_for_visit_enrichment');
|
||||
$ipAddressMarkLength = self::getValueAndDelete($oldConfig, 'Tracker', 'ip_address_mask_length');
|
||||
|
||||
if (null !== $ipVisitEnrichment) {
|
||||
$newConfig->useAnonymizedIpForVisitEnrichment = $ipVisitEnrichment;
|
||||
}
|
||||
if (null !== $ipAddressMarkLength) {
|
||||
$newConfig->ipAddressMaskLength = $ipAddressMarkLength;
|
||||
}
|
||||
}
|
||||
|
||||
private static function getValueAndDelete(Config $config, $section, $key)
|
||||
{
|
||||
if (!$config->$section || !array_key_exists($key, $config->$section)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$values = $config->$section;
|
||||
$value = $values[$key];
|
||||
unset($values[$key]);
|
||||
|
||||
$config->$section = $values;
|
||||
|
||||
return $value;
|
||||
}
|
||||
}
|
||||
133
www/analytics/core/Updates/2.1.1-b11.php
Normal file
133
www/analytics/core/Updates/2.1.1-b11.php
Normal file
|
|
@ -0,0 +1,133 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - Open source web analytics
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*/
|
||||
namespace Piwik\Updates;
|
||||
|
||||
use Piwik\Db;
|
||||
use Piwik\Updates;
|
||||
use Piwik\Updater;
|
||||
use Piwik\Date;
|
||||
use Piwik\Segment;
|
||||
use Piwik\ArchiveProcessor\Rules;
|
||||
use Piwik\Db\BatchInsert;
|
||||
use Piwik\DataAccess\ArchiveWriter;
|
||||
use Piwik\Plugins\VisitFrequency\API as VisitFrequencyApi;
|
||||
|
||||
/**
|
||||
*/
|
||||
class Updates_2_1_1_b11 extends Updates
|
||||
{
|
||||
static function update()
|
||||
{
|
||||
$returningMetrics = array(
|
||||
'nb_visits_returning',
|
||||
'nb_actions_returning',
|
||||
'max_actions_returning',
|
||||
'sum_visit_length_returning',
|
||||
'bounce_count_returning',
|
||||
'nb_visits_converted_returning',
|
||||
'nb_uniq_visitors_returning'
|
||||
);
|
||||
|
||||
$now = Date::factory('now')->getDatetime();
|
||||
|
||||
$archiveNumericTables = Db::get()->fetchCol("SHOW TABLES LIKE '%archive_numeric%'");
|
||||
|
||||
// for each numeric archive table, copy *_returning metrics to VisitsSummary metrics w/ the appropriate
|
||||
// returning visit segment
|
||||
foreach ($archiveNumericTables as $table) {
|
||||
// get archives w/ *._returning
|
||||
$sql = "SELECT idarchive, idsite, period, date1, date2
|
||||
FROM $table
|
||||
WHERE name IN ('" . implode("','", $returningMetrics) . "')
|
||||
GROUP BY idarchive";
|
||||
$idArchivesWithReturning = Db::fetchAll($sql);
|
||||
|
||||
// get archives for visitssummary returning visitor segment
|
||||
$sql = "SELECT idarchive, idsite, period, date1, date2
|
||||
FROM $table
|
||||
WHERE name = ?
|
||||
GROUP BY idarchive";
|
||||
$visitSummaryReturningSegmentDone = Rules::getDoneFlagArchiveContainsOnePlugin(
|
||||
new Segment(VisitFrequencyApi::RETURNING_VISITOR_SEGMENT, $idSites = array()), 'VisitsSummary');
|
||||
$idArchivesWithVisitReturningSegment = Db::fetchAll($sql, array($visitSummaryReturningSegmentDone));
|
||||
|
||||
// collect info for new visitssummary archives have to be created to match archives w/ *._returning
|
||||
// metrics
|
||||
$missingIdArchives = array();
|
||||
$idArchiveMappings = array();
|
||||
foreach ($idArchivesWithReturning as $row) {
|
||||
$withMetricsIdArchive = $row['idarchive'];
|
||||
foreach ($idArchivesWithVisitReturningSegment as $segmentRow) {
|
||||
if ($row['idsite'] == $segmentRow['idsite']
|
||||
&& $row['period'] == $segmentRow['period']
|
||||
&& $row['date1'] == $segmentRow['date1']
|
||||
&& $row['date2'] == $segmentRow['date2']
|
||||
) {
|
||||
$idArchiveMappings[$withMetricsIdArchive] = $segmentRow['idarchive'];
|
||||
}
|
||||
}
|
||||
|
||||
if (!isset($idArchiveMappings[$withMetricsIdArchive])) {
|
||||
$missingIdArchives[$withMetricsIdArchive] = $row;
|
||||
}
|
||||
}
|
||||
|
||||
// if there are missing idarchives, fill out new archive row values
|
||||
if (!empty($missingIdArchives)) {
|
||||
$newIdArchiveStart = Db::fetchOne("SELECT MAX(idarchive) FROM $table") + 1;
|
||||
foreach ($missingIdArchives as $withMetricsIdArchive => &$rowToInsert) {
|
||||
$idArchiveMappings[$withMetricsIdArchive] = $newIdArchiveStart;
|
||||
|
||||
$rowToInsert['idarchive'] = $newIdArchiveStart;
|
||||
$rowToInsert['ts_archived'] = $now;
|
||||
$rowToInsert['name'] = $visitSummaryReturningSegmentDone;
|
||||
$rowToInsert['value'] = ArchiveWriter::DONE_OK;
|
||||
|
||||
++$newIdArchiveStart;
|
||||
}
|
||||
|
||||
// add missing archives
|
||||
try {
|
||||
$params = array();
|
||||
foreach ($missingIdArchives as $missingIdArchive) {
|
||||
$params[] = array_values($missingIdArchive);
|
||||
}
|
||||
BatchInsert::tableInsertBatch($table, array_keys(reset($missingIdArchives)), $params, $throwException = false);
|
||||
} catch (\Exception $ex) {
|
||||
Updater::handleQueryError($ex, "<batch insert>", false, __FILE__);
|
||||
}
|
||||
}
|
||||
|
||||
// update idarchive & name columns in rows with *._returning metrics
|
||||
$updateSqlPrefix = "UPDATE $table
|
||||
SET idarchive = CASE idarchive ";
|
||||
$updateSqlSuffix = " END, name = CASE name ";
|
||||
foreach ($returningMetrics as $metric) {
|
||||
$newMetricName = substr($metric, 0, strlen($metric) - strlen(VisitFrequencyApi::COLUMN_SUFFIX));
|
||||
$updateSqlSuffix .= "WHEN '$metric' THEN '" . $newMetricName . "' ";
|
||||
}
|
||||
$updateSqlSuffix .= " END WHERE idarchive IN (%s)
|
||||
AND name IN ('" . implode("','", $returningMetrics) . "')";
|
||||
|
||||
// update only 1000 rows at a time so we don't send too large an SQL query to MySQL
|
||||
foreach (array_chunk($missingIdArchives, 1000, $preserveKeys = true) as $chunk) {
|
||||
$idArchives = array();
|
||||
|
||||
$updateSql = $updateSqlPrefix;
|
||||
foreach ($chunk as $withMetricsIdArchive => $row) {
|
||||
$updateSql .= "WHEN $withMetricsIdArchive THEN {$row['idarchive']} ";
|
||||
|
||||
$idArchives[] = $withMetricsIdArchive;
|
||||
}
|
||||
$updateSql .= sprintf($updateSqlSuffix, implode(',', $idArchives));
|
||||
|
||||
Updater::executeMigrationQuery($updateSql, false, __FILE__);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
27
www/analytics/core/Updates/2.2.0-b15.php
Normal file
27
www/analytics/core/Updates/2.2.0-b15.php
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
<?php
|
||||
/**
|
||||
* Piwik - Open source web analytics
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*/
|
||||
namespace Piwik\Updates;
|
||||
|
||||
use Piwik\Db;
|
||||
use Piwik\Filesystem;
|
||||
use Piwik\Updates;
|
||||
|
||||
/**
|
||||
*/
|
||||
class Updates_2_2_0_b15 extends Updates
|
||||
{
|
||||
static function update()
|
||||
{
|
||||
// This was added in the beta cycle and then removed
|
||||
// if the file is there, it can cause bugs (we don't have an archiver in VisitFrequency anymore)
|
||||
$path = PIWIK_INCLUDE_PATH . '/plugins/VisitFrequency/Archiver.php';
|
||||
if (file_exists($path)) {
|
||||
@unlink($path);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue