migration = $factory; } public function getMigrations(Updater $updater) { $migrations = []; $migrations[] = $this->migration->db->changeColumnType('log_action', 'name', 'VARCHAR(4096)'); $migrations[] = $this->migration->db->changeColumnType('log_conversion', 'url', 'VARCHAR(4096)'); $customTrackerPluginActive = false; if (in_array('CustomPiwikJs', Config::getInstance()->Plugins['Plugins'])) { $customTrackerPluginActive = true; } $migrations[] = $this->migration->plugin->activate('BulkTracking'); $migrations[] = $this->migration->plugin->deactivate('CustomPiwikJs'); $migrations[] = $this->migration->plugin->uninstall('CustomPiwikJs'); if ($customTrackerPluginActive) { $migrations[] = $this->migration->plugin->activate('CustomJsTracker'); } if ($this->usesGeoIpLegacyLocationProvider()) { // activate GeoIp2 plugin for users still using GeoIp2 Legacy (others might have it disabled on purpose) $migrations[] = $this->migration->plugin->activate('GeoIp2'); } // remove old options $migrations[] = $this->migration->db->sql('DELETE FROM `' . Common::prefixTable('option') . '` WHERE option_name IN ("geoip.updater_period", "geoip.loc_db_url", "geoip.isp_db_url", "geoip.org_db_url")'); 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', ]); } }