[Mapbender-commits] r1504 - trunk/mapbender/http/php

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Wed Jul 18 09:26:20 EDT 2007


Author: christoph
Date: 2007-07-18 09:26:20 -0400 (Wed, 18 Jul 2007)
New Revision: 1504

Removed:
   trunk/mapbender/http/php/mod_monitorWMS.php
Log:
replaced by mod_monitorCapabilities_main

Deleted: trunk/mapbender/http/php/mod_monitorWMS.php
===================================================================
--- trunk/mapbender/http/php/mod_monitorWMS.php	2007-07-18 13:25:31 UTC (rev 1503)
+++ trunk/mapbender/http/php/mod_monitorWMS.php	2007-07-18 13:26:20 UTC (rev 1504)
@@ -1,171 +0,0 @@
-<?php
-# $Id$
-# http://www.mapbender.org/index.php/Monitor_Capabilities
-# Copyright (C) 2002 CCGIS 
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
-require_once(dirname(__FILE__)."/../../conf/mapbender.conf");
-import_request_variables("PG");
-?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-<?php
-echo '<meta http-equiv="Content-Type" content="text/html; charset='.CHARSET.'">';	
-?>
-<title>Monitor WMS Capabilities</title>
-<link rel="stylesheet" type="text/css" href="../css/administration_alloc.css">
-</head>
-<body>
-<?php
-require_once(dirname(__FILE__)."/../classes/class_wms.php");
-require_once(dirname(__FILE__)."/../classes/class_administration.php");
-
-$con = db_connect($DBSERVER,$OWNER,$PW);
-db_select_db(DB,$con);
-
-$admin = new administration();
-$ownguis = $admin->getGuisByOwner($_SESSION["mb_user_id"],true);
-$permguis = $admin->getGuisByPermission($_SESSION["mb_user_id"],true);
-$wms_id_own = $admin->getWmsByOwnGuis($ownguis);
-
-$sql = "SELECT fkey_wms_id, wms_getmap FROM wms_monitor";
-$res = db_query($sql);	
-$wmsList = array();
-$i=0;
-while($row = db_fetch_array($res)){
-	$wmsList[$i] = array();
-	$wmsList[$i]["id"] = $row['fkey_wms_id'];
-	$wmsList[$i]["getmap"] = $row['wms_getmap'];
-	$i++; 
-}		
-
-
-//$someUrl = "http://www2.demis.nl/wms/wms.asp?wms=WorldMap&VERSION=1.1.1&REQUEST=GetMap&SERVICE=WMS&LAYERS=Bathymetry,Countries,Topogghraphy,Hillshading,Builtup%20areas,Coastlines,Waterbodies,Inundated,Rivers,Streams,Railroads,Highways,Roads,Trails,Borders,Cities,Settlements,Spot%20elevations,Airports,Ocean%20features&STYLES=,,,,,,,,,,,,,,,,,,,&SRS=EPSG:4326&BBOX=-106.8888888888889,-80,80.8888888888889,89&WIDTH=500&HEIGHT=450&FORMAT=image/png&BGCOLOR=0xffffff&TRANSPARENT=TRUE";
-//$remoteXml = fetchUrlWithoutHanging($someUrl);
-//$remoteXml = implode("", file($someUrl));
-//echo $remoteXml;
-function microtime_float()
-{
-   list($usec, $sec) = explode(" ", microtime());
-   return ((float)$usec + (float)$sec);
-}
-
-function fetchUrlWithoutHanging($url){
-	// Set maximum number of seconds to wait for feed before displaying page without feed
-	$numberOfSeconds=20;
-	// Suppress error reporting so Web site visitors are unaware if the feed fails
-	error_reporting(0);
-	// Extract resource path and domain from URL ready for fsockopen
-	$url = str_replace("http://","",$url);
-	$urlComponents = explode("/",$url);
-	$domain = $urlComponents[0];
-	$resourcePath = str_replace($domain,"",$url);
-	$resourcePath = str_replace(" ", "%20", $resourcePath);
-	
-	// Establish a connection
-	$socketConnection = fsockopen($domain, 80, $errno, $errstr, $numberOfSeconds);
-	if (!$socketConnection) {
-		// You may wish to remove the following debugging line on a live Web site
-		print("<!-- Network error: $errstr ($errno) -->");
-		return false;
-	}	// end if
-	else {
-		$xml = '';
- 	    fputs($socketConnection, "GET /$resourcePath HTTP/1.0\r\nHost: $domain\r\n\r\n");
- 	    
- 		// Loop until end of file
-		while (!feof($socketConnection)){
-			$xml .= fgets($socketConnection, 128);
-		}    // end while
-		fclose ($socketConnection);
-	} // end else
-	return($xml);
-} // end function
-
-//for ($k=0; $k<count($wms_id_own) && 0 == 1; $k++) {
-echo "Starting monitoring cycle...<br><br>";
-echo "WMS services are requested for availabiltiy. "; 
-echo "Capabilities documents are requested and all changes synchronized with the database cache.<br><br>";
-echo "<table cellspacing=10 cellpadding = 8 border = 1>";
-for ($k=0; $k<count($wmsList); $k++) {
-	$wmsId = $wmsList[$k]["id"];
-	$wmsGetmap = $wmsList[$k]["getmap"];
-	echo "<tr><td><b>Processing WMS</b> (ID = " . $wmsId . ")<br>";
-
-	$sql = "SELECT wms_title FROM wms WHERE wms_id = '" . $wmsId . "'";
-	$res = db_query($sql);
-	$someArray = db_fetch_row($res);
-	$wms_title = $someArray[0];
-
-	echo "WMS Title: <b><i>" . $wms_title . "</i></b><br/>";
-	echo "<a href='" . $wmsGetmap . "' target=_blank>getmap</a><br/><br />";
-	set_time_limit(30);
-
-	$wmsGetmap = eregi_replace("EXCEPTIONS=[^&]*","EXCEPTIONS=application/vnd.ogc.se_xml",$wmsGetmap);
-
-	$request_start = microtime_float();
-	$remoteXml = fetchUrlWithoutHanging($wmsGetmap);
-	$request_end = microtime_float();
-	$duration = $request_end - $request_start;  
-	$duration_str = "<br><span style=\"font-size:70%\">query time: " . round($duration,3) . " s</span>";
-
-	if ($remoteXml == false) {
-		echo "Connection failed." . $duration_str. "</td><td><img src ='../img/trafficlights/stop.bmp'></td></tr>";
-	}
-	else {
-		if (strpos($remoteXml, "Content-Type: image")) {
-			echo "Connection established, getmap query successful.".$duration_str."</td><td><img src ='../img/trafficlights/go.bmp'></td></tr>";
-		}
-		else {
-			echo "Connection established, getmap query failed.".$duration_str."</td><td><img src ='../img/trafficlights/wait.bmp'></td></tr>";
-		}
-	}
-	
-	#echo $remoteXml;
-		//print_r($localXmlArray);
-		//print_r($remoteXmlArray);			
-#		if (!$remoteXml) {
-#			$result = -1;
-//			echo "Can't connect to " . $myURL . "";
-#			echo "Connection failed.</td><td><img src ='../img/trafficlights/stop.bmp'></td></tr>";
-#		}
-#		elseif (!$localXml) {
-#			$result = 0;
-#		}
-#		else {
-#			if ($localXml == $remoteXml) {
-#				$result = 1;
-#				echo "WMS is stable.";
-#			}
-#			else {
-#				$result = 0;
-#			}
-#		}
-#		if ($result == 0) {
-#			echo "Updating WMS " . $wmsId . "...";
-#			$mywms = new wms();
-#			$mywms->createObjFromXML($myURL);    
-#			$mywms->updateObjInDB($wmsId);
-#		}
-#	}
-}
-echo "</table>";
-echo "<br>Monitoring Cycle completed.";
-?>
-</body>
-</html>
\ No newline at end of file



More information about the Mapbender_commits mailing list