[Mapbender-commits] r10120 - trunk/mapbender/tools
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Fri May 10 05:52:33 PDT 2019
Author: armin11
Date: 2019-05-10 05:52:32 -0700 (Fri, 10 May 2019)
New Revision: 10120
Modified:
trunk/mapbender/tools/mod_runScheduler.php
Log:
Fix for wms update scheduler with authenticated wms
Modified: trunk/mapbender/tools/mod_runScheduler.php
===================================================================
--- trunk/mapbender/tools/mod_runScheduler.php 2019-05-10 11:08:21 UTC (rev 10119)
+++ trunk/mapbender/tools/mod_runScheduler.php 2019-05-10 12:52:32 UTC (rev 10120)
@@ -3,9 +3,9 @@
require_once(dirname(__FILE__)."/../http/classes/class_wms.php");
$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,
+SELECT scheduler_id, wms_id, wms_title, wms_auth_type, wms_username, wms_password, to_timestamp(wms_timestamp)::date AS last_change, last_status, fkey_upload_id, wms_upload_url,
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_status FROM (SELECT scheduler_id, wms_id, fkey_wms_id, wms_title, wms_timestamp, wms_owner, wms_auth_type, wms_username, wms_password,
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
@@ -32,9 +32,14 @@
"scheduler_searchable" => $row['scheduler_searchable'],
"scheduler_overwrite" => $row['scheduler_overwrite'],
"scheduler_overwrite_categories" => $row['scheduler_overwrite_categories'],
- "scheduler_status" => $row['scheduler_status']
+ "scheduler_status" => $row['scheduler_status'],
+ "wms_auth_type" => $row['wms_auth_type'],
+ "wms_username" => $row['wms_username'],
+ "wms_password" => $row['wms_password']
);
+ //echo json_encode($resultObj)."\n";
+
if($row['scheduler_interval'] == '1 mon') {
$row['scheduler_interval'] = "1 month";
}
@@ -46,9 +51,10 @@
$schedulerDateMonitoring = date("Y-m-d",strtotime(date("Y-m-d", $row['fkey_upload_id']) . $row['scheduler_interval']));
//if calculated $schedulerDateTimestamp is in the past
- //or last_status value of monitoring does not have the value 1 which means wms has been updated by monitoring
+ //or last_status value of monitoring does not have the value 1 which means wms has changed!
if($currentDate >= $schedulerDateTimestamp) {
if ($row['last_status'] == 1) {
+ //nothing to change!!!!
if($currentDate >= $schedulerDateMonitoring) {
array_push($wmsToUpdate, $resultObj);
}
@@ -56,8 +62,9 @@
array_push($wmsToUpdate, $resultObj);
}
} else {
- if ($row['last_status'] == 0) {
- array_push($wmsToUpdate, $resultObj);
+ //if service is not up to date
+ if ($row['last_status'] == 0 || $row['last_status'] == -1 || $row['last_status'] == -2) {
+ array_push($wmsToUpdate, $resultObj);
}
}
}
@@ -69,10 +76,25 @@
die();*/
for ($i=0; $i<count($wmsToUpdate); $i++) {
//create new wms object
+ echo "\nTry to call wms ".$wmsToUpdate[$i]['wms_id']."\n";
+ //echo "auth_type: ".$wmsToUpdate[$i]['wms_auth_type']."\n";
+ //echo "auth_username: ".$wmsToUpdate[$i]['wms_username']."\n";
+ //echo "auth_password: ".$wmsToUpdate[$i]['wms_password']."\n";
$updateWms = new wms();
$updateWms->harvestCoupledDatasetMetadata = true;
+ //check for authentication!
+ $auth = null;
try {
- $createObjFromXml = $updateWms->createObjFromXML($wmsToUpdate[$i]['wms_upload_url']);
+ if ($wmsToUpdate[$i]['wms_auth_type'] == "basic" || $wmsToUpdate[$i]['wms_auth_type'] == "digest"){
+ //echo "call with auth array!"."\n";
+ $auth = array();
+ $auth['auth_type'] = $wmsToUpdate[$i]['wms_auth_type'];
+ $auth['username'] = $wmsToUpdate[$i]['wms_username'];
+ $auth['password'] = $wmsToUpdate[$i]['wms_password'];
+ $createObjFromXml = $updateWms->createObjFromXML($wmsToUpdate[$i]['wms_upload_url'], $auth);
+ } else {
+ $createObjFromXml = $updateWms->createObjFromXML($wmsToUpdate[$i]['wms_upload_url']);
+ }
}
catch(Exception $e) {
throw $e;
More information about the Mapbender_commits
mailing list