update Piwik to version 2.16 (fixes #91)

This commit is contained in:
oliver 2016-04-10 18:55:57 +02:00
commit d885a4baa9
5833 changed files with 418860 additions and 226988 deletions

View file

@ -1,6 +1,6 @@
<?php
/**
* Piwik - Open source web analytics
* Piwik - free/libre analytics platform
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
@ -17,28 +17,28 @@ use Piwik\Updates;
*/
class Updates_1_4_rc2 extends Updates
{
static function getSql()
public function getMigrationQueries(Updater $updater)
{
return array(
"SET sql_mode=''" => false,
"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,
MODIFY caller_ip VARBINARY(16) NOT NULL' => 1146,
// 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,
SET caller_ip = UNHEX(LPAD(HEX(CONVERT(caller_ip, UNSIGNED)), 8, '0'))" => 1146,
);
}
static function update()
public function doUpdate(Updater $updater)
{
Updater::updateDatabase(__FILE__, self::getSql());
$updater->executeMigrationQueries(__FILE__, $this->getMigrationQueries($updater));
}
}