[Mapbender-commits] r9386 - trunk/mapbender/http/classes
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Mon Jan 25 02:32:44 PST 2016
Author: verenadiewald
Date: 2016-01-25 02:32:44 -0800 (Mon, 25 Jan 2016)
New Revision: 9386
Modified:
trunk/mapbender/http/classes/class_wfsToDb.php
Log:
updateWFS: overwrite WFS metadata only if MD_OVERWRITE is true
Modified: trunk/mapbender/http/classes/class_wfsToDb.php
===================================================================
--- trunk/mapbender/http/classes/class_wfsToDb.php 2016-01-21 14:07:01 UTC (rev 9385)
+++ trunk/mapbender/http/classes/class_wfsToDb.php 2016-01-25 10:32:44 UTC (rev 9386)
@@ -190,53 +190,33 @@
db_begin();
// update WFS
- $sql = "UPDATE wfs SET wfs_version = $1, wfs_name = $2, wfs_title = $3, ";
- $sql .= "wfs_abstract = $4, wfs_getcapabilities = $5, wfs_getcapabilities_doc = $6, ";
- $sql .= "wfs_upload_url = $7, wfs_describefeaturetype = $8, wfs_getfeature = $9, ";
- $sql .= "wfs_transaction = $10, fees = $11, accessconstraints = $12, ";
- $sql .= "individualname = $13, positionname = $14, providername = $15, ";
- $sql .= "city = $16, deliverypoint = $17, administrativearea = $18, ";
- $sql .= "postalcode = $19, voice = $20, facsimile = $21, ";
- $sql .= "electronicmailaddress = $22, country = $23, ";
- $sql .= "wfs_timestamp = $24, wfs_network_access = $25, fkey_mb_group_id = $26, wfs_max_features = $28, inspire_annual_requests = $29, wfs_username = $30, wfs_password = $31, wfs_auth_type = $32";
- $sql .= "WHERE wfs_id = $27";
+ $sql = "UPDATE wfs SET wfs_version = $1, wfs_name = $2, wfs_getcapabilities = $3, wfs_getcapabilities_doc = $4, ";
+ $sql .= "wfs_upload_url = $5, wfs_describefeaturetype = $6, wfs_getfeature = $7, ";
+ $sql .= "wfs_transaction = $8, wfs_timestamp = $9, wfs_network_access = $10, fkey_mb_group_id = $11, ";
+ $sql .= "wfs_max_features = $12, inspire_annual_requests = $13, wfs_username = $14, wfs_password = $15, wfs_auth_type = $16 ";
+ $sql .= "WHERE wfs_id = $17";
$v = array(
$aWfs->getVersion(),
$aWfs->name,
- $aWfs->title,
- $aWfs->summary,
$aWfs->getCapabilities,
$aWfs->getCapabilitiesDoc,
$aWfs->uploadUrl,
$aWfs->describeFeatureType,
$aWfs->getFeature,
$aWfs->transaction,
- $aWfs->fees,
- $aWfs->accessconstraints,
- $aWfs->individualName,
- $aWfs->positionName,
- $aWfs->providerName,
- $aWfs->city,
- $aWfs->deliveryPoint,
- $aWfs->administrativeArea,
- $aWfs->postalCode,
- $aWfs->voice,
- $aWfs->facsimile,
- $aWfs->electronicMailAddress,
- $aWfs->country,
strtotime("now"),
$aWfs->wfs_network_access,
$aWfs->fkey_mb_group_id,
- $aWfs->id,
$aWfs->wfs_max_features,
$aWfs->inspire_annual_requests,
$aWfs->auth['username'],
$aWfs->auth['password'],
$aWfs->auth['auth_type'],
+ $aWfs->id
);
- $t = array('s', 's', 's', 's', 's', 's', 's', 's' ,'s' ,'s' ,'s' ,'s','s' ,'s','s','s','s','s','s','s','s','s','s','i','i','i','i','i','i','s','s','s');
+ $t = array('s','s','s','s','s','s','s','s','s','i','i','i','i','s','s','s','i');
$e = new mb_notice("class_wfsToDb.php: UPDATING WFS " . $aWfs->id);
$res = db_prep_query($sql, $v, $t);
if (!$res) {
@@ -245,6 +225,54 @@
return false;
}
+ //update following metadata only if intended - mapbender.conf
+ if($aWfs->overwrite == true){
+ $sql = "UPDATE wfs SET ";
+ $sql .= "wfs_title = $1 ,";
+ $sql .= "wfs_abstract = $2 ,";
+ $sql .= "fees = $3, ";
+ $sql .= "accessconstraints = $4, ";
+ $sql .= "individualName = $5, ";
+ $sql .= "positionname = $6, ";
+ $sql .= "providername = $7, ";
+ $sql .= "city = $8, ";
+ $sql .= "deliverypoint = $9, ";
+ $sql .= "administrativearea = $10, ";
+ $sql .= "postalcode = $11, ";
+ $sql .= "voice = $12, ";
+ $sql .= "facsimile = $13, ";
+ $sql .= "electronicmailaddress = $14, ";
+ $sql .= "country = $15, ";
+ $sql .= "wfs_network_access = $16, ";
+ $sql .= "wfs_max_features = $17, ";
+ $sql .= "fkey_mb_group_id = $18 ";
+ $sql .= " WHERE wfs_id = $19";
+ $v = array($aWfs->title,
+ $aWfs->summary,
+ $aWfs->fees,
+ $aWfs->accessconstraints,
+ $aWfs->individualName,
+ $aWfs->positionName,
+ $aWfs->providerName,
+ $aWfs->city,
+ $aWfs->deliveryPoint,
+ $aWfs->administrativeArea,
+ $aWfs->postalCode,
+ $aWfs->voice,
+ $aWfs->facsimile,
+ $aWfs->electronicMailAddress,
+ $aWfs->country,
+ $aWfs->wfs_network_access,
+ $aWfs->wfs_max_features,
+ $aWfs->fkey_mb_group_id,
+ $aWfs->id);
+ $t = array('s','s','s','s','s','s','s','s','s','s','s','s','s','s','s','i','i','i','i');
+ $res = db_prep_query($sql,$v,$t);
+ if(!$res){
+ db_rollback();
+ }
+ }
+
// delete and refill WFS operations
$sql = "DELETE FROM wfs_operation WHERE fkey_wfs_id = $1 ";
$v = array($aWfs->id);
@@ -1222,14 +1250,13 @@
return;
}
+ //don't update title, abstract when not explicitly demanded thru $overwrite == true
$sql = "UPDATE wfs_featuretype SET ";
- $sql .= "featuretype_title = $1,";
- $sql .= "featuretype_abstract = $2,";
- $sql .= "featuretype_searchable = $3,";
- $sql .= "featuretype_srs = $4, ";
- $sql .= "featuretype_latlon_bbox = $5, ";
- $sql .= "inspire_download = $7 ";
- $sql .= "WHERE featuretype_id = $6";
+ $sql .= "featuretype_searchable = $1,";
+ $sql .= "featuretype_srs = $2, ";
+ $sql .= "featuretype_latlon_bbox = $3, ";
+ $sql .= "inspire_download = $4 ";
+ $sql .= "WHERE featuretype_id = $5";
if (!$updateMetadataOnly) {
//read inspire_download and featuretype_searchable from database if update from capabilities
@@ -1245,15 +1272,13 @@
}
$v = array(
- $aWfsFeatureType->title,
- $aWfsFeatureType->summary,
$aWfsFeatureType->searchable,
$aWfsFeatureType->srs,
$aWfsFeatureType->latLonBboxArray['minx'].','.$aWfsFeatureType->latLonBboxArray['miny'].','.$aWfsFeatureType->latLonBboxArray['maxx'].','.$aWfsFeatureType->latLonBboxArray['maxy'],
$aWfsFeatureType->id,
$aWfsFeatureType->inspire_download
);
- $t = array('s','s','s','s','s','i','i');
+ $t = array('s','s','s','i','i');
$e = new mb_notice("class_wfsToDb.php: UPDATING Featuretype (FT: $aWfsFeatureType->id)");
@@ -1261,6 +1286,19 @@
$e = new mb_notice("class_wfsToDb.php: UPDATING Featuretype (FT inspire_download: $aWfsFeatureType->inspire_download)");
$res = db_prep_query($sql,$v,$t);
+
+ if($overwrite){
+ $e = new mb_notice("class_wfsToDb.php - overwrite has been activated");
+ $sql = "UPDATE wfs_featuretype SET ";
+ $sql .= "featuretype_title = $1, ";
+ $sql .= "featuretype_abstract = $2 ";
+ $sql .= "WHERE featuretype_id = $3";
+
+ $v = array($aWfsFeatureType->title,$aWfsFeatureType->summary, $aWfsFeatureType->id);
+ $t = array('s','s','i');
+ $res = db_prep_query($sql,$v,$t);
+ }
+
if (!$res) {
$e = new mb_exception("Error while updating WFS feature type in database.");
return false;
@@ -1330,7 +1368,7 @@
}
// update categories for feature type
- if ($overwrite) {
+ if($overwrite){
$types = array("md_topic", "inspire", "custom");
foreach ($types as $cat) {
$sql = "DELETE FROM wfs_featuretype_{$cat}_category WHERE fkey_featuretype_id = $1 AND fkey_metadata_id ISNULL";
More information about the Mapbender_commits
mailing list