Piwik\Plugins\UserCountry\LocationProvider\GeoIp\Pecl::isWorking PHP Метод

isWorking() публичный Метод

Returns true if the PECL module that is installed can be successfully used to get the location of an IP address.
public isWorking ( ) : boolean
Результат boolean
    public function isWorking()
    {
        // if no no location database is available, this implementation is not setup correctly
        if (!self::isLocationDatabaseAvailable()) {
            $dbDir = dirname(geoip_db_filename(GEOIP_COUNTRY_EDITION)) . '/';
            $quotedDir = "'{$dbDir}'";
            // check if the directory the PECL module is looking for exists
            if (!is_dir($dbDir)) {
                return Piwik::translate('UserCountry_PeclGeoIPNoDBDir', array($quotedDir, "'geoip.custom_directory'"));
            }
            // check if the user named the city database GeoLiteCity.dat
            if (file_exists($dbDir . 'GeoLiteCity.dat')) {
                return Piwik::translate('UserCountry_PeclGeoLiteError', array($quotedDir, "'GeoLiteCity.dat'", "'GeoIPCity.dat'"));
            }
            return Piwik::translate('UserCountry_CannotFindPeclGeoIPDb', array($quotedDir, "'GeoIP.dat'", "'GeoIPCity.dat'"));
        }
        return parent::isWorking();
    }