]> git.openstreetmap.org Git - nominatim.git/blobdiff - lib-php/admin/setup.php
move import-data option to native python
[nominatim.git] / lib-php / admin / setup.php
index 241b873caffc919f1ecf55bcfa6f4e09132b2ac3..d38313221c1ad4e7307ccd1ce1bee7abad4750e1 100644 (file)
@@ -56,6 +56,15 @@ setupHTTPProxy();
 
 $bDidSomething = false;
 
+$oNominatimCmd = new \Nominatim\Shell(getSetting('NOMINATIM_TOOL'));
+if (isset($aCMDResult['quiet']) && $aCMDResult['quiet']) {
+    $oNominatimCmd->addParams('--quiet');
+}
+if ($aCMDResult['verbose']) {
+    $oNominatimCmd->addParams('--verbose');
+}
+
+
 //*******************************************************
 // Making some sanity check:
 // Check if osm-file is set and points to a valid file
@@ -72,17 +81,30 @@ $oSetup = new SetupFunctions($aCMDResult);
 // go through complete process if 'all' is selected or start selected functions
 if ($aCMDResult['create-db'] || $aCMDResult['all']) {
     $bDidSomething = true;
-    $oSetup->createDB();
+    (clone($oNominatimCmd))->addParams('transition', '--create-db')->run(true);
 }
 
 if ($aCMDResult['setup-db'] || $aCMDResult['all']) {
     $bDidSomething = true;
-    $oSetup->setupDB();
+    $oCmd = (clone($oNominatimCmd))->addParams('transition', '--setup-db');
+
+    if ($aCMDResult['no-partitions'] ?? false) {
+        $oCmd->addParams('--no-partitions');
+    }
+
+    $oCmd->run(true);
 }
 
 if ($aCMDResult['import-data'] || $aCMDResult['all']) {
     $bDidSomething = true;
-    $oSetup->importData($aCMDResult['osm-file']);
+    $oCmd = (clone($oNominatimCmd))
+        ->addParams('transition', '--import-data')
+        ->addParams('--osm-file', $aCMDResult['osm-file']);
+    if ($aCMDResult['drop'] ?? false) {
+        $oCmd->addParams('--drop');
+    }
+
+    $oCmd->run(true);
 }
 
 if ($aCMDResult['create-functions'] || $aCMDResult['all']) {