chiark / gitweb /
Do not crash if --upload-yarrg is specified but not --upload-pctb
[ypp-sc-tools.main.git] / yarrg / database-info-fetch
index 2e195c7a01b2d06471b540a3201721a39701aad2..07577260a178a1cac2716bc3e5aef2ef9f06342b 100755 (executable)
@@ -37,7 +37,7 @@ our ($which) = shift @ARGV;
 
 $which =~ s/\W//g;
 
-our ($pctb) = $ENV{'YPPSC_PCTB_PCTB'};
+our ($pctb) = $ENV{'YPPSC_YARRG_PCTB'};
 our ($ua)= LWP::UserAgent->new;
 our $jsonresp;
 
@@ -145,7 +145,7 @@ sub compare_sources_one ($$) {
 sub main__comparesources () {
     my $ocean= get_ocean();
     
-    parse_masters();
+    parse_info_clientside();
     get_arches_islands_pctb($ocean);
     parse_pctb_commodmap() or die;
 
@@ -159,7 +159,7 @@ sub main__comparesources () {
                sub { });
     for_commods(sub {
                    my ($commod)= @_;
-                   my $srcs= $commods{$commod};
+                   my $srcs= $commods{$commod}{Srcs};
                    compare_sources_one($srcs, "commodity $commod");
                });
 }
@@ -167,8 +167,8 @@ sub main__comparesources () {
 sub main__island () {
     my $ocean= get_ocean();
     
-    parse_masters();
-    get_arches_islands_pctb($ocean);
+    parse_info_clientside();
+    get_arches_islands_pctb($ocean) if $pctb;
 
     for_islands($ocean,
                sub {
@@ -184,6 +184,15 @@ sub main__island () {
                });
 }
 
+sub main__timestamp () {
+    my %o;
+    $o{'requesttimestamp'}= '1';
+    my $respcontent= yarrgpostform($ua, \%o);
+    $respcontent =~ m/^OK ([1-9]\d{1,20})\./ or die "$respcontent ?";
+    print "$1\n";
+    exit(0);
+}
+
 sub main__sunshinewidget () {
     print <<END
 Land {On land} {