Changeset 25573

Show
Ignore:
Timestamp:
10.05.2012 21:32:52 (7 years ago)
Author:
ak19
Message:

Adding in the new activate.pl script to be called at the end of the build process. It moves building to index after first deactivating the collection on the server (if this is running and a persistent server). After the move operation, it then activates the collection on the server again, if the server is still running and is a persistent server.

Location:
main/trunk/greenstone2
Files:
1 added
3 modified

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/bin/script/buildcol.pl

    r25553 r25573  
    238238    'reqd' => "no", 
    239239    'hiddengli' => "yes" }, 
     240      { 'name' => "activate", 
     241    'desc' => "{buildcol.activate}", 
     242    'type' => "flag", 
     243    'reqd' => "no", 
     244    'hiddengli' => "yes" }, 
    240245      ]; 
    241246 
     
    301306    $no_strip_html, $store_metadata_coverage, 
    302307    $no_text, $faillog, $gli, $index, $language, 
    303     $sections_index_document_metadata, $maxnumeric); 
    304  
     308    $sections_index_document_metadata, $maxnumeric, $activate); 
     309     
    305310    my $xml = 0; 
    306311    my $hashParsingResult = {}; 
     
    682687    } 
    683688 
     689    # if buildcol.pl was run with -activate, need to run activate.pl  
     690    # now that building's complete   
     691    if($activate) { 
     692     
     693        #my $quoted_argv = join(" ", map { "\"$_\"" } @ARGV); 
     694         
     695        my @activate_argv = (); 
     696        push(@activate_argv,"-collectdir","$collectdir") if($collectdir); 
     697        push(@activate_argv,"-builddir","$builddir") if($builddir); 
     698        push(@activate_argv,"-site","$site") if($site); 
     699        push(@activate_argv,"-removeold") if($removeold); 
     700        push(@activate_argv,"-keepold") if($keepold); 
     701        my $quoted_argv = join(" ", map { "\"$_\"" } @activate_argv); 
     702         
     703        my $activatecol_cmd = "\"".&util::get_perl_exec()."\" -S activate.pl $quoted_argv \"$collection\""; 
     704         
     705        my $activatecol_status = system($activatecol_cmd)/256; 
     706 
     707        if ($activatecol_status != 0) { 
     708            print STDERR "Error: Failed to run: $activatecol_cmd\n"; 
     709            print STDERR "       $!\n" if ($! ne ""); 
     710            exit(-1); 
     711        } 
     712    } 
     713     
    684714    close OUT if $close_out; 
    685715    close FAILLOG; 
  • main/trunk/greenstone2/bin/script/full-rebuild.pl

    r24747 r25573  
    3232# (assumming import.pl did not end with an error) 
    3333 
     34# The -keepold argument can be passed into this script since this calls activate.pl 
     35# And activate.pl allows the contents of a src dir to be moved into the dest_dir 
     36# without destroying other (uniquely-named) contents of dest_dir. 
    3437 
    3538BEGIN { 
     
    4346 
    4447 
     48# This subroutine has been replaced by a call to activate.pl in sub main 
    4549sub full_replace 
    4650{ 
     
    119123    my @import_argv = (); 
    120124    my @buildcol_argv = (); 
     125    my @activate_argv = (); 
    121126 
    122127    my $site        = undef; 
     
    130135        push(@import_argv,$arg,$site); 
    131136        push(@buildcol_argv,$arg,$site); 
     137        push(@activate_argv,$arg,$site); 
    132138    } 
    133139    elsif ($arg eq "-collectdir") { 
     
    135141        push(@import_argv,$arg,$collect_dir); 
    136142        push(@buildcol_argv,$arg,$collect_dir); 
     143        push(@activate_argv,$arg,$collect_dir); 
    137144    } 
    138145    elsif ($arg eq "-importdir") { 
     
    142149    } 
    143150    elsif ($arg eq "-builddir") { 
    144         # only makes sense in buildcol.pl 
     151        # only makes sense in buildcol.pl and activate.pl 
    145152        $build_dir = shift @argv; 
    146153        push(@buildcol_argv,$arg,$build_dir); 
     154        push(@activate_argv,$arg,$build_dir); 
    147155    } 
    148156    elsif ($arg eq "-indexdir") { 
    149         # only makes sense in buildcol.pl 
     157        # only makes sense in buildcol.pl and activate.pl 
    150158        $index_dir = shift @argv; 
    151159        push(@buildcol_argv,$arg,$index_dir); 
     160        push(@activate_argv,$arg,$index_dir); 
    152161    } 
    153162    else { 
    154163        push(@import_argv,$arg); 
    155164        push(@buildcol_argv,$arg); 
     165        push(@activate_argv,$arg); 
    156166    } 
    157167    } 
     
    160170    my $quoted_import_argv = join(" ", map { "\"$_\"" } @import_argv); 
    161171    my $quoted_buildcol_argv = join(" ", map { "\"$_\"" } @buildcol_argv); 
     172    my $quoted_activate_argv = join(" ", map { "\"$_\"" } @activate_argv); 
    162173     
    163174    my $final_status = 0; 
     
    186197    if ($buildcol_status == 0) { 
    187198 
    188         full_replace($site,$collect_dir,$collect,$build_dir,$index_dir); 
     199        #full_replace($site,$collect_dir,$collect,$build_dir,$index_dir); 
     200        my $activatecol_cmd = $launch_cmd . "activate.pl $quoted_activate_argv \"$collect\""; 
     201        my $activatecol_status = system($activatecol_cmd)/256; 
    189202    } 
    190203    else { 
  • main/trunk/greenstone2/perllib/strings.properties

    r24854 r25573  
    7272 
    7373# -- buildcol.pl -- 
     74 
     75buildcol.activate:Run activate.pl after buildcol has finished, which will move building to index. 
    7476 
    7577buildcol.archivedir:Where the archives live.