3.12.0-b1.php
5 years ago
3.12.0-b7.php
5 years ago
4.0.0-b1.php
5 years ago
4.1.2-b1.php
5 years ago
4.1.2-b2.php
5 years ago
4.3.0-b3.php
5 years ago
4.3.0-b4.php
5 years ago
4.3.0-rc2.php
5 years ago
4.3.0-b4.php
54 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Matomo - free/libre analytics platform |
| 4 | * |
| 5 | * @link https://matomo.org |
| 6 | * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later |
| 7 | * |
| 8 | */ |
| 9 | |
| 10 | namespace Piwik\Updates; |
| 11 | |
| 12 | use Piwik\Updater; |
| 13 | use Piwik\Updates as PiwikUpdates; |
| 14 | use Piwik\Updater\Migration; |
| 15 | use Piwik\Updater\Migration\Factory as MigrationFactory; |
| 16 | use Piwik\Db; |
| 17 | use Piwik\Common; |
| 18 | |
| 19 | /** |
| 20 | * Update for version 4.3.0-b4. |
| 21 | */ |
| 22 | class Updates_4_3_0_b4 extends PiwikUpdates |
| 23 | { |
| 24 | /** |
| 25 | * @var MigrationFactory |
| 26 | */ |
| 27 | private $migration; |
| 28 | |
| 29 | public function __construct(MigrationFactory $factory) |
| 30 | { |
| 31 | $this->migration = $factory; |
| 32 | } |
| 33 | |
| 34 | public function getMigrations(Updater $updater) |
| 35 | { |
| 36 | $migrations = []; |
| 37 | |
| 38 | $segmentTable = Common::prefixTable('segment'); |
| 39 | $segments = Db::fetchAll("SELECT * FROM $segmentTable"); |
| 40 | foreach ($segments as $segment) { |
| 41 | if (empty($segment['hash'])) { |
| 42 | $hash = md5(urldecode($segment['definition'])); |
| 43 | $migrations[] = $this->migration->db->sql("UPDATE `$segmentTable` SET `hash` = '$hash' WHERE `idsegment` = '{$segment['idsegment']}'"); |
| 44 | } |
| 45 | } |
| 46 | return $migrations; |
| 47 | } |
| 48 | |
| 49 | public function doUpdate(Updater $updater) |
| 50 | { |
| 51 | $updater->executeMigrations(__FILE__, $this->getMigrations($updater)); |
| 52 | } |
| 53 | } |
| 54 |