| <?php |
|
|
| |
| |
| |
| |
| |
| |
|
|
| namespace Piwik\Updates; |
|
|
| use Piwik\Common; |
| use Piwik\Updater; |
| use Piwik\Updates; |
| use Piwik\Updater\Migration\Factory as MigrationFactory; |
|
|
| class Updates_1_4_rc2 extends Updates |
| { |
| |
| |
| |
| private $migration; |
|
|
| public function __construct(MigrationFactory $factory) |
| { |
| $this->migration = $factory; |
| } |
|
|
| public function getMigrations(Updater $updater) |
| { |
| $errorCodeDbNotExists = Updater\Migration\Db::ERROR_CODE_TABLE_NOT_EXISTS; |
|
|
| return array( |
| $this->migration->db->sql("SET sql_mode=''"), |
| |
| |
| $this->migration->db->sql('ALTER TABLE ' . Common::prefixTable('log_visit') . ' MODIFY location_ip VARBINARY(16) NOT NULL'), |
| $this->migration->db->sql('ALTER TABLE ' . Common::prefixTable('logger_api_call') . ' MODIFY caller_ip VARBINARY(16) NOT NULL', $errorCodeDbNotExists), |
|
|
| |
| |
| $this->migration->db->sql('UPDATE ' . Common::prefixTable('log_visit') . " |
| SET location_ip = UNHEX(LPAD(HEX(CONVERT(location_ip, UNSIGNED)), 8, '0'))"), |
| $this->migration->db->sql('UPDATE ' . Common::prefixTable('logger_api_call') . " |
| SET caller_ip = UNHEX(LPAD(HEX(CONVERT(caller_ip, UNSIGNED)), 8, '0'))", $errorCodeDbNotExists), |
| ); |
| } |
|
|
| public function doUpdate(Updater $updater) |
| { |
| $updater->executeMigrations(__FILE__, $this->getMigrations($updater)); |
| } |
| } |
|
|