Changeset 23183

Show
Ignore:
Timestamp:
20.10.2010 13:30:50 (9 years ago)
Author:
davidb
Message:

With PATH information correctly resolved in gsdlCGI.pm, correct version of incremental-rebuild.pl used.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/cgi-bin/talkback-progressbar.pl

    r23177 r23183  
    1010my $gsdl_tmp_dir; 
    1111 
    12 my $debugging_enabled = 1; # if 1, debugging is enabled and deleting files will not happen 
     12my $debugging_enabled = 0; # if 1, if enabled deleting files will not happen 
    1313 
    1414BEGIN { 
     
    130130    my $fc_filename = get_file_central_filename(); 
    131131 
     132 
    132133    if (open(FCOUT,">$fc_filename")) { 
    133134     
     
    137138 
    138139    close(FCOUT); 
     140 
     141     
     142    # Ensure it can be edited by owner of Greenstone install (if needed) 
     143    chmod(0777,$fc_filename); 
    139144    } 
    140145    else { 
     
    169174    # Useful debug to slow down a 'fast' upload 
    170175    # Sleep for 10 msecs 
    171     # select(undef, undef, undef, 0.01); 
     176    #select(undef, undef, undef, 0.01); 
    172177    #select(undef, undef, undef, 0.1); 
    173178} 
     
    243248    else { 
    244249    # Remove the zip file once we have unzipped it, since it is an intermediate file only 
     250    `chmod -R a+rw $import_dir/HASH*`; 
    245251    unlink($zip_filename) unless $debugging_enabled; 
    246252    } 
    247  
    248 #    print STDOUT "Content-type:text/plain\n\n"; 
    249 #    print STDOUT "cmd = $java_command\n"; 
    250 #    print STDOUT "**** $java_output\n"; 
    251  
    252 } 
    253  
     253} 
     254 
     255 
     256sub rebuild_collection 
     257{ 
     258    my ($collect) = @_; 
     259 
     260    my $bin_script = &util::filename_cat($gsdl_home,"bin","script"); 
     261##    my $inc_rebuild_pl = &util::filename_cat($bin_script,"incremental-rebuild.pl"); 
     262 
     263    my $rebuild_cmd = "perl -S incremental-rebuild.pl \"$collect\""; 
     264 
     265    my $rebuild_output = `$rebuild_cmd 2>&1`; 
     266    my $rebuild_status = $?; 
     267    if ($rebuild_status > 0) { 
     268    my $report = "Perl rebuild failed: $rebuild_cmd\n--\n"; 
     269    $report .= "$rebuild_output\n"; 
     270    $report .= "Exit status: " . ($rebuild_status / 256) . "\n"; 
     271##  $report .= $gsdl_cgi->check_perl_home(); 
     272 
     273#   $report .= "PATH = ". $ENV{'PATH'}. "\n"; 
     274 
     275 
     276    $gsdl_cgi->generate_error($report); 
     277    } 
     278} 
    254279 
    255280sub main {  
     
    295320 
    296321        unzip_archives_doc($gsdl_cgi,$gsdl_home,$collect_home,$collect,$full_filename); 
     322        rebuild_collection($collect); 
    297323        }    
    298324