"Fossies" - the Fresh Open Source Software Archive

Member "matomo/core/Updates/0.5.5.php" (3 Aug 2022, 1660 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_5_5 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             $this->migration->db->dropIndex('log_visit', 'index_idsite_date'),
   36             $this->migration->db->addIndex('log_visit', array('idsite', 'visit_server_date', 'config_md5config(8)'), 'index_idsite_date_config'),
   37         );
   38 
   39         $tables = DbHelper::getTablesInstalled();
   40         foreach ($tables as $tableName) {
   41             $unprefixedTable = Common::unprefixTable($tableName);
   42             if (preg_match('/archive_/', $tableName) == 1) {
   43                 $migrations[] = $this->migration->db->dropIndex($unprefixedTable, 'index_all');
   44             }
   45             if (preg_match('/archive_numeric_/', $tableName) == 1) {
   46                 $columns = array('idsite', 'date1', 'date2', 'period');
   47                 $migrations[] = $this->migration->db->addIndex($unprefixedTable, $columns, 'index_idsite_dates_period');
   48             }
   49         }
   50 
   51         return $migrations;
   52     }
   53 
   54     public function doUpdate(Updater $updater)
   55     {
   56         $updater->executeMigrations(__FILE__, $this->getMigrations($updater));
   57     }
   58 }