svn commit: r752 - trunk/mapbender/http/php/mod_monitorCapabilities_main.php

christoph at osgeo.org christoph at osgeo.org
Thu Aug 10 08:05:50 EDT 2006


Author: christoph
Date: 2006-08-10 12:05:50+0000
New Revision: 752

Modified:
   trunk/mapbender/http/php/mod_monitorCapabilities_main.php

Log:
distinction browser/cli now seems to work

added some debugging code

Modified: trunk/mapbender/http/php/mod_monitorCapabilities_main.php
Url: https://mapbender.osgeo.org/source/browse/mapbender/trunk/mapbender/http/php/mod_monitorCapabilities_main.php?view=diff&rev=752&p1=trunk/mapbender/http/php/mod_monitorCapabilities_main.php&p2=trunk/mapbender/http/php/mod_monitorCapabilities_main.php&r1=751&r2=752
==============================================================================
--- trunk/mapbender/http/php/mod_monitorCapabilities_main.php	(original)
+++ trunk/mapbender/http/php/mod_monitorCapabilities_main.php	2006-08-10 12:05:50+0000
@@ -25,29 +25,34 @@
 db_select_db(DB,$con);
 $admin = new administration();
 
-$filename_array = explode("/", $PHP_SELF);
-$filename = $filename_array[count($filename_array)-1];
-
 //$user = "root";
+$user = "";
 $gui = "";
+$cl = 0;
 
 // retrieve username and gui_id
-if ($_SERVER["argv"][0] != $filename) {
+if ($_REQUEST['user']) {
+	$cl = 0;
 	//browser
+	echo "browser";
 	$user = $_REQUEST['user'];
 	$gui = $_REQUEST['gui'];
 }
-else {
+elseif ($_SERVER["argv"][1]) {
+	$cl = 1;
 	//command line
 	$p1 = $_SERVER["argv"][1];
 	$p2 = $_SERVER["argv"][2];
 	if (substr($p1, 0,5) == "user:") {
-		$user = substr($p1);
+		$user = substr($p1, 5);
 		if (substr($p2, 0,4) == "gui:") {
-			$gui = substr($p2);
+			$gui = substr($p2, 4);
 		}
 	}
 }
+else {
+	echo "Please specify a username!\n";die();
+}
 
 $userid = $admin->getUserIdByUserName($user);
 
@@ -72,9 +77,12 @@
 $wms_id_own = $admin->getWmsByOwnGuis($ownguis);
 
 // initialise monitoring processes
-echo "Starting monitoring cycle...\n<br/>\n<br/>";
-echo "WMS services are requested for availabiltiy.\n<br/> "; 
-echo "Capabilities documents are requested and all changes synchronized with the database cache.\n<br>\n<br>";
+echo "Starting monitoring cycle...\n\n";
+if ($cl == 0) echo "<br/><br/>";
+echo "WMS services are requested for availability.\n"; 
+if ($cl == 0) echo "<br/>";
+echo "Capabilities documents are requested and all changes synchronized with the database cache.\n\n";
+if ($cl == 0) echo "<br/><br/>";
 
 $time = strval(time()-2);
 
@@ -113,17 +121,20 @@
 for ($k=0; $k<count($wms_id_own); $k++) {
 
 	if (intval(AUTO_UPDATE)) {
-		$exec = PHP_PATH . "php mod_monitorCapabilities_write.php ".$wms_id_own[$k]." ".$time." 1 > ../tmp/output.txt &";
+		$exec = PHP_PATH . "php mod_monitorCapabilities_write.php ".$wms_id_own[$k]." ".$time." 1 > ../tmp/output_".$time."_".$wms_id_own[$k].".txt &";
 	}
 	else {
-		$exec = PHP_PATH . "php mod_monitorCapabilities_write.php ".$wms_id_own[$k]." ".$time." 0 > ../tmp/output.txt &";
+		$exec = PHP_PATH . "php mod_monitorCapabilities_write.php ".$wms_id_own[$k]." ".$time." 0 > ../tmp/output_".$time."_".$wms_id_own[$k].".txt &";
 	}
 	exec($exec);
 }
 echo "Monitoring Cycle completed (total: " . count($wms_id_own) . " wms).\n\n";
+if ($cl == 0) echo "<br/><br/>";
 set_time_limit(2*TIME_LIMIT);
 
 // wait until all monitoring processes are finished
+echo "please wait " . TIME_LIMIT . " seconds for the monitoring to finish...\n\n";
+if ($cl == 0) echo "<br/><br/>";
 sleep(TIME_LIMIT);
 
 $sql = "SELECT fkey_wms_id, status, status_comment, timestamp_begin, timestamp_end, upload_url FROM mb_monitor WHERE upload_id = $1";
@@ -154,6 +165,8 @@
 		$new_res = db_prep_query($new_sql,$new_v,$new_t);
 	}
 	// compose mail message
+	echo $wms_id[$i] . ": status " . $status[$i] . "\n";
+	if ($cl == 0) echo "<br/><br/>";
 	if ($status[$i] == -1) {
 		$body .= $admin->getWmsTitleByWmsId($wms_id[$i]) . " (" . $wms_id[$i] . "): " . $comment[$i] . "\n\n";
 	}




More information about the Mapbender_commits mailing list