Change mirror script to use "up to date" or "out of date" to represent the age of the files in the mirror.
Andrew Lewman

Andrew Lewman commited on 2009-03-02 04:43:10
Zeige 1 geänderte Dateien mit 8 Einfügungen und 2 Löschungen.

... ...
@@ -16,7 +16,7 @@ use Date::Format;
16 16
 print "Creating LWP agent ($LWP::VERSION)...\n";
17 17
 my $lua = LWP::UserAgent->new(
18 18
     keep_alive => 1,
19
-    timeout => 15,
19
+    timeout => 1,
20 20
     agent => "Tor MirrorCheck Agent"
21 21
 );
22 22
 
... ...
@@ -620,6 +620,10 @@ my $count = values %m;
620 620
 print "We have a total of $count mirrors\n";
621 621
 print "Fetching the last updated date for each mirror.\n";
622 622
 
623
+my $tortime;
624
+$tortime = FetchDate("http://www.torproject.org/");
625
+print "The official time for Tor is $tortime. \n";
626
+
623 627
 foreach my $server ( keys %m ) {
624 628
 
625 629
     print "Attempting to fetch from $m{$server}{'orgName'}\n";
... ...
@@ -664,8 +668,10 @@ foreach my $server ( sort { $m{$b}{'updateDate'} <=> $m{$a}{'updateDate'}} keys
664 668
 
665 669
      my $time;
666 670
      if( "$m{$server}{'updateDate'}" ne "Unknown") {
667
-        $time = ctime($m{$server}{'updateDate'});
671
+	if( "$m{$server}{'updateDate'}" eq "$tortime" ) {
672
+	$time = "Up to date";
668 673
         chomp($time);
674
+	} else { $time = "Out of date"; }
669 675
      } else { $time = "Unknown"; }
670 676
 print OUT <<"END";
671 677
      \n<tr>\n
672 678