diff options
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/GeoIp2/LocationProvider/GeoIp2.php | 5 | ||||
-rw-r--r-- | plugins/GeoIp2/config/config.php | 5 | ||||
-rw-r--r-- | plugins/GeoIp2/config/test.php | 5 | ||||
-rw-r--r-- | plugins/GeoIp2/tests/Integration/LocationProviderTest.php | 10 | ||||
-rw-r--r-- | plugins/GeoIp2/tests/System/ConvertRegionCodesToIsoTest.php | 1 | ||||
-rw-r--r-- | plugins/UserCountry/tests/Integration/APITest.php | 1 |
6 files changed, 12 insertions, 15 deletions
diff --git a/plugins/GeoIp2/LocationProvider/GeoIp2.php b/plugins/GeoIp2/LocationProvider/GeoIp2.php index 8a7da913d2..6116b52c66 100644 --- a/plugins/GeoIp2/LocationProvider/GeoIp2.php +++ b/plugins/GeoIp2/LocationProvider/GeoIp2.php @@ -9,6 +9,7 @@ namespace Piwik\Plugins\GeoIp2\LocationProvider; use Exception; +use Piwik\Container\StaticContainer; use Piwik\Option; use Piwik\Piwik; use Piwik\Plugins\UserCountry\LocationProvider; @@ -23,8 +24,6 @@ abstract class GeoIp2 extends LocationProvider const TEST_IP = '194.57.91.215'; const SWITCH_TO_ISO_REGIONS_OPTION_NAME = 'usercountry.switchtoisoregions'; - public static $geoIPDatabaseDir = 'misc'; - /** * Cached region name array. Data is from geoipregionvars.php. * @@ -125,7 +124,7 @@ abstract class GeoIp2 extends LocationProvider */ public static function getPathForGeoIpDatabase($filename) { - return PIWIK_INCLUDE_PATH . '/' . self::$geoIPDatabaseDir . '/' . $filename; + return StaticContainer::get('path.geoip2') . $filename; } /** diff --git a/plugins/GeoIp2/config/config.php b/plugins/GeoIp2/config/config.php new file mode 100644 index 0000000000..54b0797861 --- /dev/null +++ b/plugins/GeoIp2/config/config.php @@ -0,0 +1,5 @@ +<?php + +return [ + 'path.geoip2' => DI\string('{path.root}/misc/'), +];
\ No newline at end of file diff --git a/plugins/GeoIp2/config/test.php b/plugins/GeoIp2/config/test.php new file mode 100644 index 0000000000..c45c66093f --- /dev/null +++ b/plugins/GeoIp2/config/test.php @@ -0,0 +1,5 @@ +<?php + +return [ + 'path.geoip2' => DI\string('{path.root}/tests/lib/geoip-files/'), +];
\ No newline at end of file diff --git a/plugins/GeoIp2/tests/Integration/LocationProviderTest.php b/plugins/GeoIp2/tests/Integration/LocationProviderTest.php index 02150ddc81..a127f91bb3 100644 --- a/plugins/GeoIp2/tests/Integration/LocationProviderTest.php +++ b/plugins/GeoIp2/tests/Integration/LocationProviderTest.php @@ -17,8 +17,6 @@ class LocationProviderTest extends \PHPUnit_Framework_TestCase { public function testGeoIP2City() { - GeoIp2::$geoIPDatabaseDir = 'tests/lib/geoip-files'; - $locationProvider = new GeoIp2\Php(['loc' => ['GeoIP2-City.mmdb'], 'isp' => []]); $result = $locationProvider->getLocation(['ip' => '194.57.91.215']); @@ -38,8 +36,6 @@ class LocationProviderTest extends \PHPUnit_Framework_TestCase public function testGeoIP2Country() { - GeoIp2::$geoIPDatabaseDir = 'tests/lib/geoip-files'; - $locationProvider = new GeoIp2\Php(['loc' => ['GeoIP2-Country.mmdb'], 'isp' => []]); $result = $locationProvider->getLocation(['ip' => '194.57.91.215']); @@ -53,8 +49,6 @@ class LocationProviderTest extends \PHPUnit_Framework_TestCase public function testGeoIP2ASN() { - GeoIp2::$geoIPDatabaseDir = 'tests/lib/geoip-files'; - $locationProvider = new GeoIp2\Php(['loc' => [], 'isp' => ['GeoLite2-ASN.mmdb']]); $result = $locationProvider->getLocation(['ip' => '194.57.91.215']); @@ -66,8 +60,6 @@ class LocationProviderTest extends \PHPUnit_Framework_TestCase public function testGeoIP2ISP() { - GeoIp2::$geoIPDatabaseDir = 'tests/lib/geoip-files'; - $locationProvider = new GeoIp2\Php(['loc' => [], 'isp' => ['GeoIP2-ISP.mmdb']]); $result = $locationProvider->getLocation(['ip' => '194.57.91.215']); @@ -79,8 +71,6 @@ class LocationProviderTest extends \PHPUnit_Framework_TestCase public function testGeoIP2CityAndISP() { - GeoIp2::$geoIPDatabaseDir = 'tests/lib/geoip-files'; - $locationProvider = new GeoIp2\Php(['loc' => ['GeoIP2-City.mmdb'], 'isp' => ['GeoIP2-ISP.mmdb']]); $result = $locationProvider->getLocation(['ip' => '194.57.91.215']); diff --git a/plugins/GeoIp2/tests/System/ConvertRegionCodesToIsoTest.php b/plugins/GeoIp2/tests/System/ConvertRegionCodesToIsoTest.php index ba1909ed1f..66011b030b 100644 --- a/plugins/GeoIp2/tests/System/ConvertRegionCodesToIsoTest.php +++ b/plugins/GeoIp2/tests/System/ConvertRegionCodesToIsoTest.php @@ -38,7 +38,6 @@ class ConvertRegionCodesToIsoTest extends IntegrationTestCase self::$idSite = Fixture::createWebsite('2016-01-01'); Fixture::createSuperUser(true); - GeoIp2::$geoIPDatabaseDir = 'tests/lib/geoip-files'; LocationProvider::$providers = null; LocationProvider::setCurrentProvider('geoip2php'); } diff --git a/plugins/UserCountry/tests/Integration/APITest.php b/plugins/UserCountry/tests/Integration/APITest.php index 689f1e0867..99f8a03973 100644 --- a/plugins/UserCountry/tests/Integration/APITest.php +++ b/plugins/UserCountry/tests/Integration/APITest.php @@ -42,7 +42,6 @@ class APITest extends IntegrationTestCase public function test_setLocationProvider() { - GeoIp2::$geoIPDatabaseDir = 'tests/lib/geoip-files'; $locationProvider = GeoIp2\Php::ID; $this->api->setLocationProvider($locationProvider); $this->assertEquals($locationProvider, Common::getCurrentLocationProviderId()); |