Changeset 32539 for main/trunk


Ignore:
Timestamp:
2018-10-25T18:12:59+13:00 (5 years ago)
Author:
ak19
Message:

New plugin parameter site_name (only set for GS3) that is passed to plugin::load_plugins() (but not to plugin::load_plugin_for_info()/gsdlinfo mode) by inexport.pm during import.pl and by basebuilder.pm during buildcol.pl. Like the gs_version parameter, it is parsed by plugins/PrintInfo.pm and will appear before gs_version (to preserve the way things were being parsed until now)

Location:
main/trunk/greenstone2/perllib
Files:
4 edited

Legend:

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

    r31409 r32539  
    214214    push @global_opts, "-separate_cjk";
    215215    }
    216     $self->{'pluginfo'} = &plugin::load_plugins ($plugins, $self->{'verbosity'}, $outhandle, $failhandle, \@global_opts, $self->{'incremental_mode'}, $gs_version);
     216    $self->{'pluginfo'} = &plugin::load_plugins ($plugins, $self->{'verbosity'}, $outhandle, $failhandle, \@global_opts, $self->{'incremental_mode'}, $gs_version, $self->{'site'});
    217217   
    218218    if (scalar(@{$self->{'pluginfo'}}) == 0) {
  • main/trunk/greenstone2/perllib/inexport.pm

    r32525 r32539  
    583583    my @global_opts = ();
    584584
    585     my $pluginfo = &plugin::load_plugins ($plugins, $verbosity, $out, $faillog, \@global_opts, $plugin_incr_mode, $gs_version);
     585    my $pluginfo = &plugin::load_plugins ($plugins, $verbosity, $out, $faillog, \@global_opts, $plugin_incr_mode, $gs_version, $self->{'site'});
    586586    if (scalar(@$pluginfo) == 0) {
    587587    &gsprintf($out, "{import.no_plugins_loaded}\n");
  • main/trunk/greenstone2/perllib/plugin.pm

    r30597 r32539  
    179179sub load_plugins {
    180180    my ($plugin_list) = shift @_;
    181     my ($incremental_mode, $gs_version);
    182     ($verbosity, $outhandle, $failhandle, $globaloptions, $incremental_mode, $gs_version) = @_; # globals
     181    my ($incremental_mode, $gs_version, $site);
     182    ($verbosity, $outhandle, $failhandle, $globaloptions, $incremental_mode, $gs_version, $site) = @_; # globals
    183183    my @plugin_objects = ();
    184184    $verbosity = 2 unless defined $verbosity;
     
    204204    # put quotes around each option to the plugin, unless the option is already quoted
    205205    map { $_ = "\"$_\"" unless ($_ =~ m/^\s*\".*\"\s*$/) ; } @$pluginoptions;
    206     my $options = "-gs_version,$gs_version,".join (",", @$pluginoptions);
     206    my $site_option = $site ? "\"-site_name\",\"$site\"," : "";
     207    my $options = "$site_option"."-gs_version,$gs_version,".join (",", @$pluginoptions);   
    207208    if ($globals) {
    208209        if (@$pluginoptions) {
  • main/trunk/greenstone2/perllib/plugins/PrintInfo.pm

    r32281 r32539  
    5050    { 'name' => "gs_version",
    5151      'desc' => "{PrintInfo.gs_version}",
     52      'type' => "string",
     53      'reqd' => "no",
     54      'hiddengli' => "yes" },
     55    { 'name' => "site_name",
     56      'desc' => "{PrintInfo.site_name}",
    5257      'type' => "string",
    5358      'reqd' => "no",
     
    8186    # the args, just return the object.
    8287    # gsdlinfo must come before gs_version. both are set by plugin.pm
     88    # The optional -site_name <site> (present only for GS3 and when not doing gsdlinfo),
     89    # if it is there, also appears before gs_version and is also set by plugin.pm
    8390    my $v=0;
    8491    foreach my $strArg (@{$args})
    8592    {
    86     if ($v) {
     93    if($v eq "-site_name") {
     94        $self->{'site_name'} = $strArg;
     95    }
     96    elsif($v eq "-gs_version") {
    8797        $self->{'gs_version'} = $strArg;
    8898        last;
     
    93103        #return bless $self, $class;
    94104    }
    95     elsif ($strArg eq "-gs_version") {
    96         $v = 1;     
     105    elsif ($strArg eq "-gs_version" || $strArg eq "-site_name") {       
     106        $v = $strArg;
    97107    }
    98108    }
Note: See TracChangeset for help on using the changeset viewer.