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:
authorStefan Giehl <stefan@matomo.org>2020-10-01 22:32:33 +0300
committerGitHub <noreply@github.com>2020-10-01 22:32:33 +0300
commit13cda22af49f616d1e5967364a041215f864d0c5 (patch)
treebc533dca52be395440958313e81f33d32bb505c0 /plugins/GeoIp2
parente29681e06743e1e7b36db07c06448228bd81bca9 (diff)
Make it possible to use DBIP ASN lite database (#16503)
Diffstat (limited to 'plugins/GeoIp2')
-rw-r--r--plugins/GeoIp2/GeoIP2AutoUpdater.php4
-rw-r--r--plugins/GeoIp2/LocationProvider/GeoIp2.php3
-rw-r--r--plugins/GeoIp2/LocationProvider/GeoIp2/Php.php3
3 files changed, 7 insertions, 3 deletions
diff --git a/plugins/GeoIp2/GeoIP2AutoUpdater.php b/plugins/GeoIp2/GeoIP2AutoUpdater.php
index 8282005c28..f4be4291b2 100644
--- a/plugins/GeoIp2/GeoIP2AutoUpdater.php
+++ b/plugins/GeoIp2/GeoIP2AutoUpdater.php
@@ -747,8 +747,8 @@ class GeoIP2AutoUpdater extends Task
if (self::isDbIpUrl($url)) {
if (preg_match('/(dbip-[a-zA-Z0-9_]+)(?:-lite)?-\d{4}-\d{2}/', $url, $matches)) {
$parts = explode('-', $matches[1]);
- $filename = strtoupper($parts[0]) . '-' . ucfirst($parts[1]) . '.mmdb.' . $ext;
- return $filename;
+ $dbName = $parts[1] === 'asn' ? 'ASN' : ucfirst($parts[1]);
+ return strtoupper($parts[0]) . '-' . $dbName . '.mmdb.' . $ext;
} else {
return basename($url);
}
diff --git a/plugins/GeoIp2/LocationProvider/GeoIp2.php b/plugins/GeoIp2/LocationProvider/GeoIp2.php
index f418c035ef..3a5198aeef 100644
--- a/plugins/GeoIp2/LocationProvider/GeoIp2.php
+++ b/plugins/GeoIp2/LocationProvider/GeoIp2.php
@@ -43,7 +43,8 @@ abstract class GeoIp2 extends LocationProvider
'dbip-city-lite-\d{4}-\d{2}.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',
'dbip-country-lite-\d{4}-\d{2}.mmdb', 'GeoLite2-City.mmdb', 'GeoLite2-Country.mmdb', 'DBIP-Enterprise.mmdb'),
- 'isp' => array('GeoIP2-ISP.mmdb', 'GeoLite2-ASN.mmdb', 'DBIP-ISP.mmdb', 'GeoIP2-Enterprise.mmdb', 'DBIP-Enterprise.mmdb'),
+ 'isp' => array('GeoIP2-ISP.mmdb', 'GeoLite2-ASN.mmdb', 'DBIP-ISP.mmdb', 'GeoIP2-Enterprise.mmdb', 'DBIP-Enterprise.mmdb',
+ 'DBIP-ASN.mmdb', 'dbip-asn-lite-\d{4}-\d{2}.mmdb'),
);
public static function getDbIpLiteUrl($type = 'city')
diff --git a/plugins/GeoIp2/LocationProvider/GeoIp2/Php.php b/plugins/GeoIp2/LocationProvider/GeoIp2/Php.php
index c9367b1a52..739df5f044 100644
--- a/plugins/GeoIp2/LocationProvider/GeoIp2/Php.php
+++ b/plugins/GeoIp2/LocationProvider/GeoIp2/Php.php
@@ -153,6 +153,7 @@ class Php extends GeoIp2
$result[self::ORG_KEY] = $lookupResult->organization;
break;
case 'GeoLite2-ASN':
+ case 'DBIP-ASN-Lite (compat=GeoLite2-ASN)':
$lookupResult = $ispGeoIp->asn($ip);
$result[self::ISP_KEY] = $lookupResult->autonomousSystemOrganization;
$result[self::ORG_KEY] = $lookupResult->autonomousSystemOrganization;
@@ -205,6 +206,8 @@ class Php extends GeoIp2
return 'GeoIP2-Country';
case 'DBIP-ISP (compat=Enterprise)':
return 'DBIP-ISP';
+ case 'DBIP-ASN-Lite (compat=GeoLite2-ASN)':
+ return 'DBIP-ASN';
case 'DBIP-Location-ISP (compat=Enterprise)':
return 'DBIP-Enterprise';
case 'GeoLite2-City':