migration = $factory; } public function getMigrations(Updater $updater) { $migrations = array(); // invalidations table $migrations[] = $this->migration->db->createTable('archive_invalidations', [ 'idinvalidation' => 'BIGINT UNSIGNED NOT NULL AUTO_INCREMENT', 'idarchive' => 'INTEGER UNSIGNED NULL', 'name' => 'VARCHAR(255) NOT NULL', 'idsite' => 'INTEGER NOT NULL', 'date1' => 'DATE NOT NULL', 'date2' => 'DATE NOT NULL', 'period' => 'TINYINT UNSIGNED NOT NULL', 'ts_invalidated' => 'DATETIME NOT NULL', 'status' => 'TINYINT(1) UNSIGNED DEFAULT 0', ], ['idinvalidation']); $migrations[] = $this->migration->db->addIndex('archive_invalidations', ['idsite', 'date1', 'period'], 'index_idsite_dates_period_name'); return $migrations; } public function doUpdate(Updater $updater) { $updater->executeMigrations(__FILE__, $this->getMigrations($updater)); if ($this->usesGeoIpLegacyLocationProvider()) { // switch to default provider if GeoIp Legacy was still in use LocationProvider::setCurrentProvider(LocationProvider\DefaultProvider::ID); } } protected function usesGeoIpLegacyLocationProvider() { $currentProvider = LocationProvider::getCurrentProviderId(); return in_array($currentProvider, [ 'geoip_pecl', 'geoip_php', 'geoip_serverbased', ]); } }