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

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Thu Oct 20 04:41:18 PDT 2016


Author: armin11
Date: 2016-10-20 04:41:18 -0700 (Thu, 20 Oct 2016)
New Revision: 9619

Modified:
   trunk/mapbender/tools/mod_updateDatabaseUuid.php
Log:
Extent mb_group table for uuid column to sync organizations with other systems (ckan)

Modified: trunk/mapbender/tools/mod_updateDatabaseUuid.php
===================================================================
--- trunk/mapbender/tools/mod_updateDatabaseUuid.php	2016-10-20 11:41:01 UTC (rev 9618)
+++ trunk/mapbender/tools/mod_updateDatabaseUuid.php	2016-10-20 11:41:18 UTC (rev 9619)
@@ -21,11 +21,10 @@
 ALTER TABLE layer ADD COLUMN uuid UUID;
 ALTER TABLE wfs ADD COLUMN uuid UUID;
 ALTER TABLE wfs_featuretype ADD COLUMN uuid UUID;
+ALTER TABLE mb_group ADD COLUMN uuid UUID;
 */
-
-
-require_once dirname(__FILE__) . "/../../core/globalSettings.php";
-require_once dirname(__FILE__) . "/../classes/class_Uuid.php";
+require_once dirname(__FILE__) . "/../core/globalSettings.php";
+require_once dirname(__FILE__) . "/../http/classes/class_Uuid.php";
 /*
 //DROP uuid columns
 $v = array();
@@ -104,7 +103,7 @@
 		$resUpdate = db_prep_query($sqlUpdate,$vUpdate,$tUpdate);
 		$countLayerWithoutUuid++;
 }
-echo $countLayerWithoutUuid." Layer updated!";
+echo $countLayerWithoutUuid." Layer(s) updated!";
 echo "<br>";
 //end -- update layer table
 //update wfs table
@@ -140,8 +139,25 @@
 		$resUpdate = db_prep_query($sqlUpdate,$vUpdate,$tUpdate);
 		$countFeaturetypeWithoutUuid++;
 }
-echo $countFeaturetypeWithoutUuid." Featuretype updated!";
+echo $countFeaturetypeWithoutUuid." Featuretype(s) updated!";
 echo "<br>";
 //end -- update featuretype table
-
+//update mb_group table
+$v = array();
+$t = array();
+$sql = "SELECT mb_group_id FROM mb_group WHERE uuid IS NULL;";
+$res = db_prep_query($sql,$v,$t);
+$countGroupWithoutUuid = 0;
+while($row = db_fetch_array($res)){
+		$groupId = $row['mb_group_id'];
+		$uuid = new Uuid();
+		$vUpdate = array($uuid,$groupId);
+		$tUpdate = array('s');
+		$sqlUpdate = "UPDATE mb_group set uuid = $1 WHERE mb_group_id = $2;";
+		$resUpdate = db_prep_query($sqlUpdate,$vUpdate,$tUpdate);
+		$countGroupWithoutUuid++;
+}
+echo $countGroupWithoutUuid." Group(s) updated!";
+echo "<br>";
+//end -- update group table
 ?>



More information about the Mapbender_commits mailing list