X-Git-Url: https://git.openstreetmap.org/nominatim.git/blobdiff_plain/55fa051d3a7019db62802f6bce29ab2a8f7e9657..8e2e852b898b3ebba6e3c243b08ba02f7f44d4fc:/utils/update.php diff --git a/utils/update.php b/utils/update.php old mode 100755 new mode 100644 index 038313f3..3086a70b --- a/utils/update.php +++ b/utils/update.php @@ -1,13 +1,15 @@ -#!@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']; } @@ -99,17 +103,15 @@ if ($aResult['init-updates']) { echo "and have set up CONST_Pyosmium_Binary to point to pyosmium-get-changes.\n"; fail('pyosmium-get-changes not found or not usable'); } + if (!$aResult['no-update-functions']) { - $sSetup = CONST_InstallPath.'/utils/setup.php'; - $iRet = -1; - $aCMDResult['create-functions'] = true; - $aCMDResult['enable-diff-updates'] = true; - # passthru($sSetup.' --create-functions --enable-diff-updates', $iRet); - create_functions($aCMDResult); - - if ($iRet != 0) { - fail('Error running setup script'); - } + // instantiate setupClass to use the function therein + $cSetup = new SetupFunctions(array( + 'enable-diff-updates' => true, + 'verbose' => $aResult['verbose'] + )); + $cSetup->connect(); + $cSetup->createFunctions(); } $sDatabaseDate = getDatabaseDate($oDB); @@ -305,6 +307,12 @@ if ($aResult['index']) { runWithEnv($sCmd, $aProcEnv); } +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']) { // if (strpos(CONST_Replication_Url, 'download.geofabrik.de') !== false && CONST_Replication_Update_Interval < 86400) { @@ -426,7 +434,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);