"Fossies" - the Fresh Open Source Software Archive

Member "matomo/core/Updates/1.2.3.php" (3 Aug 2022, 1606 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\Config;
   14 use Piwik\Updater;
   15 use Piwik\Updates;
   16 use Piwik\Updater\Migration\Factory as MigrationFactory;
   17 
   18 /**
   19  */
   20 class Updates_1_2_3 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         $dbName = Config::getInstance()->database['dbname'];
   35 
   36         return array(
   37 
   38             // LOAD DATA INFILE uses the database's charset
   39             $this->migration->db->sql('ALTER DATABASE `' . $dbName . '` DEFAULT CHARACTER SET utf8'),
   40 
   41             // Various performance improvements schema updates
   42             $this->migration->db->sql(
   43                'ALTER TABLE `' . Common::prefixTable('log_visit') . '`
   44                 DROP INDEX index_idsite_datetime_config,
   45                 DROP INDEX index_idsite_idvisit,
   46                 ADD INDEX index_idsite_config_datetime (idsite, config_id, visit_last_action_time),
   47                 ADD INDEX index_idsite_datetime (idsite, visit_last_action_time)',
   48                 array(Updater\Migration\Db::ERROR_CODE_DUPLICATE_KEY, Updater\Migration\Db::ERROR_CODE_COLUMN_NOT_EXISTS)
   49             ),
   50         );
   51     }
   52 
   53     public function doUpdate(Updater $updater)
   54     {
   55         $updater->executeMigrations(__FILE__, $this->getMigrations($updater));
   56     }
   57 }