Browse Source

Download MaxMind GeoIP database: new code for usage with license key

master
parent
commit
38f305080d
  1. 4
      bin/download_dependencies
  2. 12
      bin/download_geoip2
  3. 3
      conf.php-dist

4
bin/download_dependencies

@ -1,5 +1,3 @@
#!/bin/sh
mkdir -p data/GeoIP
cd data/GeoIP
wget -O- http://geolite.maxmind.com/download/geoip/database/GeoLite2-City.tar.gz | tar --strip-components=1 -xvzf -
bin/download_geoip2

12
bin/download_geoip2

@ -0,0 +1,12 @@
#!/usr/bin/php
<?php
require('conf.php');
if (!array_key_exists('GeoLite2-LicenseKey', $config)) {
print "No LicenseKey for MaxMind GeoLite2 database set. Not downloading database.";
exit(0);
}
@mkdir("data/GeoIP");
chdir("data/GeoIP");
system("wget -O- 'https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-City&license_key={$config['GeoLite2-LicenseKey']}&suffix=tar.gz' | tar --strip-components=1 -xvzf -");

3
conf.php-dist

@ -36,6 +36,9 @@ $config['overpassUrl'] = array(
'//api.openstreetmap.fr/oapi/interpreter',
);
// Acquire a license key from https://www.maxmind.com/ and set it here
#$config['GeoLite2-LicenseKey'] = '';
// Location of the initial view if no IP-location can be resolved. 'zoom' is optional.
$config['defaultView'] = array('lat' => 51.505, 'lon' => -0.09, 'zoom' => 18);

Loading…
Cancel
Save