"Fossies" - the Fresh Open Source Software Archive

Member "matomo/core/Updates/0.2.33.php" (3 Aug 2022, 1603 Bytes) of package /linux/www/matomo-4.11.0.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) PHP source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    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\Common;
   13 use Piwik\DbHelper;
   14 use Piwik\Updater;
   15 use Piwik\Updates;
   16 use Piwik\Updater\Migration\Factory as MigrationFactory;
   17 
   18 /**
   19  */
   20 class Updates_0_2_33 extends Updates
   21 {
   22     /**
   23      * @var MigrationFactory
   24      */
   25     private $migration;
   26 
   27     public function __construct(MigrationFactory $factory)
   28     {
   29         $this->migration = $factory;
   30     }
   31 
   32     public function getMigrations(Updater $updater)
   33     {
   34         $migrations = array(
   35             // 0.2.33 [1020]
   36             $this->migration->db->sql('ALTER TABLE `' . Common::prefixTable('user_dashboard') . '`
   37                 CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci ', Updater\Migration\Db::ERROR_CODE_TABLE_NOT_EXISTS),
   38             $this->migration->db->sql('ALTER TABLE `' . Common::prefixTable('user_language') . '`
   39                 CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci ', Updater\Migration\Db::ERROR_CODE_TABLE_NOT_EXISTS),
   40         );
   41 
   42         // alter table to set the utf8 collation
   43         $tablesToAlter = DbHelper::getTablesInstalled(true);
   44         foreach ($tablesToAlter as $table) {
   45             $migrations[] = $this->migration->db->sql('ALTER TABLE `' . $table . '` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci');
   46         }
   47 
   48         return $migrations;
   49     }
   50 
   51     public function doUpdate(Updater $updater)
   52     {
   53         $updater->executeMigrations(__FILE__, $this->getMigrations($updater));
   54     }
   55 }