improve check geoip2 database

This commit is contained in:
xiaomlove
2021-06-07 23:08:56 +08:00
parent bec4cc01a0
commit e772b41735

View File

@@ -5017,8 +5017,12 @@ function can_access_torrent($torrent)
function get_ip_location_from_geoip($ip)
{
$database = nexus_env('GEOIP2_DATABASE');
if (empty($database) || !is_readable($database)) {
do_log("no geoip2 database or $database is nor is not readable.");
if (empty($database)) {
do_log("no geoip2 database.");
return false;
}
if (!is_readable($database)) {
do_log("geoip2 database: $database is not readable.");
return false;
}
static $reader;