"Fossies" - the Fresh Open Source Software Archive

Member "matomo/core/Updates/0.2.27.php" (3 Aug 2022, 3222 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_27 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->addColumn('log_visit', 'visit_goal_converted', 'TINYINT( 1 ) NOT NULL', 'visit_total_time'),
   36             $this->migration->db->sql('CREATE TABLE `' . Common::prefixTable('goal') . "` (
   37                 `idsite` int(11) NOT NULL,
   38                 `idgoal` int(11) NOT NULL,
   39                 `name` varchar(50) NOT NULL,
   40                 `match_attribute` varchar(20) NOT NULL,
   41                 `pattern` varchar(255) NOT NULL,
   42                 `pattern_type` varchar(10) NOT NULL,
   43                 `case_sensitive` tinyint(4) NOT NULL,
   44                 `revenue` float NOT NULL,
   45                 `deleted` tinyint(4) NOT NULL default '0',
   46                 PRIMARY KEY  (`idsite`,`idgoal`)
   47             )", Updater\Migration\Db::ERROR_CODE_TABLE_EXISTS),
   48 
   49             $this->migration->db->sql('CREATE TABLE `' . Common::prefixTable('log_conversion') . '` (
   50                 `idvisit` int(10) unsigned NOT NULL,
   51                 `idsite` int(10) unsigned NOT NULL,
   52                 `visitor_idcookie` char(32) NOT NULL,
   53                 `server_time` datetime NOT NULL,
   54                 `visit_server_date` date NOT NULL,
   55                 `idaction` int(11) NOT NULL,
   56                 `idlink_va` int(11) NOT NULL,
   57                 `referer_idvisit` int(10) unsigned default NULL,
   58                 `referer_type` int(10) unsigned default NULL,
   59                 `referer_name` varchar(70) default NULL,
   60                 `referer_keyword` varchar(255) default NULL,
   61                 `visitor_returning` tinyint(1) NOT NULL,
   62                 `location_country` char(3) NOT NULL,
   63                 `location_continent` char(3) NOT NULL,
   64                 `url` text NOT NULL,
   65                 `idgoal` int(10) unsigned NOT NULL,
   66                 `revenue` float default NULL,
   67                 PRIMARY KEY  (`idvisit`,`idgoal`),
   68                 KEY `index_idsite_date` (`idsite`,`visit_server_date`)
   69             )', Updater\Migration\Db::ERROR_CODE_TABLE_EXISTS),
   70         );
   71 
   72         $tables = DbHelper::getTablesInstalled();
   73         foreach ($tables as $tableName) {
   74             if (preg_match('/archive_/', $tableName) == 1) {
   75                 $columns = array('idsite','date1','date2','name','ts_archived');
   76                 $tableNameUnprefixed = Common::unprefixTable($tableName);
   77                 $migrations[] = $this->migration->db->addIndex($tableNameUnprefixed, $columns, 'index_all');
   78             }
   79         }
   80 
   81         return $migrations;
   82     }
   83 
   84     public function doUpdate(Updater $updater)
   85     {
   86         $updater->executeMigrations(__FILE__, $this->getMigrations($updater));
   87     }
   88 }