[Mapbender-commits] r8744 - in trunk/mapbender: http/classes tools
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Mon Dec 2 01:26:46 PST 2013
Author: armin11
Date: 2013-12-02 01:26:46 -0800 (Mon, 02 Dec 2013)
New Revision: 8744
Modified:
trunk/mapbender/http/classes/class_wms.php
trunk/mapbender/tools/mod_runScheduler.php
Log:
Bugfix for wms update scheduler with metadataurls - set wms_owner to metadata owner id
Modified: trunk/mapbender/http/classes/class_wms.php
===================================================================
--- trunk/mapbender/http/classes/class_wms.php 2013-12-01 15:27:47 UTC (rev 8743)
+++ trunk/mapbender/http/classes/class_wms.php 2013-12-02 09:26:46 UTC (rev 8744)
@@ -2602,6 +2602,10 @@
$mbMetadata = new Iso19139();
$randomid = new Uuid();
$mdOwner = Mapbender::session()->get("mb_user_id");
+ //The next loop is needed for automatic wms update - no session exists!
+ if ($mdOwner == false) {
+ $mdOwner = $this->owner;
+ }
$mbMetadata->randomId = $randomid;
$mbMetadata->href = $this->objLayer[$i]->layer_metadataurl[$j]->href;
$mbMetadata->format = $this->objLayer[$i]->layer_metadataurl[$j]->format;
Modified: trunk/mapbender/tools/mod_runScheduler.php
===================================================================
--- trunk/mapbender/tools/mod_runScheduler.php 2013-12-01 15:27:47 UTC (rev 8743)
+++ trunk/mapbender/tools/mod_runScheduler.php 2013-12-02 09:26:46 UTC (rev 8744)
@@ -4,8 +4,8 @@
$sql = <<<SQL
SELECT scheduler_id, wms_id, wms_title, to_timestamp(wms_timestamp)::date AS last_change, last_status, fkey_upload_id, wms_upload_url,
-scheduler_interval,scheduler_mail,scheduler_publish,scheduler_searchable,scheduler_overwrite, scheduler_overwrite_categories,
-scheduler_status FROM (SELECT scheduler_id, wms_id, fkey_wms_id, wms_title, wms_timestamp,
+scheduler_interval,scheduler_mail,wms_owner,scheduler_publish,scheduler_searchable,scheduler_overwrite, scheduler_overwrite_categories,
+scheduler_status FROM (SELECT scheduler_id, wms_id, fkey_wms_id, wms_title, wms_timestamp, wms_owner,
scheduler_interval,scheduler_mail,scheduler_publish,scheduler_searchable,scheduler_overwrite,scheduler_overwrite_categories,
scheduler_status,wms_upload_url FROM scheduler
INNER JOIN wms ON scheduler.fkey_wms_id=wms.wms_id ) AS test
@@ -25,6 +25,7 @@
"last_status" => $row['last_status'],
"wms_upload_url" => $row['wms_upload_url'],
"fkey_upload_id" => $row['fkey_upload_id'],
+ "wms_owner" => $row['wms_owner'],
"scheduler_interval" => $row['scheduler_interval'],
"scheduler_mail" => $row['scheduler_mail'],
"scheduler_publish" => $row['scheduler_publish'],
@@ -63,17 +64,14 @@
//for debugging purpose:
/*for ($i=0; $i<count($wmsToUpdate); $i++) {
echo "wms_id: ".$wmsToUpdate[$i]['wms_id']."\n";
+ echo "wms_owner: ".$wmsToUpdate[$i]['wms_owner']."\n";
}
-
-die();
-*/
+die();*/
for ($i=0; $i<count($wmsToUpdate); $i++) {
- #echo "WMS ID = ".$wmsToUpdate[$i]['wms_id']."\n";
- #echo "WMS URL = ".$wmsToUpdate[$i]['wms_upload_url']."\n";
-
//create new wms object
$updateWms = new wms();
$createObjFromXml = $updateWms->createObjFromXML($wmsToUpdate[$i]['wms_upload_url']);
+ $updateWms->owner = $wmsToUpdate[$i]['wms_owner'];
if(!$createObjFromXml['success']) {
//$errorMsg = "Error while creating object from GetCapabilities XML";
$errorMsg =$createObjFromXml['message'];
@@ -105,8 +103,9 @@
$updateWms->setGeoRss=false;
echo "publish = false\n";
}
-
+ echo "Start update of ".$wmsToUpdate[$i]['wms_id']."\n";
$updateObjInDb = $updateWms->updateObjInDB($wmsToUpdate[$i]['wms_id']);
+
if(!$updateObjInDb) {
$errorMsg = "Error while updating wms object in database";
}
More information about the Mapbender_commits
mailing list