source: main/trunk/greenstone2/bin/script/activate.pl@ 25581

Last change on this file since 25581 was 25581, checked in by ak19, 12 years ago

activate.pl now has both ping_library and ping_library_collection subroutines. The second one is called to check whether a collection needs to be deactivated or activated (in case it's already active).

File size: 23.3 KB
Line 
1#!/usr/bin/perl -w
2
3###########################################################################
4#
5# activate.pl -- to be called after building a collection to activate it.
6#
7# A component of the Greenstone digital library software
8# from the New Zealand Digital Library Project at the
9# University of Waikato, New Zealand.
10#
11# Copyright (C) 2009 New Zealand Digital Library Project
12#
13# This program is free software; you can redistribute it and/or modify
14# it under the terms of the GNU General Public License as published by
15# the Free Software Foundation; either version 2 of the License, or
16# (at your option) any later version.
17#
18# This program is distributed in the hope that it will be useful,
19# but WITHOUT ANY WARRANTY; without even the implied warranty of
20# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21# GNU General Public License for more details.
22#
23# You should have received a copy of the GNU General Public License
24# along with this program; if not, write to the Free Software
25# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26#
27###########################################################################
28
29
30# This program is designed to support the building process of Greenstone.
31# It deactivates the collection just built, if the web server is running
32# and is a persistent web server (or if the library_URL provided as
33# parameter to this script is of a currently running web server). It then
34# moves building to index, before activating the collection on the GS2 or
35# GS3 web server again if necessary.
36
37
38BEGIN {
39 die "GSDLHOME not set\n" unless defined $ENV{'GSDLHOME'};
40 die "GSDLOS not set\n" unless defined $ENV{'GSDLOS'};
41 unshift (@INC, "$ENV{'GSDLHOME'}/perllib");
42}
43
44
45use strict;
46no strict 'refs'; # allow filehandles to be variables and vice versa
47no strict 'subs'; # allow barewords (eg STDERR) as function arguments
48
49use File::Basename;
50use File::Find;
51
52use HTTP::Response;
53use LWP::Simple qw($ua !head); # import useragent object as $ua from the full LWP to use along with LWP::Simple
54 # don't import LWP::Simple's head function by name since it can conflict with CGI:head())
55#use CGI qw(:standard); # then only CGI.pm defines a head()
56use Net::Ping;
57use URI;
58
59use colcfg;
60use scriptutil;
61use util;
62#use enum;
63
64# enumerations in perl, http://stackoverflow.com/questions/473666/does-perl-have-an-enumeration-type
65# Unfortunately, not part of perl's core
66#use enum qw(LEVEL_NONE LEVEL_ERROR LEVEL_INFO LEVEL_DEBUG); # debugging levels NONE == 0, ERROR=1 INFO=2 DEBUG=3
67
68# global variables
69#my $default_verbosity = LEVEL_ERROR; # by default we display basic error messages
70
71my $default_verbosity = 2; # by default we display basic error and info messages
72
73sub print_task_msg {
74 my ($task_msg, $verbosity_setting) = @_;
75
76 $verbosity_setting = $default_verbosity unless $verbosity_setting;
77 #$verbosity_setting = 1 unless defined $verbosity;
78 if($verbosity_setting >= 1) {
79 print STDERR "\n";
80 print STDERR "************************\n";
81 print STDERR "* $task_msg\n";
82 print STDERR "************************\n";
83 }
84}
85
86# Prints messages if the verbosity is right. Does not add new lines.
87sub print_msg {
88 my ($msg, $min_verbosity, $verbosity_setting) = @_;
89
90 # only display error messages if the current
91 # verbosity setting >= the minimum verbosity level
92 # needed for that message to be displayed.
93
94 $verbosity_setting = $default_verbosity unless defined $verbosity_setting;
95 $min_verbosity = 1 unless defined $min_verbosity;
96 if($verbosity_setting >= $min_verbosity) { # by default display all 1 messages
97 print STDERR "$msg";
98 }
99}
100
101# Method to send a command to a GS2 or GS3 library_URL
102# the commands used in this script can be activate, deactivate, ping,
103# and is-persistent (is-persistent only implemented for GS2).
104sub config {
105 my ($library_url, $command, $check_message_against_regex, $site) = @_;
106 # Gatherer.java's configGS3Server doesn't use the site variable
107 # so we don't have to either
108
109 # for GS2, getting the HTTP status isn't enough, we need to read the output
110 # since this is what CollectionManager.config() stipulates.
111 # Using LWP::UserAgent::get($url) for this
112
113 if(!defined $library_url) {
114 return 0;
115 }
116 else {
117 $ua->timeout(5); # set LWP useragent to 5s max timeout for testing the URL
118 # Need to set this, else it takes I don't know how long to timeout
119 # http://www.perlmonks.org/?node_id=618534
120
121 # http://search.cpan.org/~gaas/libwww-perl-6.04/lib/LWP/UserAgent.pm
122 # use LWP::UserAgent's get($url) since it returns an HTTP::Response code
123
124 my $response_obj = $ua->get( $library_url.$command);
125
126 # $response_obj->content stores the content and $response_obj->code the HTTP response code
127 my $response_code = $response_obj->code();
128
129 if(LWP::Simple::is_success($response_code)) {# $response_code eq RC_OK) { # LWP::Simple::is_success($response_code)
130 &print_msg("*** Command $library_url$command\n", 3);
131 &print_msg("*** HTTP Response Status: $response_code - Complete.", 3);
132
133 # check the page content is as expected
134 my $response_content = $response_obj->content;
135 if($response_content =~ m/$check_message_against_regex/) {
136 &print_msg(" Response as expected.\n", 3);
137 return 1;
138 } else {
139 &print_msg("\n\tBUT: command $library_url$command response UNEXPECTED.\n", 3);
140 &print_msg("*** Got message:\n$response_content.\n", 4);
141 return 0; # ping on a collection may "not succeed."
142 }
143 }
144 elsif(LWP::Simple::is_error($response_code)) { # method exported by LWP::Simple, along with HTTP::Status constants
145 &print_msg("*** Command $library_url$command\n");
146 &print_msg("*** HTTP Response Status: $response_code - Failed.\n");
147 return 0;
148 }
149 }
150}
151
152sub deactivate_collection {
153 my ($library_url, $gs_mode, $qualified_collection, $site) = @_;
154
155 if($gs_mode eq "gs2") {
156 my $DEACTIVATE_COMMAND = "?a=config&cmd=release-collection&c=";
157 my $check_message_against_regex = q/configured release-collection/;
158 config($library_url, $DEACTIVATE_COMMAND.$qualified_collection, $check_message_against_regex);
159 }
160 elsif ($gs_mode eq "gs3") {
161 my $DEACTIVATE_COMMAND = "?a=s&sa=d&st=collection&sn=";
162 my $check_message_against_regex = "collection: $qualified_collection deactivated";
163 config($library_url, $DEACTIVATE_COMMAND.$qualified_collection, $check_message_against_regex, $site);
164 }
165}
166
167sub activate_collection {
168 my ($library_url, $gs_mode, $qualified_collection, $site) = @_;
169
170 if($gs_mode eq "gs2") {
171 my $ACTIVATE_COMMAND = "?a=config&cmd=add-collection&c=";
172 my $check_message_against_regex = q/configured add-collection/;
173 config($library_url, $ACTIVATE_COMMAND.$qualified_collection, $check_message_against_regex);
174 }
175 elsif ($gs_mode eq "gs3") {
176 my $ACTIVATE_COMMAND = "?a=s&sa=a&st=collection&sn=";
177 my $check_message_against_regex = "collection: $qualified_collection activated";
178 config($library_url, $ACTIVATE_COMMAND.$qualified_collection, $check_message_against_regex, $site);
179 }
180}
181
182sub ping {
183 my ($library_url, $command, $gs_mode, $site) = @_;
184
185 # "Ping" ... "succeeded" expected on success. (Ping on a collection may "not succeed".)
186 my $check_responsemsg_against_regex = q/succeeded/;
187 return config($library_url, $command, $check_responsemsg_against_regex, $site);
188}
189
190# send a pingaction to the GS library. General server-level ping.
191sub ping_library {
192 my ($library_url, $gs_mode, $site) = @_;
193
194 my $command = "";
195 if($gs_mode eq "gs2") {
196 $command = "?a=ping";
197 }
198 elsif ($gs_mode eq "gs3") {
199 $command = "?a=s&sa=ping";
200 }
201 return &ping($library_url, $command, $gs_mode, $site);
202}
203
204
205# send a pingaction to a collection in GS library to check if it's active
206sub ping_library_collection {
207 my ($library_url, $gs_mode, $qualified_collection, $site) = @_;
208
209 my $command = "";
210 if($gs_mode eq "gs2") {
211 $command = "?a=ping&c=$qualified_collection";
212 }
213 elsif ($gs_mode eq "gs3") {
214 $command = "?a=s&sa=ping&st=collection&sn=$qualified_collection";
215 }
216 return &ping($library_url, $command, $gs_mode, $site);
217}
218
219# return true if server is persistent, by calling is-persistent on library_url
220# this is only for GS2, since the GS3 server is always persistent
221sub is_persistent {
222 my ($library_url, $gs_mode) = @_;
223
224 if($gs_mode eq "gs3") { # GS3 server is always persistent
225 return 1;
226 }
227
228 my $command = "?a=is-persistent";
229 my $check_responsemsg_against_regex = q/true/; # isPersistent: true versus isPersistent: false
230 return config($library_url, $command, $check_responsemsg_against_regex);
231}
232
233sub get_library_URL {
234 my $gs_mode = shift(@_); # gs3 or gs2
235
236 # If we get here, we are dealing with a server included with GS.
237 # For GS3, we ask ant for the library URL.
238 # For GS2, we derive the URL from the llssite.cfg file.
239
240 my $url = undef;
241
242 if($gs_mode eq "gs2") {
243 my $llssite_cfg = &util::filename_cat($ENV{'GSDLHOME'}, "llssite.cfg");
244
245 if(-f $llssite_cfg) {
246 # check llssite.cfg for line with url property
247 # for server.exe also need to use portnumber and enterlib properties
248
249 # Read in the entire contents of the file in one hit
250 if (!open (FIN, $llssite_cfg)) {
251 &print_msg("activate.pl::get_library_URL failed to open $llssite_cfg ($!)\n");
252 return undef;
253 }
254
255 my $contents;
256 sysread(FIN, $contents, -s FIN);
257 close(FIN);
258
259 my @lines = split(/[\n\r]+/, $contents); # split on carriage-returns and/or linefeeds
260 my $enterlib = "";
261 my $portnumber = ""; # will remain empty (implicit port 80) unless it's specifically been assigned
262
263 foreach my $line (@lines) {
264 if($line =~ m/^url=(.*)$/) {
265 $url = $1;
266 } elsif($line =~ m/^enterlib=(.*)$/) {
267 $enterlib = $1;
268 } elsif($line =~ m/^portnumber=(.*)$/) {
269 $portnumber = $1;
270 }
271 }
272
273 if(!$url) {
274 return undef;
275 }
276 elsif($url eq "URL_pending") { # library is not running
277 # do not process url=URL_pending in the file, since for server.exe
278 # this just means the Enter Library button hasn't been pressed yet
279 $url = undef;
280 }
281 else {
282 # In the case of server.exe, need to do extra work to get the proper URL
283 # But first, need to know whether we're indeed dealing with server.exe:
284
285 # compare the URL's domain to the full URL
286 # E.g. for http://localhost:8383/greenstone3/cgi-bin, the domain is localhost:8383
287 my $uri = URI->new( $url );
288 my $host = $uri->host;
289 #print STDERR "@@@@@ host: $host\n";
290 if($url =~ m/http:\/\/$host(\/)?$/) {
291 #if($url !~ m/http:\/\/$host:$portnumber(\/)?/ || $url =~ m/http:\/\/$host(\/)?$/) {
292 # (if the URL does not contain the portnumber, OR if the port is implicitly 80 and)
293 # If the domain with http:// prefix is completely the same as the URL, assume server.exe
294 # then the actual URL is the result of suffixing the port and enterlib properties in llssite.cfg
295 $url = $url.":".$portnumber.$enterlib;
296 } # else, apache web server
297
298 }
299 }
300 } elsif($gs_mode eq "gs3") {
301 # Either check build.properties for tomcat.server, tomcat.port and app.name (and default servlet name).
302 # app.name is stored in app.path by build.xml. Need to move app.name in build.properties from build.xml
303
304 # Or, run the new target get-default-servlet-url
305 # the output can look like:
306 #
307 # Buildfile: build.xml
308 # [echo] os.name: Windows Vista
309 #
310 # get-default-servlet-url:
311 # [echo] http://localhost:8383/greenstone3/library
312 # BUILD SUCCESSFUL
313 # Total time: 0 seconds
314
315 #my $output = qx/ant get-default-servlet-url/; # backtick operator, to get STDOUT (else 2>&1)
316 # see http://stackoverflow.com/questions/799968/whats-the-difference-between-perls-backticks-system-and-exec
317
318 my $perl_command = "ant get-default-servlet-url"; # assumes activate.pl is run from within the GS3 installation
319
320 if (open(PIN, "$perl_command |")) {
321 while (defined (my $perl_output_line = <PIN>)) {
322 if($perl_output_line =~ m@http:\/\/(\S*)@) { # grab all the non-whitespace chars
323 $url="http://".$1;
324 }
325 }
326 close(PIN);
327 } else {
328 &print_msg("activate.pl::get_library_URL: Failed to run $perl_command to work out library URL for $gs_mode\n");
329 }
330 }
331
332 # either the url is still undef or it is now set
333 #print STDERR "\n@@@@@ final URL:|$url|\n" if $url;
334 #print STDERR "\n@@@@@ URL still undef\n" if !$url;
335 return $url;
336}
337
338### UNUSED METHODS TO MOVE TO util.pm?
339
340# This method is now unused. Using ping_library instead to send the ping action to a
341# GS2/GS3 server. This method can be used more generally to test whether a URL is alive.
342# http://search.cpan.org/dist/libwww-perl/lib/LWP/Simple.pm
343# and http://www.perlmonks.org/?node_id=618534
344sub is_URL_active {
345 my $url = shift(@_); # gs3 or gs2 URL
346
347 my $status = 0;
348 if(defined $url) {
349 $ua->timeout(5); # set LWP useragent to 5s max timeout for testing the URL
350 # Need to set this, else it takes I don't know how long to timeout
351 # http://www.perlmonks.org/?node_id=618534
352
353 $status = LWP::Simple::head($url); # returns empty list of headers if it fails
354 # LWP::Simple::get($url) is more intensive, so don't need to do that
355 #print STDERR "**** $url is alive.\n" if $status;
356 }
357 return $status;
358}
359
360# Pinging seems to always return true, so this method doesn't work
361sub pingHost {
362 my $url = shift(@_); # gs3 or gs2 URL
363
364 my $status = 0;
365 if(defined $url) {
366 # Get just the domain. "http://localhost/gsdl?uq=332033495" becomes "localhost"
367 # "http://localhost/greenstone/cgi-bin/library.cgi" becomes "localhost" too
368
369 #my $host = $url;
370 #$host =~ s@^http:\/\/(www.)?@@;
371 #$host =~ s@\/.*@@;
372 #print STDERR "**** HOST: $host\n";
373
374 # More robust way
375 # http://stackoverflow.com/questions/827024/how-do-i-extract-the-domain-out-of-an-url
376 my $uri = URI->new( $url );
377 my $host = $uri->host;
378
379 # Ping the host. http://perldoc.perl.org/Net/Ping.html
380 my $p = Net::Ping->new();
381 $status = $p->ping($host); # || 0. Appears to set to undef rather than 0
382 print STDERR "**** $host is alive.\n" if $status; #print "$host is alive.\n" if $p->ping($host);
383 $p->close();
384 }
385 # return whether pinging was a success or failure
386 return $status;
387}
388
389
390# Most of the arguments are familiar from the building scripts like buildcol.pl
391# The special optional argument -library_url is for when we're dealing with a web
392# library server such as an apache that's separate from any included with GS2.
393# In such a case, this script's caller should pass in -library_url <URL>.
394#
395# $site argument must be specified in the cmdline for collectionConfig.xml to get
396# generated which makes $gs_mode=gs3, else collect.cfg gets generated and $gs_mode=gs2
397sub main
398{
399 my ($argc,@argv) = @_;
400
401 if (($argc==0) || (($argc==1) && ($argv[0] =~ m/^--?h(elp)?$/))) {
402 my ($progname) = ($0 =~ m/^.*[\/|\\](.*?)$/);
403
404
405 print STDERR "\n";
406 print STDERR "Usage: $progname [-collectdir c -builddir b -indexdir i -site s -removeold -keepold -verbosity v\n";
407 print STDERR "\t-library_url URL] <[colgroup/]collection>\n";
408 print STDERR "\n";
409
410 exit(-1);
411 }
412
413 # get the collection details
414 my $qualified_collection = pop @argv; # qualified collection
415
416 my $collect_dir = "collect"; # undef
417 my $build_dir = undef;
418 my $index_dir = undef;
419 my $site = undef;
420
421 my $removeold = 0;
422 my $keepold = 0;
423
424 my $library_url = undef; # to be specified on the cmdline if not using a GS-included web server
425
426 while (my $arg = shift @argv) {
427 if ($arg eq "-collectdir") {
428 $collect_dir = shift @argv;
429 }
430 elsif ($arg eq "-builddir") {
431 $build_dir = shift @argv;
432 }
433 elsif ($arg eq "-indexdir") {
434 $index_dir = shift @argv;
435 }
436 elsif ($arg eq "-site") {
437 $site = shift @argv;
438 }
439 elsif ($arg eq "-removeold") {
440 $removeold = 1;
441 }
442 elsif ($arg eq "-keepold") {
443 $keepold = 1;
444 }
445 elsif ($arg eq "-library_url") {
446 $library_url = shift @argv;
447 }
448 elsif ($arg eq "-verbosity") {
449 $default_verbosity = shift @argv; # global variable
450
451 # ensure we're working with ints not strings (int context not str context), in case verbosity=0
452 # http://stackoverflow.com/questions/288900/how-can-i-convert-a-string-to-a-number-in-perl
453 $default_verbosity = int($default_verbosity || 0); ### is this the best way?
454 }
455 }
456
457 # work out the building and index dirs
458 my $collection_dir = &util::resolve_collection_dir($collect_dir, $qualified_collection, $site);
459 $build_dir = &util::filename_cat($collection_dir, "building") unless (defined $build_dir);
460 $index_dir = &util::filename_cat($collection_dir, "index") unless (defined $index_dir);
461
462 &print_task_msg("Running Collection Activation Stage");
463
464 # can't do anything without a build directory with something in it to move into index
465 if(!&util::dir_exists($build_dir)) {
466 &print_msg("No building folder at $build_dir to move to index.\n");
467 exit -1;
468 } elsif (&util::is_dir_empty($build_dir)) {
469 &print_msg("Nothing in building folder $build_dir to move into index folder.\n");
470 exit -1;
471 }
472
473 # get and check the collection name
474 if ((&colcfg::use_collection($site, $qualified_collection, $collect_dir)) eq "") {
475 &print_msg("Unable to use collection \"$qualified_collection\" within \"$collect_dir\"\n");
476 exit -1;
477 }
478
479 # Read in the collection configuration file.
480 # Beware: Only if $site is specified in the cmdline does collectionConfig.xml get
481 # generated and does $gs_mode=gs3, else collect.cfg gets generated and $gs_mode=gs2
482 my ($collect_cfg_filename, $gs_mode) = &colcfg::get_collect_cfg_name(STDERR);
483
484 my $collectcfg = &colcfg::read_collection_cfg ($collect_cfg_filename,$gs_mode);
485
486 # look for build.cfg/buildConfig.xml
487 my $build_cfg_filename ="";
488
489 if ($gs_mode eq "gs2") {
490 $build_cfg_filename = &util::filename_cat($build_dir,"build.cfg");
491 } else {
492 $build_cfg_filename = &util::filename_cat($build_dir, "buildConfig.xml");
493 # gs_mode is GS3. Set the site now if this was not specified as cmdline argument
494 #$site = "localsite" unless defined $site;
495 }
496
497 # We would like to know what the buildtype is
498 # This will be useful for Solr.
499 if (-e $build_cfg_filename) {
500
501 # testing if there has been a change of indexer
502 # (e.g. collect.cfg now says lucene, but build.cfg says mgpp)
503 my $buildcfg = &colcfg::read_building_cfg ($build_cfg_filename, $gs_mode);
504 if ($buildcfg->{'buildtype'} ne $collectcfg->{'buildtype'}) {
505 ### do something? See incremental-buildcol.pl
506 }
507 else {
508 ### do something? See incremental-buildcol.pl
509 }
510 }
511 else { # build.cfg doesn't exist
512 ### do something? See incremental-buildcol.pl
513 }
514
515
516 # Now the logic in GLI's CollectionManager.java (processComplete()
517 # and installCollection()) and Gatherer.configGS3Server().
518
519 # 1. Get library URL
520
521 # For web servers that are external to a Greenstone installation,
522 # the user can pass in their web server's library URL.
523 # For web servers included with GS (like tomcat for GS3 and server.exe
524 # and apache for GS2), we work out the library URL:
525 if(!$library_url) {
526 $library_url = &get_library_URL($gs_mode); # returns undef if no server is running
527 }
528
529 # CollectionManager's installCollection phase in GLI
530 # 2. Ping the library URL, and if it's a persistent server and running, release the collection
531
532 my $is_persistent_server = undef;
533 if($library_url) { # undef if no valid server URL
534
535 &print_msg("Pinging $library_url\n");
536 if(&ping_library($library_url, $gs_mode, $site)) { # server running
537
538 # server is running, so release the collection if
539 # the server is persistent and the collection is active
540 &print_msg("Checking if Greenstone server is persistent\n");
541 $is_persistent_server = &is_persistent($library_url, $gs_mode);
542
543 &print_msg("Checking if the collection $qualified_collection is already active\n");
544 my $collection_active = &ping_library_collection($library_url, $gs_mode, $qualified_collection, $site);
545
546 if($is_persistent_server && $collection_active) {
547 &print_msg("De-activating collection $qualified_collection\n");
548 &deactivate_collection($library_url, $gs_mode, $qualified_collection, $site);
549 }
550 }
551 }
552
553 # 3. Do all the moving building to index stuff now
554
555 # If removeold: replace index dir with building dir.
556 # If keepold: move building's contents into index, where only duplicates will get deleted.
557 # removeold and keepold can't both be on at the same time
558 ($removeold, $keepold) = &scriptutil::check_removeold_and_keepold($removeold, $keepold,
559 0, # incremental is irrelevant to what activate.pl does, setting this = 0
560 $build_dir, # checkdir. Usually archives or export to be deleted. activate.pl deletes building
561 $collectcfg);
562
563 if($removeold) {
564
565 if(&util::dir_exists($index_dir)) {
566 &print_task_msg("Removing \"index\"");
567 &util::rm_r($index_dir);
568
569 # Wait for a couple of seconds, just for luck
570 sleep 2;
571
572 if (&util::dir_exists($index_dir)) {
573 &print_msg("The index directory $index_dir could not be deleted.\n"); # CollectionManager.Index_Not_Deleted
574 }
575 }
576
577 # if remote GS server: gliserver.pl would call activate.pl to activate
578 # the collection at this point since activate.pl lives on the server side
579
580 # Move the building directory to become the new index directory
581 &print_task_msg("Moving \"building\" -> \"index\"");
582 &util::mv($build_dir, $index_dir);
583 if(&util::dir_exists($build_dir) || !&util::dir_exists($index_dir)) {
584 &print_msg("Could not move $build_dir to $index_dir.\n"); # CollectionManager.Build_Not_Moved
585 }
586 }
587 elsif ($keepold) {
588 # Copy just the contents of building dir into the index dir, overwriting
589 # existing files, but don't replace index with building.
590 &print_task_msg("Moving \"building\" -> \"index\"");
591 &util::mv_dir_contents($build_dir, $index_dir);
592 }
593
594 # 4. Ping the library URL, and if it's a persistent server and running, activate the collection again
595
596 # Check for success: if building does not exist OR is empty
597 if(!&util::dir_exists($build_dir) || &util::is_dir_empty($build_dir)) {
598
599 if($library_url) { # undef if no valid server URL
600
601 &print_msg("Pinging $library_url\n");
602 if(&ping_library($library_url, $gs_mode, $site)) { # server running
603
604 # don't need to work out persistency of server more than once, since the libraryURL hasn't changed
605 if(!defined $is_persistent_server) {
606 &print_msg("Checking if Greenstone server is persistent\n");
607 $is_persistent_server = &is_persistent($library_url, $gs_mode);
608 }
609
610 &print_msg("Checking if the collection $qualified_collection is not already active\n");
611 my $collection_active = &ping_library_collection($library_url, $gs_mode, $qualified_collection, $site);
612
613 if($is_persistent_server && !$collection_active) {
614 &print_msg("Activating collection $qualified_collection\n");
615 &activate_collection($library_url, $gs_mode, $qualified_collection, $site);
616 }
617 }
618 }
619 } else { # installcollection failed
620 #CollectionManager.Preview_Ready_Failed
621 &print_msg("Building directory is not empty or still exists. Failed to properly move $build_dir to $index_dir.\n");
622 }
623}
624
625&main(scalar(@ARGV),@ARGV);
Note: See TracBrowser for help on using the repository browser.