X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/4e478c8af0dff8d7de52ea22e4e0b817135cb28c..65c89194fccef562c544c05dbcef0d9e6ad16a0d:/utils/update.php diff --git a/utils/update.php b/utils/update.php old mode 100755 new mode 100644 index f5c20857..8e118834 --- a/utils/update.php +++ b/utils/update.php @@ -1,10 +1,9 @@ -#!@PHP_BIN@ -Cq getTotalMemoryMB()) { $iCacheMemory = getCacheMemoryMB(); echo "WARNING: resetting cache memory to $iCacheMemory\n"; } -$sOsm2pgsqlCmd = CONST_Osm2pgsql_Binary.' -klas --number-processes 1 -C '.$iCacheMemory.' -O gazetteer -d '.$aDSNInfo['database'].' -P '.$aDSNInfo['port']; +$sOsm2pgsqlCmd = CONST_Osm2pgsql_Binary.' -klas --number-processes 1 -C '.$iCacheMemory.' -O gazetteer -S '.CONST_Import_Style.' -d '.$aDSNInfo['database'].' -P '.$aDSNInfo['port']; if (isset($aDSNInfo['username']) && $aDSNInfo['username']) { $sOsm2pgsqlCmd .= ' -U ' . $aDSNInfo['username']; } @@ -111,6 +111,7 @@ if ($aResult['init-updates']) { 'enable-diff-updates' => true, 'verbose' => $aResult['verbose'] )); + $cSetup->connect(); $cSetup->createFunctions(); } @@ -305,6 +306,14 @@ if ($aResult['index']) { } runWithEnv($sCmd, $aProcEnv); + + $oDB->query('update import_status set indexed = true'); +} + +if ($aResult['update-address-levels']) { + echo 'Updating address levels from '.CONST_Address_Level_Config.".\n"; + $oAlParser = new \Nominatim\Setup\AddressLevelParser(CONST_Address_Level_Config); + $oAlParser->createTable($oDB, 'address_levels'); } if ($aResult['import-osmosis'] || $aResult['import-osmosis-all']) { @@ -428,7 +437,7 @@ if ($aResult['import-osmosis'] || $aResult['import-osmosis-all']) { $sSQL = 'INSERT INTO import_osmosis_log'; $sSQL .= '(batchend, batchseq, batchsize, starttime, endtime, event)'; - $sSQL .= " values ('$sBatchEnd',$iEndSequence,$iFileSize,'"; + $sSQL .= " values ('$sBatchEnd',$iEndSequence,NULL,'"; $sSQL .= date('Y-m-d H:i:s', $fCMDStartTime)."','"; $sSQL .= date('Y-m-d H:i:s')."','index')"; var_Dump($sSQL); @@ -437,6 +446,11 @@ if ($aResult['import-osmosis'] || $aResult['import-osmosis-all']) { $sSQL = 'update import_status set indexed = true'; $oDB->query($sSQL); + } else { + if ($aResult['import-osmosis-all']) { + echo "Error: --no-index cannot be used with continuous imports (--import-osmosis-all).\n"; + exit(1); + } } $fDuration = time() - $fStartTime;