function __construct() { global $BASE; $geoipfile = dirname($BASE) . Config::get('geodatabase'); // DiscoUtils::log('Loading GeoService', false); if (!class_exists('GeoIp2\\Database\\Reader')) { throw new Exception("Not properly loaded GeoIP library through composer.phar."); } if (!file_exists($geoipfile)) { throw new Exception("Cannot find configured GeoIP database :"); } try { if (self::$reader === null) { self::$reader = new GeoIp2\Database\Reader($geoipfile); // 'var/GeoIP2-City.mmdb'); } } catch (Exception $e) { error_log("Error reading geo IP database. [" . $geoipfile . "]"); print_r($e); } }