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,7 +58,10 @@ close($fh);
my $needNewGeoIP = 1; my $needNewGeoIP = 1;
if (-e '../GeoIP.dat.gz') if (-e '../GeoIP.dat.gz')
{ {
my $fileModifiedTime = stat('../GeoIP.dat.gz')->mtime; my $stats = stat('../GeoIP.dat.gz');
if ($stats->size != 0)
{
my $fileModifiedTime = $stats->mtime;
my $fileModifiedMonth = localtime($fileModifiedTime)->mon; my $fileModifiedMonth = localtime($fileModifiedTime)->mon;
my $currentMonth = localtime->mon; my $currentMonth = localtime->mon;
my $thirtyOneDays = 60 * 60 * 24 * 31; my $thirtyOneDays = 60 * 60 * 24 * 31;
@ -69,6 +72,7 @@ if (-e '../GeoIP.dat.gz')
$needNewGeoIP = 0; $needNewGeoIP = 0;
} }
} }
}
if ($needNewGeoIP) if ($needNewGeoIP)
{ {