]> git.openstreetmap.org Git - nominatim.git/blobdiff - utils/update.php
make HTTP proxy setup explicit
[nominatim.git] / utils / update.php
index f0b45b428cf4b866c624ea5717272337bc3e1b7a..ff8b0c002465fceb6610c7b6ff9b23e8952ce789 100644 (file)
@@ -1,9 +1,9 @@
 <?php
 
-require_once(CONST_BasePath.'/lib/init-cmd.php');
-require_once(CONST_BasePath.'/lib/setup_functions.php');
-require_once(CONST_BasePath.'/lib/setup/SetupClass.php');
-require_once(CONST_BasePath.'/lib/setup/AddressLevelParser.php');
+require_once(CONST_LibDir.'/init-cmd.php');
+require_once(CONST_LibDir.'/setup_functions.php');
+require_once(CONST_LibDir.'/setup/SetupClass.php');
+require_once(CONST_LibDir.'/setup/AddressLevelParser.php');
 
 ini_set('memory_limit', '800M');
 
@@ -46,6 +46,8 @@ $aCMDOptions
 
 getCmdOpt($_SERVER['argv'], $aCMDOptions, $aResult, true, true);
 
+setupHTTPProxy();
+
 if (!isset($aResult['index-instances'])) $aResult['index-instances'] = 1;
 if (!isset($aResult['index-rank'])) $aResult['index-rank'] = 0;
 
@@ -70,6 +72,8 @@ $oOsm2pgsqlCmd = (new \Nominatim\Shell(CONST_Osm2pgsql_Binary))
                  ->addParams('--latlong')
                  ->addParams('--append')
                  ->addParams('--slim')
+                 ->addParams('--with-forward-dependencies', 'false')
+                 ->addParams('--log-progress', 'true')
                  ->addParams('--number-processes', 1)
                  ->addParams('--cache', $iCacheMemory)
                  ->addParams('--output', 'gazetteer')
@@ -97,7 +101,7 @@ if ($fPostgresVersion >= 11.0) {
 }
 
 
-$oIndexCmd = (new \Nominatim\Shell(CONST_BasePath.'/nominatim/nominatim.py'))
+$oIndexCmd = (new \Nominatim\Shell(CONST_DataDir.'/nominatim/nominatim.py'))
              ->addParams('--database', $aDSNInfo['database'])
              ->addParams('--port', $aDSNInfo['port'])
              ->addParams('--threads', $aResult['index-instances']);
@@ -191,7 +195,7 @@ if ($aResult['check-for-updates']) {
         fail('Updates not set up. Please run ./utils/update.php --init-updates.');
     }
 
-    $oCmd = (new \Nominatim\Shell(CONST_BasePath.'/utils/check_server_for_updates.py'))
+    $oCmd = (new \Nominatim\Shell(CONST_BinDir.'/check_server_for_updates.py'))
             ->addParams(CONST_Replication_Url)
             ->addParams($aLastState['sequence_id']);
     $iRet = $oCmd->run();
@@ -221,11 +225,11 @@ if (isset($aResult['import-diff']) || isset($aResult['import-file'])) {
 
 if ($aResult['calculate-postcodes']) {
     info('Update postcodes centroids');
-    $sTemplate = file_get_contents(CONST_BasePath.'/sql/update-postcodes.sql');
+    $sTemplate = file_get_contents(CONST_DataDir.'/sql/update-postcodes.sql');
     runSQLScript($sTemplate, true, true);
 }
 
-$sTemporaryFile = CONST_BasePath.'/data/osmosischange.osc';
+$sTemporaryFile = CONST_InstallDir.'/osmosischange.osc';
 $bHaveDiff = false;
 $bUseOSMApi = isset($aResult['import-from-main-api']) && $aResult['import-from-main-api'];
 $sContentURL = '';
@@ -241,15 +245,15 @@ if (isset($aResult['import-way']) && $aResult['import-way']) {
     if ($bUseOSMApi) {
         $sContentURL = 'https://www.openstreetmap.org/api/0.6/way/'.$aResult['import-way'].'/full';
     } else {
-        $sContentURL = 'https://overpass-api.de/api/interpreter?data=(way('.$aResult['import-way'].');node(w););out%20meta;';
+        $sContentURL = 'https://overpass-api.de/api/interpreter?data=(way('.$aResult['import-way'].');%3E;);out%20meta;';
     }
 }
 
 if (isset($aResult['import-relation']) && $aResult['import-relation']) {
     if ($bUseOSMApi) {
-        $sContentURLsModifyXMLstr = 'https://www.openstreetmap.org/api/0.6/relation/'.$aResult['import-relation'].'/full';
+        $sContentURL = 'https://www.openstreetmap.org/api/0.6/relation/'.$aResult['import-relation'].'/full';
     } else {
-        $sContentURL = 'https://overpass-api.de/api/interpreter?data=((rel('.$aResult['import-relation'].');way(r);node(w));node(r));out%20meta;';
+        $sContentURL = 'https://overpass-api.de/api/interpreter?data=(rel(id:'.$aResult['import-relation'].');%3E;);out%20meta;';
     }
 }
 
@@ -272,7 +276,7 @@ if ($bHaveDiff) {
 
 if ($aResult['recompute-word-counts']) {
     info('Recompute frequency of full-word search terms');
-    $sTemplate = file_get_contents(CONST_BasePath.'/sql/words_from_search_name.sql');
+    $sTemplate = file_get_contents(CONST_DataDir.'/sql/words_from_search_name.sql');
     runSQLScript($sTemplate, true, true);
 }
 
@@ -318,7 +322,7 @@ if ($aResult['import-osmosis'] || $aResult['import-osmosis-all']) {
              "Please check install documentation (https://nominatim.org/release-docs/latest/admin/Import-and-Update#setting-up-the-update-process)\n");
     }
 
-    $sImportFile = CONST_InstallPath.'/osmosischange.osc';
+    $sImportFile = CONST_InstallDir.'/osmosischange.osc';
 
     $oCMDDownload = (new \Nominatim\Shell(CONST_Pyosmium_Binary))
                     ->addParams('--server', CONST_Replication_Url)
@@ -377,7 +381,7 @@ if ($aResult['import-osmosis'] || $aResult['import-osmosis-all']) {
             // get the newest object from the diff file
             $sBatchEnd = 0;
             $iRet = 0;
-            $oCMD = new \Nominatim\Shell(CONST_BasePath.'/utils/osm_file_date.py', $sImportFile);
+            $oCMD = new \Nominatim\Shell(CONST_BinDir.'/osm_file_date.py', $sImportFile);
             exec($oCMD->escapedCmd(), $sBatchEnd, $iRet);
             if ($iRet == 5) {
                 echo "Diff file is empty. skipping import.\n";