- Timestamp:
- 2016-05-10T16:39:20+12:00 (8 years ago)
- Location:
- main/trunk/greenstone2
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone2/bin/script/activate.pl
r30523 r30524 113 113 114 114 print STDERR "\n"; 115 print STDERR "Usage: $progname [-collectdir c -builddir b -indexdir i -site s -skipactivation -removeold -keepold - verbosity v\n";115 print STDERR "Usage: $progname [-collectdir c -builddir b -indexdir i -site s -skipactivation -removeold -keepold -incremental -verbosity v\n"; 116 116 print STDERR "\t-library_url URL -library_name n] <[colgroup/]collection>\n"; 117 117 print STDERR "\n"; … … 247 247 248 248 # 1. Get library URL 249 250 # For web servers that are external to a Greenstone installation, 251 # the user can pass in their web server's library URL. 252 # For web servers included with GS (like tomcat for GS3 and server.exe 253 # and apache for GS2), we work out the library URL: 254 if(!$library_url) { 255 $library_url = $gsserver->get_library_URL(); # returns undef if no server is running 256 } 257 258 # CollectionManager's installCollection phase in GLI 259 # 2. Ping the library URL, and if it's a persistent server and running, release the collection 260 if($library_url && !$skipactivation) { # undef if no valid server URL 261 $gsserver->do_deactivate(); 262 } 249 # CollectionManager's installCollection phase in GLI: 250 # 2. Ping the library URL, and if it's a persistent server and running, release the collection 251 $gsserver->do_deactivate() unless $skipactivation; 263 252 264 253 # 2b. If we're working with a solr collection, then start up the solrserver now. … … 386 375 387 376 388 # 4. Ping the library URL, and if it's a persistent server and running, activate the collection again 377 # 4. Ping the library URL, and if it's a persistent server and running, activate the collection again 389 378 390 379 # Check for success: if building does not exist OR is empty OR if building is index (in which case there was no move) 391 380 if($build_dir eq $index_dir || !&FileUtils::directoryExists($build_dir) || &FileUtils::isDirectoryEmpty($build_dir)) { 392 381 393 if($library_url && !$skipactivation) { # undef if no valid server URL 394 $gsserver->do_activate(); 395 } 382 $gsserver->do_activate() unless $skipactivation; 383 396 384 } else { # installcollection failed 397 385 #CollectionManager.Preview_Ready_Failed -
main/trunk/greenstone2/perllib/servercontrol.pm
r30523 r30524 50 50 my ($qualified_collection, $site, $verbosity, $build_dir, $index_dir, $collect_dir, $library_url, $library_name) = @_; 51 51 52 # library_url: to be specified on the cmdline if not using a GS-included web server 53 # the GSDL_LIBRARY_URL env var is useful when running cmdline buildcol.pl in the linux package manager versions of GS3 54 52 55 my $self = {'build_dir' => $build_dir, 53 56 'index_dir' => $index_dir, … … 113 116 sub config { 114 117 my $self = shift(@_); 115 my ($command, $check_message_against_regex, $site, $expected_error_code, $silent) = @_; 116 117 my ($library_url); 118 $library_url = $self->{'library_url'}; 119 #$site = $self->{'site'}; 118 my ($command, $check_message_against_regex, $expected_error_code, $silent) = @_; 119 120 my $library_url = $self->get_library_URL(); #$self->{'library_url'}; 120 121 121 122 … … 192 193 my $self = shift(@_); 193 194 194 my ($library_url, $gs_mode, $qualified_collection, $site); 195 $library_url = $self->{'library_url'}; 196 $gs_mode = $self->{'gs_mode'}; 197 $qualified_collection = $self->{'qualified_collection'}; 198 $site = $self->{'site'}; 195 my $gs_mode = $self->{'gs_mode'}; 196 my $qualified_collection = $self->{'qualified_collection'}; 199 197 200 198 if($gs_mode eq "gs2") { … … 206 204 my $DEACTIVATE_COMMAND = "?a=s&sa=d&st=collection&sn="; 207 205 my $check_message_against_regex = "collection: $qualified_collection deactivated"; 208 $self->config($DEACTIVATE_COMMAND.$qualified_collection, $check_message_against_regex , $site);206 $self->config($DEACTIVATE_COMMAND.$qualified_collection, $check_message_against_regex); 209 207 } 210 208 } … … 213 211 my $self = shift(@_); 214 212 215 my ($library_url, $gs_mode, $qualified_collection, $site); 216 $library_url = $self->{'library_url'}; 217 $gs_mode = $self->{'gs_mode'}; 218 $qualified_collection = $self->{'qualified_collection'}; 219 $site = $self->{'site'}; 213 my $gs_mode = $self->{'gs_mode'}; 214 my $qualified_collection = $self->{'qualified_collection'}; 220 215 221 216 if($gs_mode eq "gs2") { … … 227 222 my $ACTIVATE_COMMAND = "?a=s&sa=a&st=collection&sn="; 228 223 my $check_message_against_regex = "collection: $qualified_collection activated"; 229 $self->config($ACTIVATE_COMMAND.$qualified_collection, $check_message_against_regex , $site);224 $self->config($ACTIVATE_COMMAND.$qualified_collection, $check_message_against_regex); 230 225 } 231 226 } … … 235 230 my $command = shift(@_); 236 231 my $silent = shift(@_); 237 238 my ($library_url, $gs_mode, $site);239 $library_url = $self->{'library_url'};240 $gs_mode = $self->{'gs_mode'};241 $site = $self->{'site'};242 232 243 233 # If the GS server is not running, we *expect* to see a "500" status code. … … 250 240 $self->print_msg("*** COMMAND WAS: |$command|***\n", 4); 251 241 252 return $self->config($command, $check_responsemsg_against_regex, $ site, $expected_error_code, $silent);242 return $self->config($command, $check_responsemsg_against_regex, $expected_error_code, $silent); 253 243 } 254 244 … … 257 247 my $self = shift(@_); 258 248 259 my ($library_url, $gs_mode, $site); 260 $library_url = $self->{'library_url'}; 261 $gs_mode = $self->{'gs_mode'}; 262 $site = $self->{'site'}; 249 my $gs_mode = $self->{'gs_mode'}; 263 250 264 251 my $command = ""; … … 278 265 my $silent = shift(@_); 279 266 280 my ($library_url, $gs_mode, $qualified_collection, $site); 281 $library_url = $self->{'library_url'}; 282 $gs_mode = $self->{'gs_mode'}; 283 $qualified_collection = $self->{'qualified_collection'}; 284 $site = $self->{'site'}; 285 #$silent = $self->{'silent'}; 267 my $gs_mode = $self->{'gs_mode'}; 268 my $qualified_collection = $self->{'qualified_collection'}; 286 269 287 270 my $command = ""; … … 299 282 sub is_persistent { 300 283 my $self = shift(@_); 301 302 my ($library_url, $gs_mode); 303 $library_url = $self->{'library_url'}; 304 $gs_mode = $self->{'gs_mode'}; 305 306 if($gs_mode eq "gs3") { # GS3 server is always persistent 284 285 if($self->{'gs_mode'} eq "gs3") { # GS3 server is always persistent 307 286 return 1; 308 287 } … … 450 429 my $self = shift(@_); 451 430 452 my($is_persistent_server, $library_url, $gs_mode, $site, $qualified_collection); 453 $is_persistent_server = $self->{'is_persistent_server'}; 454 $library_url = $self->get_library_URL(); #may not yet be set, so can't do $self->{'library_url'}; 455 $site = $self->{'site'}; 456 $gs_mode = $self->{'gs_mode'}; 457 $qualified_collection = $self->{'qualified_collection'}; 458 431 # 1. Get library URL 432 433 # For web servers that are external to a Greenstone installation, 434 # the user can pass in their web server's library URL. 435 # For web servers included with GS (like tomcat for GS3 and server.exe 436 # and apache for GS2), we work out the library URL: 437 438 # Can't do $self->{'library_url'}, because it may not yet be set 439 my $library_url = $self->get_library_URL(); # returns undef if no server is running 440 441 if(!defined $library_url) { # undef if no valid server URL 442 return; # can't do any deactivation without a running GS server 443 } 444 445 my $is_persistent_server = $self->{'is_persistent_server'}; 446 my $qualified_collection = $self->{'qualified_collection'}; 447 448 # CollectionManager's installCollection phase in GLI 449 # 2. Ping the library URL, and if it's a persistent server and running, release the collection 459 450 460 451 $self->print_msg("Pinging $library_url\n"); … … 498 489 my $self = shift @_; 499 490 500 my($is_persistent_server, $library_url, $gs_mode, $site, $qualified_collection); 501 $is_persistent_server = $self->{'is_persistent_server'}; 502 $library_url = $self->get_library_URL(); #may not yet be set, so can't do $self->{'library_url'}; 503 $site = $self->{'site'}; 504 $gs_mode = $self->{'gs_mode'}; 505 $qualified_collection = $self->{'qualified_collection'}; 491 my $library_url = $self->get_library_URL(); # Can't do $self->{'library_url'}; as it may not be set yet 492 493 if(!defined $library_url) { # undef if no valid server URL 494 return; # nothing to activate if there's no running server 495 } 496 497 my $is_persistent_server = $self->{'is_persistent_server'}; 498 my $qualified_collection = $self->{'qualified_collection'}; 506 499 507 500 $self->print_msg("Pinging $library_url\n");
Note:
See TracChangeset
for help on using the changeset viewer.