Ignore:
Timestamp:
2016-05-09T22:38:09+12:00 (8 years ago)
Author:
ak19
Message:

Refactoring activate.pl into activate.pm (class, OOP) and activate.pl. Now buildcolutils.pm uses do_deactivate() from activate.pm.

Location:
main/trunk/greenstone2/perllib
Files:
1 added
2 edited

Legend:

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

    r30518 r30520  
    3333use File::Basename;
    3434
     35use activate;
    3536use colcfg;
    3637use dbutil;
     
    685686   
    686687        if(!$dbSupportsConcurrentRW) {
    687         #$self->{'justdeactivate'} = 1;
    688         #$self->activate_collection();
    689         #$self->{'justdeactivate'} = 0;
    690         $self->activate_collection("just_deactivate");     
     688        # all except the collection (1st parameter) can be empty. For GS3, also set the site parameter
     689        my $gsserver = new activate( $self->get_collection(), $self->{'site'}, $self->{'verbosity'}, $self->{'builddir'}, $self->{'indexdir'}, $self->{'collectdir'}, $self->{'library_url'}, $self->{'library_name'});
     690        $gsserver->print_task_msg("About to deactivate collection ".$self->get_collection());
     691        #$self->{'library_url'} = $gsserver->get_library_URL();
     692        $gsserver->do_deactivate();     
    691693        }
    692694        $_->make_infodatabase();       
     
    718720   
    719721        if(!$dbSupportsConcurrentRW) {
    720         $self->activate_collection("just_deactivate");     
     722        # all except the collection (1st parameter) can be empty. For GS3, also set the site parameter
     723        my $gsserver = new activate( $self->get_collection(), $self->{'site'}, $self->{'verbosity'}, $self->{'builddir'}, $self->{'indexdir'}, $self->{'collectdir'}, $self->{'library_url'}, $self->{'library_name'});
     724        $gsserver->print_task_msg("About to deactivate collection ".$self->get_collection());
     725        #$self->{'library_url'} = $gsserver->get_library_URL();
     726        $gsserver->do_deactivate();
    721727        }
    722728        $_->make_infodatabase();
     
    794800sub activate_collection
    795801{
    796   my $self = shift(@_); 
    797   my $activation_cmd = shift(@_);
    798   my($just_activate, $just_deactivate);
    799   if(defined $activation_cmd) {
    800       $just_deactivate = 1 if($activation_cmd eq "just_deactivate");
    801       $just_activate = 1 if($activation_cmd eq "just_activate");
    802       if($activation_cmd eq "just_deactivate_and_activate") {
    803       $just_deactivate = 1;
    804       $just_activate = 1;
    805       }
    806   }
     802  my $self = shift(@_);
    807803
    808804  # if buildcol.pl was run with -activate, need to run activate.pl
     
    812808    #my $quoted_argv = join(" ", map { "\"$_\"" } @ARGV);
    813809    my @activate_argv = ();
     810    push(@activate_argv, '-library_url', $self->{'library_url'}) if ($self->{'library_url'});
     811    push(@activate_argv, '-library_name', $self->{'library_name'}) if ($self->{'library_name'});
    814812    push(@activate_argv, '-collectdir', $self->{'collectdir'}) if ($self->{'collectdir'});
    815813    push(@activate_argv, '-builddir', $self->{'builddir'}) if ($self->{'builddir'});
     814    push(@activate_argv, '-indexdir', $self->{'indexdir'}) if ($self->{'indexdir'});
    816815    push(@activate_argv, '-site', $self->{'site'}) if ($self->{'site'});
    817816    push(@activate_argv, '-verbosity', $self->{'verbosity'}) if ($self->{'verbosity'});
     
    819818    push(@activate_argv, '-keepold') if ($self->{'keepold'});
    820819    push(@activate_argv, '-incremental') if ($self->{'incremental'});
    821     push(@activate_argv, '-justactivate') if ($just_activate || $self->{'justactivate'});
    822     push(@activate_argv, '-justdeactivate') if ($just_deactivate || $self->{'justdeactivate'});
     820    push(@activate_argv, '-skipactivation', $self->{'skipactivation'}) if ($self->{'skipactivation'});
     821
    823822    my $quoted_argv = join(' ', map { "\"$_\"" } @activate_argv);
    824823    my $activatecol_cmd = '"' . &util::get_perl_exec(). '" -S activate.pl ' . $quoted_argv . ' "' . $self->get_collection() . '"';
  • main/trunk/greenstone2/perllib/downloaders/WgetDownload.pm

    r28560 r30520  
    246246    #print STDOUT "Command is: $command\n";
    247247
    248     # Wget's output needs to be monitored to find out when it has naturally termianted.
     248    # Wget's output needs to be monitored to find out when it has naturally terminated.
    249249    # Wget's output is sent to its STDERR so we can't use open2 without doing 2>&1.
    250250    # On linux, 2>&1 launches a subshell which then launches wget, meaning that killing
Note: See TracChangeset for help on using the changeset viewer.