[Mapbender-commits] r10031 - trunk/mapbender/tools

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Thu Jan 17 11:14:49 PST 2019


Author: armin11
Date: 2019-01-17 11:14:49 -0800 (Thu, 17 Jan 2019)
New Revision: 10031

Modified:
   trunk/mapbender/tools/registerOwsCli.php
Log:
Allow the registrating of wfs via cli

Modified: trunk/mapbender/tools/registerOwsCli.php
===================================================================
--- trunk/mapbender/tools/registerOwsCli.php	2019-01-17 16:47:07 UTC (rev 10030)
+++ trunk/mapbender/tools/registerOwsCli.php	2019-01-17 19:14:49 UTC (rev 10031)
@@ -1,6 +1,9 @@
 <?php
 require_once(dirname(__FILE__)."/../core/globalSettings.php");
 require_once(dirname(__FILE__)."/../http/classes/class_wms.php");
+require_once(dirname(__FILE__)."/../http/classes/class_universal_wfs_factory.php");
+require_once(dirname(__FILE__)."/../http/classes/class_gui.php"); 
+
 //require_once(dirname(__FILE__)."/../http/classes/class_administration.php");
 //require_once dirname(__FILE__) . "/../http/php/mb_validatePermission.php";
 //require_once(dirname(__FILE__)."/../http/classes/class_user.php");
@@ -16,6 +19,10 @@
 //
 //example: php registerOwsCli.php userId=1 guiId="Geoportal-RLP" serviceType="wms" serviceAccessUrl="http://www.geoportal.rlp.de/mapbender/php/mod_showMetadata.php/../wms.php?layer_id=61681&REQUEST=GetCapabilities&VERSION=1.1.1&SERVICE=WMS&withChilds=1"
 //example for integration in bash script: wms_id_1=`/usr/bin/php -f registerOwsCli.php userId=1 guiId='Geoportal-RLP' serviceType='wms' serviceAccessUrl='http://www.geoportal.rlp.de/mapbender/php/mod_showMetadata.php/../wms.php?layer_id=61681&REQUEST=GetCapabilities&VERSION=1.1.1&SERVICE=WMS&withChilds=1'`
+
+//example for wfs:
+//php registerOwsCli.php userId=1 guiId="Geoportal-RLP" serviceType="wfs" serviceAccessUrl="http://www.geoportal.rlp.de/mapbender/php/wfs.php?INSPIRE=1&FEATURETYPE_ID=1955&request=GetCapabilities&VERSION=1.1.0&SERVICE=WFS"
+
 //***************************************************************
 //parse arguments
 $arguments = $argv;
@@ -55,6 +62,8 @@
 	$result = $mywms->createObjFromXML($serviceAccessUrl);
 	if ($result['success']) {
 		$mywms->writeObjInDB($guiId, true, (integer)$userId);  
+		echo $mywms->wms_id;
+		die();
 	} else {
 		//echo $result['message'];
 		echo "error";
@@ -62,6 +71,23 @@
 	}
         break;
     case "wfs":
+	$myWfsFactory = new UniversalWfsFactory();			
+	$mywfs = $myWfsFactory->createFromUrl($serviceAccessUrl); 
+	//$mywms->setGeoRss = false;
+        //$mywms->twitterNews = false;
+	//$mywms->harvestCoupledDatasetMetadata = true;
+	$mywfs->owner = $userId;
+	if (!is_null($mywfs)) {
+		$mywfs->insertOrUpdate($userId);  
+		$currentApp = new gui($guiId);
+		$currentApp->addWfs($mywfs);
+		echo $mywfs->wfs_id;
+		die();
+	} else {
+		//echo $result['message'];
+		echo "error";
+		die();
+	}
         break;
 }
 //$mywms->displayWMS();



More information about the Mapbender_commits mailing list