Changeset 2774 for trunk/gsdl


Ignore:
Timestamp:
2001-10-02T22:36:37+12:00 (23 years ago)
Author:
sjboddie
Message:

Tidied up the collector's error handling. Hopefully the situation where the
status page loops continuously after an error will now be rare (it can
still happen if perl or one of the third party converters hangs though)

Location:
trunk/gsdl
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/bin/script/build

    r2566 r2774  
    464464}
    465465
    466 # creates a file called $outfile.final (should only be called if -out option
    467 # is used and isn't STDERR or STDOUT) and writes an output code to it.
     466# creates a file called $outfile.final and writes an output code to it.
    468467# An output code of 0 specifies that there was no error
    469468sub final_out {
    470469    my ($exit_code) = @_;
    471470
    472     if (open (FINAL, ">$outfile.final")) {
    473     print FINAL $exit_code;
    474     close FINAL;
     471    if ($use_out && (!-e "$outfile.final")) {
     472
     473    if (open (FINAL, ">$outfile.final")) {
     474        print FINAL $exit_code;
     475        close FINAL;
     476    }
    475477    }
    476478}
     
    578580    }
    579581
     582    # this will produce a .final file if one doesn't exist yet - that
     583    # should only happen if there's been an error somewhere in the perl
     584    # code
     585    &final_out(7);
     586
    580587    sub recursive_chmod {
    581588    my ($dir) = @_;
  • trunk/gsdl/macros/collect.dm

    r2728 r2774  
    904904<table width=_pagewidth_>
    905905<tr><td>
    906 <p>An error has occurred while attempting to build your collection.
    907 <br> The build log contains the following:
    908 <p>_faillog_
    909 
     906_textfailmsg_
     907</td></tr>
     908</table></center>
     909}
     910
     911# _textfailmsg_ will be set to one of the following macros from within
     912# the server
     913
     914_textfailmsg1_ {
     915The collection could not be built as it contains no data. Make sure that at
     916least one of the directories or files you specified on the <i>source
     917data</i> page exists and is of a type or (in the case of a directory)
     918contains files of a type, that Greenstone can process.
    910919<p><center>
    911920_collectorbar_
    912921</center>
    913 
    914 </td></tr>
    915 </table></center>
    916 }
    917 
     922}
     923
     924_textfailmsg6_ {_textfailmsg1_}
     925
     926_textfailmsg2_ {
     927The collection could not be built (import.pl failed).
     928<p>the build log contains the following information:
     929<p>_faillog_
     930<p>Please <a href="_httppagecollector_" target=_top>restart the collector</a> and try
     931again.
     932}
     933
     934_textfailmsg3_ {
     935The collection could not be built (buildcol.pl failed).
     936<p>the build log contains the following information:
     937<p>_faillog_
     938<p>Please <a href="_httppagecollector_" target=_top>restart the collector</a> and try
     939again.
     940}
     941
     942_textfailmsg4_ {
     943The collection was built successfully but could not be installed.
     944<p>the build log contains the following information:
     945<p>_faillog_
     946}
     947
     948_textfailmsg5_ {_textfailmsg4_}
     949
     950_textfailmsg7_ {
     951An unexpected error occurred while attepting to build your collection
     952<p>Please <a href="_httppagecollector_" target=_top>restart the collector</a> and try
     953again.
     954}
    918955
    919956#######################################################################
     
    10511088}
    10521089
    1053 _installfailcontent_ {
    1054 _messagehead_
    1055 <p>
    1056 
    1057 The collector failed to install your new collection correctly.
    1058 Possible causes are:
    1059 <ul>
    1060 <li> Greenstone does not have permission to write to the _gsdlhome_/collect
    1061      directory.
    1062 <li> A _cgiargbc1dirname_ collection already exists in the _gsdlhome_/collect
    1063      directory.
    1064 </ul>
    1065 _messagefoot_
    1066 }
    1067 
    10681090_exptsuccesscontent_ {
    10691091_messagehead_
  • trunk/gsdl/src/recpt/collectoraction.cpp

    r2727 r2774  
    457457      ifstream fbld_in (fbldc);
    458458      if (fbld_in) {
    459     char c = fbld_in.get();
     459    failcode = fbld_in.get();
    460460    fbld_in.close();
    461     if (c == '0') {
     461    if (failcode == '0') {
    462462      // success - we need to create and configure a collection server for the
    463463      // newly built collection (for fastcgi and local library where
     
    467467      current_page = "bilddone";
    468468    }
    469     else if (c == '4' || c == '5') message = "installfail";
    470469    else current_page = "bildfail";
    471470      } else {
     
    10271026  // _statusline_ -- if displaying the bildstatus page
    10281027  // _header_ -- may be set for pages that require it
     1028  // _textfailmsg_ -- set to different messages depending on failcode returned
     1029  //                  by build script (if build fails)
    10291030  // _faillog_ - set to last 6 lines of .bld file if build failed
    10301031  // _gsdlhome_ - the gsdlhome path (dm_safe)
     
    11551156
    11561157  if (collector_page == "bildfail") {
     1158
     1159    text_t textfailmsg = "_textfailmsg";
     1160    textfailmsg.push_back(failcode);
     1161    textfailmsg.push_back('_');
     1162    disp.setmacro("textfailmsg", "collector", textfailmsg);
     1163
    11571164    text_t bldlog = filename_cat(gsdlhome, "tmp", args["bc1tmp"], args["bc1dirname"] + ".bld");
    11581165    text_t rawlog = file_tail (bldlog, 6, 0);
  • trunk/gsdl/src/recpt/collectoraction.h

    r2627 r2774  
    4242
    4343  text_t message;
     44  char failcode;
    4445
    4546  bool do_mkcol;
Note: See TracChangeset for help on using the changeset viewer.