From 7008a566a89879a38aeac8e373f2cd2ef7a91a32 Mon Sep 17 00:00:00 2001 From: Nicholas Hastings Date: Sun, 24 Jul 2016 08:26:00 -0400 Subject: [PATCH] Redownload GeoIP data if file size is 0, regardless of file modified time.. --- tools/buildbot/package.pl | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/tools/buildbot/package.pl b/tools/buildbot/package.pl index a8d20c55..aed003b7 100755 --- a/tools/buildbot/package.pl +++ b/tools/buildbot/package.pl @@ -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)