Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'core/Updates/4.0.0-b1.php')
-rw-r--r--core/Updates/4.0.0-b1.php26
1 files changed, 26 insertions, 0 deletions
diff --git a/core/Updates/4.0.0-b1.php b/core/Updates/4.0.0-b1.php
index 1405911a53..d1ea9f9602 100644
--- a/core/Updates/4.0.0-b1.php
+++ b/core/Updates/4.0.0-b1.php
@@ -9,7 +9,9 @@
namespace Piwik\Updates;
+use Piwik\Common;
use Piwik\Config;
+use Piwik\Plugins\UserCountry\LocationProvider;
use Piwik\Updater;
use Piwik\Updates as PiwikUpdates;
use Piwik\Updater\Migration\Factory as MigrationFactory;
@@ -48,11 +50,35 @@ class Updates_4_0_0_b1 extends PiwikUpdates
$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',
+ ]);
}
}