From: Michael Andreen Date: Wed, 28 Jan 2009 22:30:41 +0000 (+0100) Subject: Don't parse a groupscan if we can't fetch it X-Git-Url: https://ruin.nu/git/?a=commitdiff_plain;h=c8c6f7aeb53d8f00aebb936ee8efb96434e7f5e4;hp=a0b5f22aa2061ef8e850d3ea04e2c68b0226cd8e;p=ndwebbie.git Don't parse a groupscan if we can't fetch it --- diff --git a/scripts/scans.pl b/scripts/scans.pl index 4f098c0..6bfdb8e 100755 --- a/scripts/scans.pl +++ b/scripts/scans.pl @@ -55,15 +55,17 @@ while (my $group = $scangroups->fetchrow_hashref){ $dbh->begin_work; my $file = get("http://game.planetarion.com/showscan.pl?scan_grp=$group->{scan_id}"); - my $points = 0; - while ($file =~ m/showscan.pl\?scan_id=(\w+)/g){ - unless ($dbh->selectrow_array($oldscan,undef,$1)){ - $addScan->execute($1,$group->{tick},$group->{uid}); - ++$points; + if ($file){ + my $points = 0; + while ($file =~ m/showscan.pl\?scan_id=(\w+)/g){ + unless ($dbh->selectrow_array($oldscan,undef,$1)){ + $addScan->execute($1,$group->{tick},$group->{uid}); + ++$points; + } } + $addpoints->execute($points,$group->{uid}); + $parsedscan->execute($group->{tick},'GROUP',undef,$group->{id}); } - $addpoints->execute($points,$group->{uid}); - $parsedscan->execute($group->{tick},'GROUP',undef,$group->{id}); $dbh->commit; }