"Fossies" - the Fresh Open Source Software Archive

Member "matomo/core/Updates/0.5.php" (3 Aug 2022, 2014 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\Updater;
   14 use Piwik\Updates;
   15 use Piwik\Updater\Migration\Factory as MigrationFactory;
   16 
   17 /**
   18  */
   19 class Updates_0_5 extends Updates
   20 {
   21     /**
   22      * @var MigrationFactory
   23      */
   24     private $migration;
   25 
   26     public function __construct(MigrationFactory $factory)
   27     {
   28         $this->migration = $factory;
   29     }
   30 
   31     public function getMigrations(Updater $updater)
   32     {
   33         $logActionTable = Common::prefixTable('log_action');
   34 
   35         return array(
   36             $this->migration->db->addColumn('log_action', 'hash', 'INTEGER(10) UNSIGNED NOT NULL', 'name'),
   37             $this->migration->db->changeColumn('log_visit', 'visit_exit_idaction', 'visit_exit_idaction_url', 'INTEGER(11) NOT NULL'),
   38             $this->migration->db->changeColumn('log_visit', 'visit_entry_idaction', 'visit_entry_idaction_url', 'INTEGER(11) NOT NULL'),
   39             $this->migration->db->changeColumn('log_link_visit_action', 'idaction_ref', 'idaction_url_ref', 'INTEGER(10) UNSIGNED NOT NULL'),
   40             $this->migration->db->changeColumn('log_link_visit_action', 'idaction', 'idaction_url', 'INTEGER(10) UNSIGNED NOT NULL'),
   41             $this->migration->db->addColumn('log_link_visit_action', 'idaction_name', 'INTEGER(10) UNSIGNED', 'idaction_url_ref'),
   42             $this->migration->db->changeColumn('log_conversion', 'idaction', 'idaction_url', 'INTEGER(11) UNSIGNED NOT NULL'),
   43             $this->migration->db->sql('UPDATE ' . $logActionTable . ' SET `hash` = CRC32(name);'),
   44             $this->migration->db->addIndex('log_action', array('type', 'hash'), 'index_type_hash'),
   45             $this->migration->db->dropIndex('log_action', 'index_type_name'),
   46         );
   47     }
   48 
   49     public function doUpdate(Updater $updater)
   50     {
   51         $updater->executeMigrations(__FILE__, $this->getMigrations($updater));
   52     }
   53 }