Changeset 23946

Show
Ignore:
Timestamp:
21.04.2011 21:06:54 (9 years ago)
Author:
ak19
Message:

Xiaofeng found that the OAI-related changes to do with earliestDatestamp were causing problems for him when a die statement got executed. It just prints a warning now.

Location:
main/trunk/greenstone2/perllib
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/perllib/basebuilder.pm

    r23939 r23946  
    565565    if(!-d $archivedir) { 
    566566    $archivedir = &util::filename_cat ($ENV{'GSDLCOLLECTDIR'}, "export"); 
    567     }     
    568     if(-d $archivedir) { 
    569     my $earliestDatestampFile = &util::filename_cat ($archivedir, "earliestDatestamp"); 
    570     open(FIN,"<$earliestDatestampFile") || die "{common.cannot_open} $earliestDatestampFile: $!\n"; 
    571     my $earliestDatestamp; 
     567    } 
     568    my $earliestDatestampFile = &util::filename_cat ($archivedir, "earliestDatestamp"); 
     569    my $earliestDatestamp = 0; 
     570    if (open(FIN,"<$earliestDatestampFile")) { 
    572571    { 
    573572        # slurp in file as a single line 
     
    576575        #&unicode::ensure_utf8(\$earliestDatestamp); # turn any high bytes that aren't valid utf-8 into utf-8. 
    577576    } 
    578     close(FIN);  
    579     $build_cfg->{'earliestDatestamp'} = $earliestDatestamp; 
    580     } 
    581  
     577    close(FIN); 
     578    } 
     579    else { 
     580    print $outhandle "Warning: unable to read collection's earliestDatestamp from $earliestDatestampFile.\n"; 
     581    print $outhandle "Setting value to 0.\n"; 
     582    } 
     583    $build_cfg->{'earliestDatestamp'} = $earliestDatestamp; 
     584     
    582585    $self->build_cfg_extra($build_cfg); 
    583586 
  • main/trunk/greenstone2/perllib/inexport.pm

    r23943 r23946  
    718718    if (!-f $earliestDatestampFile && -d $archivedir) { 
    719719    my $current_time_in_seconds = time; # in seconds 
    720     open(FOUT, ">$earliestDatestampFile") ||  
    721         (&gsprintf(STDERR, "{common.cannot_open}: $!\n", $earliestDatestampFile) && die); 
    722     # die "{common.cannot_open} $earliestDatestampFile: $!\n"; 
    723     print FOUT $current_time_in_seconds; 
    724     close(FOUT); 
     720 
     721    if(open(FOUT, ">$earliestDatestampFile")) { 
     722        # || (&gsprintf(STDERR, "{common.cannot_open}: $!\n", $earliestDatestampFile) && die); 
     723        print FOUT $current_time_in_seconds; 
     724        close(FOUT); 
     725    } 
     726    else { 
     727        &gsprintf(STDERR, "{import.cannot_write_earliestdatestamp}\n", $earliestDatestampFile); 
     728    } 
     729 
    725730    } 
    726731 
     
    886891        $doc::OIDcount = $OIDcount;      
    887892    } 
    888     else { 
    889          
    890         print STDERR "Warning: unable to read document OID count from $oid_count_filename\n"; 
    891         print STDERR "Setting value to 0\n"; 
     893    else {       
     894        &gsprintf(STDERR, "{import.cannot_read_OIDcount}\n", $oid_count_filename); 
    892895    } 
    893896    } 
     
    910913    } 
    911914    else { 
    912     print STDERR "Warning: unable to store document OID count\n"; 
     915    &gsprintf(STDERR, "{import.cannot_write_OIDcount}\n", $oid_count_filename); 
    913916    } 
    914917} 
  • main/trunk/greenstone2/perllib/strings.properties

    r23826 r23946  
    236236import.cannot_open_fail_log:ERROR: Couldn't open fail log %s 
    237237 
     238import.cannot_read_OIDcount:Warning: unable to read document OID count from %s.\nSetting value to 0. 
     239 
     240#import.cannot_read_earliestdatestamp:Warning: unable to read collection's earliestDatestampcount from %s.\nSetting value to 0. 
     241 
    238242import.cannot_sort:WARNING: import.pl cannot sort documents when groupsize > 1. sortmeta option will be ignored. 
     243 
     244import.cannot_write_earliestdatestamp:Warning: unable to store collection's earliestDatestamp in %s. 
     245 
     246import.cannot_write_OIDcount:Warning: unable to store document OID count in %s. 
    239247 
    240248import.collectdir:The path of the "collect" directory.