Redownload GeoIP data if file size is 0, regardless of file modified time..
This commit is contained in:
parent
100ddd6724
commit
7008a566a8
@ -58,16 +58,20 @@ 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');
|
||||||
my $fileModifiedMonth = localtime($fileModifiedTime)->mon;
|
if ($stats->size != 0)
|
||||||
my $currentMonth = localtime->mon;
|
{
|
||||||
my $thirtyOneDays = 60 * 60 * 24 * 31;
|
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
|
# GeoIP file only updates once per month
|
||||||
if ($currentMonth == $fileModifiedMonth || (time() - $fileModifiedTime) < $thirtyOneDays)
|
if ($currentMonth == $fileModifiedMonth || (time() - $fileModifiedTime) < $thirtyOneDays)
|
||||||
{
|
{
|
||||||
$needNewGeoIP = 0;
|
$needNewGeoIP = 0;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($needNewGeoIP)
|
if ($needNewGeoIP)
|
||||||
|
Loading…
Reference in New Issue
Block a user