Redownload GeoIP data if file size is 0, regardless of file modified time..

This commit is contained in:
Nicholas Hastings 2016-07-24 08:26:00 -04:00
parent 100ddd6724
commit 7008a566a8

View File

@ -58,16 +58,20 @@ close($fh);
my $needNewGeoIP = 1;
if (-e '../GeoIP.dat.gz')
{
my $fileModifiedTime = stat('../GeoIP.dat.gz')->mtime;
my $fileModifiedMonth = localtime($fileModifiedTime)->mon;
my $currentMonth = localtime->mon;
my $thirtyOneDays = 60 * 60 * 24 * 31;
my $stats = stat('../GeoIP.dat.gz');
if ($stats->size != 0)
{
my $fileModifiedTime = $stats->mtime;
my $fileModifiedMonth = localtime($fileModifiedTime)->mon;
my $currentMonth = localtime->mon;
my $thirtyOneDays = 60 * 60 * 24 * 31;
# GeoIP file only updates once per month
if ($currentMonth == $fileModifiedMonth || (time() - $fileModifiedTime) < $thirtyOneDays)
{
$needNewGeoIP = 0;
}
# GeoIP file only updates once per month
if ($currentMonth == $fileModifiedMonth || (time() - $fileModifiedTime) < $thirtyOneDays)
{
$needNewGeoIP = 0;
}
}
}
if ($needNewGeoIP)