[Mapbender-commits] r8367 - trunk/mapbender/http/classes

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Tue May 29 23:10:20 PDT 2012


Author: armin11
Date: 2012-05-29 23:10:19 -0700 (Tue, 29 May 2012)
New Revision: 8367

Modified:
   trunk/mapbender/http/classes/class_wfsToDb.php
   trunk/mapbender/http/classes/class_wfs_1_0_factory.php
   trunk/mapbender/http/classes/class_wfs_1_1_factory.php
Log:
Handling of MetadataURL for WFS featuretypes - bugfixes, less logging

Modified: trunk/mapbender/http/classes/class_wfsToDb.php
===================================================================
--- trunk/mapbender/http/classes/class_wfsToDb.php	2012-05-29 15:35:12 UTC (rev 8366)
+++ trunk/mapbender/http/classes/class_wfsToDb.php	2012-05-30 06:10:19 UTC (rev 8367)
@@ -266,7 +266,7 @@
 	 */
 	public static function delete ($aWfs) {
 		//first delete coupled metadata, cause there is no contraints in the database to do so
-		$e = new mb_notice("Deleting MetadataURLs");
+		$e = new mb_exception("Deleting MetadataURLs for wfs with id :".$aWfs->id);
 		WfsToDb::deleteFeatureTypeMetadataUrls($aWfs->id);
 		//then delete wfs itself
 		$sql = "DELETE FROM wfs WHERE wfs_id = $1";
@@ -898,21 +898,14 @@
 	 * @param $wfsId integer
 	 */
 	private static function deleteFeatureTypeMetadataUrls ($wfsId) {
-	
 		$e = new mb_notice("Deleting coupled WFS MetadataURLs from database.");
+		$sql = <<<SQL
 
-		$sql = "DELETE FROM mb_metadata INNER JOIN (select * from ows_relation_metadata where (internal is NULL OR internal != 1) and fkey_featuretype_id in ";
-		$sql .= "(select fkey_featuretype_id from wfs_featuretype where fkey_wfs_id = $1)) as relation on ";
-		$sql .= "mb_metadata.metadata_id = relation.fkey_metadata_id where mb_metadata.origin = 'capabilities'";
+DELETE FROM mb_metadata WHERE metadata_id IN (SELECT metadata_id FROM mb_metadata INNER JOIN (SELECT * FROM ows_relation_metadata WHERE (internal IS NULL OR internal != 1) AND fkey_featuretype_id IN (SELECT fkey_featuretype_id FROM wfs_featuretype WHERE fkey_wfs_id = $1)) AS relation ON mb_metadata.metadata_id = relation.fkey_metadata_id WHERE mb_metadata.origin = 'capabilities')
 
-		$sql = "DELETE FROM mb_metadata WHERE metadata_id IN (SELECT metadata_id FROM mb_metadata INNER JOIN (SELECT * from ows_relation_metadata WHERE fkey_featuretype_id IN " ;
-		$sql .= "(SELECT featuretype_id FROM wfs_featuretype WHERE fkey_wfs_id = $1 ";
-		$sql .= ") AND ows_relation_metadata.internal != 1 )";
-		$sql .= " as relation ON  mb_metadata.metadata_id = relation.fkey_metadata_id AND mb_metadata.origin = 'capabilities')";
-
+SQL;
 		$v = array($wfsId);
 		$t = array('i');
-
 		$res = db_prep_query($sql, $v, $t);
 		if (!$res) {
 			$e = new mb_exception("Error while deleting coupled WFS MetadataURLs from database.");
@@ -921,7 +914,6 @@
 		return true;
 	}
 
-
 	/**
 	 * Checks if a featuretype exists in the database. It selects the rows
 	 * that match the WFS id and the featuretype name.

Modified: trunk/mapbender/http/classes/class_wfs_1_0_factory.php
===================================================================
--- trunk/mapbender/http/classes/class_wfs_1_0_factory.php	2012-05-29 15:35:12 UTC (rev 8366)
+++ trunk/mapbender/http/classes/class_wfs_1_0_factory.php	2012-05-30 06:10:19 UTC (rev 8367)
@@ -205,11 +205,11 @@
 					foreach ($metadataURLArray as $metadataURL) {
 						//$e = new mb_exception("other srs: ".$otherSRS);
 						$featuretype_metadataUrl[$i_mdu]->href = $metadataURL;
-						$e = new mb_exception("metadataurl: ".$metadataURL);
+						$e = new mb_notice("metadataurl: ".$metadataURL);
 						$featuretype_metadataUrl[$i_mdu]->type = $metadataURL->attributes()->type;
-						$e = new mb_exception("type: ".$featuretype_metadataUrl[$i_mdu]->type);
+						$e = new mb_notice("type: ".$featuretype_metadataUrl[$i_mdu]->type);
 						$featuretype_metadataUrl[$i_mdu]->format = $metadataURL->attributes()->format;
-						$e = new mb_exception("format: ".$featuretype_metadataUrl[$i_mdu]->format);
+						$e = new mb_notice("format: ".$featuretype_metadataUrl[$i_mdu]->format);
 						$i_mdu++;
 					}
 					//do not add defective featuretypes - first request them via net

Modified: trunk/mapbender/http/classes/class_wfs_1_1_factory.php
===================================================================
--- trunk/mapbender/http/classes/class_wfs_1_1_factory.php	2012-05-29 15:35:12 UTC (rev 8366)
+++ trunk/mapbender/http/classes/class_wfs_1_1_factory.php	2012-05-30 06:10:19 UTC (rev 8367)
@@ -276,7 +276,7 @@
 				$i = 1; //cause index of xml objects begin with 1
 				foreach ($capFeatureTypes as $featureType) {
 					//debug
-					$e = new mb_exception("ft: ".$featureType->asXML());
+					$e = new mb_notice("ft: ".$featureType->asXML());
 					$featuretype_name = $featureType->Name[0];
 					$featuretype_title = $featureType->Title[0];
 					$featuretype_abstract = $featureType->Abstract[0];
@@ -284,7 +284,7 @@
 					$featuretype_srs = $featureType->DefaultSRS[0];
 					$otherSRSArray = $featureType->OtherSRS;
 					foreach ($otherSRSArray as $otherSRS) {
-						$e = new mb_exception("other srs: ".$otherSRS);
+						$e = new mb_notice("other srs: ".$otherSRS);
 						$featuretype_crsArray[] = $otherSRS;
 						
 					}
@@ -295,11 +295,11 @@
 					foreach ($metadataURLArray as $metadataURL) {
 						//$e = new mb_exception("other srs: ".$otherSRS);
 						$featuretype_metadataUrl[$i_mdu]->href = $metadataURL;
-						$e = new mb_exception("metadataurl: ".$metadataURL);
+						$e = new mb_notice("metadataurl: ".$metadataURL);
 						$featuretype_metadataUrl[$i_mdu]->type = $metadataURL->attributes()->type;
-						$e = new mb_exception("type: ".$featuretype_metadataUrl[$i_mdu]->type);
+						$e = new mb_notice("type: ".$featuretype_metadataUrl[$i_mdu]->type);
 						$featuretype_metadataUrl[$i_mdu]->format = $metadataURL->attributes()->format;
-						$e = new mb_exception("format: ".$featuretype_metadataUrl[$i_mdu]->format);
+						$e = new mb_notice("format: ".$featuretype_metadataUrl[$i_mdu]->format);
 						$i_mdu++;
 					}
 					//<ows:WGS84BoundingBox dimensions="2"><ows:LowerCorner>-9.16611817848171e+15 -3.4016616708962e+32</ows:LowerCorner><ows:UpperCorner>464605646503609 3.4016616708962e+32</ows:UpperCorner></ows:WGS84BoundingBox>



More information about the Mapbender_commits mailing list