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:
authorfs1 <felix.schuster@gmx.at>2018-08-27 11:58:09 +0300
committerStefan Giehl <stefan@piwik.org>2018-08-27 11:58:09 +0300
commit5c68962eb3ba08e26093a8292f96b81565954fe3 (patch)
treef60f6a18d97e9218853d8ea8a541a713bf24afae /plugins/GeoIp2
parent2b965a7872b38f703e25865f3dac34ba706070ed (diff)
Adds support for continent specific GeoIP2-City databases (#13338)
* add GeoIP2-City-Europe * added all kinds of maxmind city databases * removed GeoLite2-City-Continent database support since this separation is only for GeoIp2 databases available * removed country files from city detection
Diffstat (limited to 'plugins/GeoIp2')
-rw-r--r--plugins/GeoIp2/LocationProvider/GeoIp2.php4
-rw-r--r--plugins/GeoIp2/LocationProvider/GeoIp2/Php.php14
2 files changed, 14 insertions, 4 deletions
diff --git a/plugins/GeoIp2/LocationProvider/GeoIp2.php b/plugins/GeoIp2/LocationProvider/GeoIp2.php
index 7c1c5dfaeb..8a7da913d2 100644
--- a/plugins/GeoIp2/LocationProvider/GeoIp2.php
+++ b/plugins/GeoIp2/LocationProvider/GeoIp2.php
@@ -39,7 +39,7 @@ abstract class GeoIp2 extends LocationProvider
* @var array
*/
public static $dbNames = array(
- 'loc' => array('GeoIP2-City.mmdb', 'GeoIP2-Enterprise.mmdb', 'GeoLite2-City.mmdb', 'GeoIP2-Country.mmdb', 'GeoLite2-Country.mmdb'),
+ 'loc' => array('GeoIP2-City.mmdb', 'GeoIP2-City-Africa.mmdb', 'GeoIP2-City-Asia-Pacific.mmdb', 'GeoIP2-City-Europe.mmdb', 'GeoIP2-City-North-America.mmdb', 'GeoIP2-City-South-America.mmdb', 'GeoIP2-Enterprise.mmdb', 'GeoIP2-Country.mmdb', 'GeoLite2-City.mmdb', 'GeoLite2-Country.mmdb'),
'isp' => array('GeoIP2-ISP.mmdb', 'GeoLite2-ASN.mmdb'),
);
@@ -263,4 +263,4 @@ abstract class GeoIp2 extends LocationProvider
return $ip->toString();
}
-} \ No newline at end of file
+}
diff --git a/plugins/GeoIp2/LocationProvider/GeoIp2/Php.php b/plugins/GeoIp2/LocationProvider/GeoIp2/Php.php
index 53dee81247..90823971ef 100644
--- a/plugins/GeoIp2/LocationProvider/GeoIp2/Php.php
+++ b/plugins/GeoIp2/LocationProvider/GeoIp2/Php.php
@@ -105,6 +105,11 @@ class Php extends GeoIp2
case 'GeoIP2-Enterprise':
case 'GeoLite2-City':
case 'GeoIP2-City':
+ case 'GeoIP2-City-Africa':
+ case 'GeoIP2-City-Asia-Pacific':
+ case 'GeoIP2-City-Europe':
+ case 'GeoIP2-City-North-America':
+ case 'GeoIP2-City-South-America':
if ($reader->metadata()->databaseType === 'GeoIP2-Enterprise') {
$lookupResult = $reader->enterprise($ip);
} else {
@@ -227,8 +232,13 @@ class Php extends GeoIp2
if ($reader) {
switch ($reader->metadata()->databaseType) {
case 'GeoIP2-Enterprise':
- case 'GeoIP2-City':
case 'GeoLite2-City':
+ case 'GeoIP2-City':
+ case 'GeoIP2-City-Africa':
+ case 'GeoIP2-City-Asia-Pacific':
+ case 'GeoIP2-City-Europe':
+ case 'GeoIP2-City-North-America':
+ case 'GeoIP2-City-South-America':
$result[self::REGION_CODE_KEY] = true;
$result[self::REGION_NAME_KEY] = true;
$result[self::CITY_NAME_KEY] = true;
@@ -273,7 +283,7 @@ class Php extends GeoIp2
. '</a>';
$availableDatabaseTypes = array();
- if (self::getPathToGeoIpDatabase(['GeoIP2-Enterprise.mmdb', 'GeoIP2-City.mmdb', 'GeoLite2-City.mmdb']) !== false) {
+ if (self::getPathToGeoIpDatabase(['GeoIP2-City.mmdb', 'GeoIP2-City-Africa.mmdb', 'GeoIP2-City-Asia-Pacific.mmdb', 'GeoIP2-City-Europe.mmdb', 'GeoIP2-City-North-America.mmdb', 'GeoIP2-City-South-America.mmdb', 'GeoIP2-Enterprise.mmdb', 'GeoLite2-City.mmdb']) !== false) {
$availableDatabaseTypes[] = Piwik::translate('UserCountry_City');
}
if (self::getPathToGeoIpDatabase(['GeoIP2-Country.mmdb', 'GeoLite2-Country.mmdb']) !== false) {