Changeset 25957
- Timestamp:
- 2012-07-17T15:17:30+12:00 (11 years ago)
- Location:
- main/trunk/greenstone2
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone2/bin/script/pluginfo.pl
r25499 r25957 77 77 'type' => "string", 78 78 'reqd' => "no" }, 79 { 'name' => "gs_version", 80 'desc' => "{pluginfo.gs_version}", 81 'type' => "string", 82 'reqd' => "no", 83 'hiddengli' => "yes" }, 79 84 { 'name' => "xml", 80 85 'desc' => "{scripts.xml}", … … 107 112 my $site = ""; 108 113 my $collection = ""; 114 my $gs_version = ""; 109 115 my $xml = 0; 110 116 my $listall = 0; … … 121 127 die "\n"; 122 128 } 123 124 129 foreach my $strVariable (keys %$hashParsingResult) 125 130 { … … 188 193 if ($site ne "") { 189 194 # assume Greenstone 3 195 $gs_version = "3" if $gs_version eq ""; 190 196 if ($collection ne "") { 191 197 $ENV{'GSDLCOLLECTDIR'} = &util::filename_cat ($ENV{'GSDL3HOME'}, "sites", $site, "collect", $collection); … … 196 202 } 197 203 else { 204 $gs_version = "2" if $gs_version eq ""; 198 205 if ($collection ne "") { 199 206 $ENV{'GSDLCOLLECTDIR'} = &util::filename_cat ($ENV{'GSDLHOME'}, "collect", $collection); … … 247 254 foreach my $plugin (@plugin_list) { 248 255 $plugin =~ s/\.pm$//; 249 my $plugobj = &plugin::load_plugin_for_info ($plugin );256 my $plugobj = &plugin::load_plugin_for_info ($plugin, $gs_version); 250 257 push (@plugobj_list, $plugobj); 251 258 } … … 267 274 } 268 275 else { 269 &print_single_plugin($plugin, $ xml, 1);276 &print_single_plugin($plugin, $gs_version, $xml, 1); 270 277 } 271 278 } … … 273 280 274 281 sub print_single_plugin { 275 my ($plugin, $ xml, $header) = @_;276 my $plugobj = &plugin::load_plugin_for_info ($plugin );282 my ($plugin, $gs_version, $xml, $header) = @_; 283 my $plugobj = &plugin::load_plugin_for_info ($plugin, $gs_version); 277 284 if ($xml) { 278 285 &gsprintf::set_print_xml_tags(); -
main/trunk/greenstone2/perllib/inexport.pm
r24829 r25957 173 173 } 174 174 175 # set gs_verison 2/3 176 $self->{'gs_version'} = "2"; 177 if ((defined $site) && ($site ne "")) { 178 # gs3 179 $self->{'gs_version'} = "3"; 180 } 175 181 # add collection's perllib dir into include path in 176 182 # case we have collection specific modules … … 364 370 my $incremental_mode = $self->{'incremental_mode'}; 365 371 372 my $gs_version = $self->{'gs_version'}; 373 366 374 my $removeold = $self->{'removeold'}; 367 375 my $keepold = $self->{'keepold'}; … … 433 441 my @global_opts = (); 434 442 435 my $pluginfo = &plugin::load_plugins ($plugins, $verbosity, $out, $faillog, \@global_opts, $plugin_incr_mode );443 my $pluginfo = &plugin::load_plugins ($plugins, $verbosity, $out, $faillog, \@global_opts, $plugin_incr_mode, $gs_version); 436 444 if (scalar(@$pluginfo) == 0) { 437 445 &gsprintf($out, "{import.no_plugins_loaded}\n"); -
main/trunk/greenstone2/perllib/plugin.pm
r25803 r25957 143 143 144 144 sub load_plugin_for_info { 145 my ($pluginname ) = shift @_;145 my ($pluginname, $gs_version) = (@_); 146 146 $pluginname = &get_valid_pluginname($pluginname); 147 147 load_plugin_require($pluginname); … … 149 149 # create a plugin object 150 150 my ($plugobj); 151 my $options = "-gsdlinfo ";151 my $options = "-gsdlinfo,-gs_version,$gs_version"; 152 152 153 153 eval ("\$plugobj = new \$pluginname([],[$options])"); … … 159 159 sub load_plugins { 160 160 my ($plugin_list) = shift @_; 161 my $incremental_mode;162 ($verbosity, $outhandle, $failhandle, $globaloptions, $incremental_mode ) = @_; # globals161 my ($incremental_mode, $gs_version); 162 ($verbosity, $outhandle, $failhandle, $globaloptions, $incremental_mode, $gs_version) = @_; # globals 163 163 my @plugin_objects = (); 164 164 $verbosity = 2 unless defined $verbosity; … … 182 182 # put quotes around each option to the plugin, unless the option is already quoted 183 183 map { $_ = "\"$_\"" unless ($_ =~ m/^\s*\".*\"\s*$/) ; } @$pluginoptions; 184 my $options = join (",", @$pluginoptions);184 my $options = "-gs_version,$gs_version,".join (",", @$pluginoptions); 185 185 if ($globals) { 186 186 if (@$pluginoptions) { -
main/trunk/greenstone2/perllib/plugins/PrintInfo.pm
r24347 r25957 47 47 use printusage; 48 48 49 my $arguments = []; 49 my $arguments = [ 50 { 'name' => "gs_version", 51 'desc' => "{PrintInfo.gs_version}", 52 'type' => "string", 53 'reqd' => "no", 54 'hiddengli' => "yes" } 55 56 ]; 50 57 51 58 my $options = { 'name' => "PrintInfo", … … 62 69 my $plugin_name = (defined $pluginlist->[0]) ? $pluginlist->[0] : $class; 63 70 64 71 if ($plugin_name eq $class) { 65 72 push(@{$hashArgOptLists->{"ArgList"}},@{$arguments}); 66 73 push(@{$hashArgOptLists->{"OptList"}},$options); 67 74 } 68 75 my $self = {}; 69 76 $self->{'outhandle'} = STDERR; 70 77 $self->{'option_list'} = $hashArgOptLists->{"OptList"}; 71 78 $self->{"info_only"} = 0; 72 79 $self->{'gs_version'} = "2"; 73 80 # Check if gsdlinfo is in the argument list or not - if it is, don't parse 74 # the args, just return the object. 81 # the args, just return the object. 82 # gsdlinfo must come before gs_version. both are set by plugin.pm 83 my $v=0; 75 84 foreach my $strArg (@{$args}) 76 85 { 77 if($strArg eq "-gsdlinfo") 86 if ($v) { 87 $self->{'gs_version'} = $strArg; 88 last; 89 } 90 elsif($strArg eq "-gsdlinfo") 78 91 { 79 92 $self->{"info_only"} = 1; 80 return bless $self, $class; 81 } 82 } 83 93 #return bless $self, $class; 94 } 95 elsif ($strArg eq "-gs_version") { 96 $v = 1; 97 } 98 } 99 100 if ($self->{"info_only"}) { 101 return bless $self, $class; 102 } 84 103 if (defined $auxiliary) { # don't parse the args here 85 104 return bless $self, $class; 105 } 106 107 # now that we are passed printing out info, we do need to add in this class's options so that they are available for parsing. 108 if ($plugin_name ne $class) { 109 push(@{$hashArgOptLists->{"ArgList"}},@{$arguments}); 110 push(@{$hashArgOptLists->{"OptList"}},$options); 86 111 } 87 112
Note:
See TracChangeset
for help on using the changeset viewer.