3.12.0-b1.php
5 years ago
3.12.0-b7.php
5 years ago
4.0.0-b1.php
4 years ago
4.0.0-b3.php
4 years ago
4.0.0-rc3.php
4 years ago
4.0.0-rc4.php
4 years ago
4.0.1-b1.php
4 years ago
4.0.4-b1.php
4 years ago
4.1.2-b1.php
5 years ago
4.1.2-b2.php
4 years ago
4.10.0-b1.php
3 years ago
4.11.0-b1.php
3 years ago
4.11.0-rc2.php
3 years ago
4.12.0-b1.php
3 years ago
4.12.0-b2.php
3 years ago
4.12.0-b3.php
3 years ago
4.12.0-b4.php
3 years ago
4.3.0-b3.php
4 years ago
4.3.0-b4.php
4 years ago
4.3.0-rc2.php
4 years ago
4.4.0-b1.php
4 years ago
4.5.0-b1.php
4 years ago
4.6.0-b1.php
4 years ago
4.6.0-b4.php
4 years ago
4.6.2-rc2.php
4 years ago
4.7.0-b2.php
4 years ago
4.7.1-b1.php
4 years ago
5.0.0-b1.php
4 years ago
4.12.0-b3.php
63 lines
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * Matomo - free/libre analytics platform |
| 5 | * |
| 6 | * @link https://matomo.org |
| 7 | * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later |
| 8 | * |
| 9 | */ |
| 10 | |
| 11 | namespace Piwik\Updates; |
| 12 | |
| 13 | use Piwik\Common; |
| 14 | use Piwik\Db; |
| 15 | use Piwik\Updater; |
| 16 | use Piwik\Updates as PiwikUpdates; |
| 17 | use Piwik\Updater\Migration; |
| 18 | use Piwik\Updater\Migration\Factory as MigrationFactory; |
| 19 | |
| 20 | /** |
| 21 | * Update for version 4.12.0-b3 |
| 22 | */ |
| 23 | class Updates_4_12_0_b3 extends PiwikUpdates |
| 24 | { |
| 25 | /** |
| 26 | * @var MigrationFactory |
| 27 | */ |
| 28 | private $migration; |
| 29 | |
| 30 | public function __construct(MigrationFactory $factory) |
| 31 | { |
| 32 | $this->migration = $factory; |
| 33 | } |
| 34 | |
| 35 | /** |
| 36 | * @param Updater $updater |
| 37 | * |
| 38 | * @return Migration[] |
| 39 | */ |
| 40 | public function getMigrations(Updater $updater) |
| 41 | { |
| 42 | $column = Db::fetchRow('SHOW COLUMNS FROM ' . Common::prefixTable('user') . ' LIKE \'idchange_last_viewed\''); |
| 43 | |
| 44 | if ( |
| 45 | empty($column) |
| 46 | || strpos(strtolower($column['Type']), 'int') !== false |
| 47 | || strpos(strtolower($column['Type']), 'unsigned') !== false |
| 48 | ) { |
| 49 | return []; |
| 50 | } |
| 51 | |
| 52 | $removeValues = $this->migration->db->sql('UPDATE ' . Common::prefixTable('user') . ' SET idchange_last_viewed = NULL'); |
| 53 | $columnUpdate = $this->migration->db->changeColumnType('user', 'idchange_last_viewed', 'INTEGER UNSIGNED'); |
| 54 | |
| 55 | return [$removeValues, $columnUpdate]; |
| 56 | } |
| 57 | |
| 58 | public function doUpdate(Updater $updater) |
| 59 | { |
| 60 | $updater->executeMigrations(__FILE__, $this->getMigrations($updater)); |
| 61 | } |
| 62 | } |
| 63 |