• Модуль: main
  • Путь к файлу: ~/bitrix/modules/main/lib/service/geoip/geoip2.php
  • Класс: BitrixMainServiceGeoIpGeoIP2
  • Вызов: GeoIP2::initReader
protected function initReader(): Result
{
	$dataResult = new Result();

	if (static::$reader === null)
	{
		if ($this->config['FILE'] == '')
		{
			$dataResult->addError(new Error(Loc::getMessage("geoip_geoip2_no_file")));
			return $dataResult;
		}

		if (!file_exists($this->config['FILE']))
		{
			$dataResult->addError(new Error(Loc::getMessage("geoip_geoip2_file_not_found")));
			return $dataResult;
		}

		try
		{
			static::$reader = new DatabaseReader($this->config['FILE']);
		}
		catch(ReaderInvalidDatabaseException $e)
		{
			$dataResult->addError(new Error(Loc::getMessage("geoip_geoip2_err_reading")));
		}
	}

	return $dataResult;
}