X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/c7fd0a7af4ce261e61feb0e63d0a6db736280081..c495ce097916063327460cfa2cc6e3fcccac4df2:/lib-php/admin/update.php diff --git a/lib-php/admin/update.php b/lib-php/admin/update.php index 4f639c8d..fae4a783 100644 --- a/lib-php/admin/update.php +++ b/lib-php/admin/update.php @@ -52,6 +52,7 @@ loadSettings($aCMDResult['project-dir'] ?? getcwd()); setupHTTPProxy(); if (!isset($aResult['index-instances'])) $aResult['index-instances'] = 1; + if (!isset($aResult['index-rank'])) $aResult['index-rank'] = 0; date_default_timezone_set('Etc/UTC'); @@ -104,11 +105,17 @@ if ($fPostgresVersion >= 11.0) { } $oNominatimCmd = new \Nominatim\Shell(getSetting('NOMINATIM_TOOL')); -if ($aResult['quiet']) { - $oNominatimCmd->addParams('--quiet'); -} -if ($aResult['verbose']) { - $oNominatimCmd->addParams('--verbose'); + +function run($oCmd) +{ + global $aCMDResult; + if ($aCMDResult['quiet'] ?? false) { + $oCmd->addParams('--quiet'); + } + if ($aCMDResult['verbose'] ?? false) { + $oCmd->addParams('--verbose'); + } + $oCmd->run(true); } @@ -119,7 +126,7 @@ if ($aResult['init-updates']) { $oCmd->addParams('--no-update-functions'); } - $oCmd->run(); + run($oCmd); } if ($aResult['check-for-updates']) { @@ -147,7 +154,7 @@ if (isset($aResult['import-diff']) || isset($aResult['import-file'])) { } if ($aResult['calculate-postcodes']) { - (clone($oNominatimCmd))->addParams('refresh', '--postcodes')->run(); + run((clone($oNominatimCmd))->addParams('refresh', '--postcodes')); } $sTemporaryFile = CONST_InstallDir.'/osmosischange.osc'; @@ -196,22 +203,21 @@ if ($bHaveDiff) { } if ($aResult['recompute-word-counts']) { - (clone($oNominatimCmd))->addParams('refresh', '--word-counts')->run(); + run((clone($oNominatimCmd))->addParams('refresh', '--word-counts')); } if ($aResult['index']) { - (clone $oNominatimCmd) + run((clone $oNominatimCmd) ->addParams('index', '--minrank', $aResult['index-rank']) - ->addParams('--threads', $aResult['index-instances']) - ->run(); + ->addParams('--threads', $aResult['index-instances'])); } if ($aResult['update-address-levels']) { - (clone($oNominatimCmd))->addParams('refresh', '--address-levels')->run(); + run((clone($oNominatimCmd))->addParams('refresh', '--address-levels')); } if ($aResult['recompute-importance']) { - (clone($oNominatimCmd))->addParams('refresh', '--importance')->run(true); + run((clone($oNominatimCmd))->addParams('refresh', '--importance')); } if ($aResult['import-osmosis'] || $aResult['import-osmosis-all']) { @@ -227,5 +233,5 @@ if ($aResult['import-osmosis'] || $aResult['import-osmosis-all']) { $oCmd->addParams('--no-index'); } - exit($oCmd->run()); + run($oCmd); }