Index: /main/trunk/greenstone2/bin/script/activate.pl
===================================================================
--- /main/trunk/greenstone2/bin/script/activate.pl	(revision 25886)
+++ /main/trunk/greenstone2/bin/script/activate.pl	(revision 25887)
@@ -103,5 +103,5 @@
 # and is-persistent (is-persistent only implemented for GS2).
 sub config {
-	my ($library_url, $command, $check_message_against_regex, $site) = @_; 
+	my ($library_url, $command, $check_message_against_regex, $site, $expected_error_code) = @_; 
 			# Gatherer.java's configGS3Server doesn't use the site variable
 			# so we don't have to either
@@ -143,7 +143,12 @@
 		} 
 		elsif(LWP::Simple::is_error($response_code)) { # method exported by LWP::Simple, along with HTTP::Status constants
+		    # check the page content is as expected
+		    if(defined $expected_error_code && $response_code == $expected_error_code) {
+			&print_msg(" Response status $response_code as expected.\n", 3);
+		    } else {
 			&print_msg("*** Command $library_url$command\n");
-			&print_msg("*** HTTP Response Status: $response_code - Failed.\n");
-			return 0;
+			&print_msg("*** Unexpected error. HTTP Response Status: $response_code - Failed.\n");
+		    }
+		    return 0; # return false, since the response_code was an error, expected or not
 		}
 	}	
@@ -182,8 +187,12 @@
 sub ping {
 	my ($library_url, $command, $gs_mode, $site) = @_;
-	
-	# "Ping" ... "succeeded" expected on success. (Ping on a collection may "not succeed".)	
-	my $check_responsemsg_against_regex = q/succeeded/;	
-	return config($library_url, $command, $check_responsemsg_against_regex, $site);
+
+	# If the GS server is not running, we *expect* to see a "500" status code.
+	# If the GS server is running, then "Ping" ... "succeeded" is expected on success. 
+	# When pinging an inactive collection, it will say it did "not succeed". This is
+	# a message of interest to return.
+	my $check_responsemsg_against_regex = q/(succeeded)/;
+	my $expected_error_code = 500;
+	return config($library_url, $command, $check_responsemsg_against_regex, $site, $expected_error_code);
 }
 
@@ -482,6 +491,6 @@
 	
     # Read in the collection configuration file.
-	# Beware: Only if $site is specified in the cmdline does collectionConfig.xml get 
-	# generated and does $gs_mode=gs3, else collect.cfg gets generated and $gs_mode=gs2
+    # Beware: Only if $site is specified in the cmdline does collectionConfig.xml get 
+    # generated and does $gs_mode=gs3, else collect.cfg gets generated and $gs_mode=gs2
     my ($collect_cfg_filename, $gs_mode) = &colcfg::get_collect_cfg_name(STDERR);
     my $collectcfg = &colcfg::read_collection_cfg ($collect_cfg_filename,$gs_mode);
@@ -498,20 +507,16 @@
     }
 	
-	# We would like to know what the buildtype is
-	# This will be useful for Solr.	
-	if (-e $build_cfg_filename) {
-
-		# testing if there has been a change of indexer 
-		# (e.g. collect.cfg now says lucene, but build.cfg says mgpp)
-		my $buildcfg = &colcfg::read_building_cfg ($build_cfg_filename, $gs_mode);
-		if ($buildcfg->{'buildtype'} ne $collectcfg->{'buildtype'}) {
-			### do something? See incremental-buildcol.pl
-		}
-		else {
-			### do something? See incremental-buildcol.pl
-		}
-    }
-    else { # build.cfg doesn't exist
-		### do something? See incremental-buildcol.pl
+    # We need to know the buildtype for Solr.
+    # Any change of indexers is already detected and handled by the calling code (buildcol or 
+    # full-rebuild), so that at this stage the config file's buildtype reflects the actual buildtype.
+
+    # From buildcol.pl we use searchtype for determining buildtype, but for old versions, use buildtype
+    my $buildtype;
+    if (defined $collectcfg->{'buildtype'}) {
+	$buildtype = $collectcfg->{'buildtype'};
+    } elsif (defined $collectcfg->{'searchtypes'} || defined $collectcfg->{'searchtype'}) {
+	$buildtype = "mgpp";
+    } else {
+	$buildtype = "mg"; #mg is the default
     }
     
@@ -567,5 +572,5 @@
 	
 	if($removeold) {
-		
+	    
 		if(&util::dir_exists($index_dir)) {
 			&print_task_msg("Removing \"index\"");
