mirror of
https://github.com/osm-search/Nominatim.git
synced 2024-12-26 14:36:23 +03:00
fix verbose flag for PHP wrapper scripts
The flag must come after the command.
This commit is contained in:
parent
dd03aeb966
commit
c7f40e3cee
@ -57,23 +57,24 @@ setupHTTPProxy();
|
|||||||
$bDidSomething = false;
|
$bDidSomething = false;
|
||||||
|
|
||||||
$oNominatimCmd = new \Nominatim\Shell(getSetting('NOMINATIM_TOOL'));
|
$oNominatimCmd = new \Nominatim\Shell(getSetting('NOMINATIM_TOOL'));
|
||||||
if (isset($aCMDResult['quiet']) && $aCMDResult['quiet']) {
|
|
||||||
$oNominatimCmd->addParams('--quiet');
|
|
||||||
}
|
|
||||||
if ($aCMDResult['verbose']) {
|
|
||||||
$oNominatimCmd->addParams('--verbose');
|
|
||||||
}
|
|
||||||
|
|
||||||
// by default, use all but one processor, but never more than 15.
|
// by default, use all but one processor, but never more than 15.
|
||||||
$iInstances = max(1, $aCMDResult['threads'] ?? (min(16, getProcessorCount()) - 1));
|
$iInstances = max(1, $aCMDResult['threads'] ?? (min(16, getProcessorCount()) - 1));
|
||||||
|
|
||||||
function run($oCmd) {
|
function run($oCmd)
|
||||||
|
{
|
||||||
global $iInstances;
|
global $iInstances;
|
||||||
global $aCMDResult;
|
global $aCMDResult;
|
||||||
$oCmd->addParams('--threads', $iInstances);
|
$oCmd->addParams('--threads', $iInstances);
|
||||||
if ($aCMDResult['ignore-errors'] ?? false) {
|
if ($aCMDResult['ignore-errors'] ?? false) {
|
||||||
$oCmd->addParams('--ignore-errors');
|
$oCmd->addParams('--ignore-errors');
|
||||||
}
|
}
|
||||||
|
if ($aCMDResult['quiet'] ?? false) {
|
||||||
|
$oCmd->addParams('--quiet');
|
||||||
|
}
|
||||||
|
if ($aCMDResult['verbose'] ?? false) {
|
||||||
|
$oCmd->addParams('--verbose');
|
||||||
|
}
|
||||||
$oCmd->run(true);
|
$oCmd->run(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,11 +104,17 @@ if ($fPostgresVersion >= 11.0) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$oNominatimCmd = new \Nominatim\Shell(getSetting('NOMINATIM_TOOL'));
|
$oNominatimCmd = new \Nominatim\Shell(getSetting('NOMINATIM_TOOL'));
|
||||||
if ($aResult['quiet']) {
|
|
||||||
$oNominatimCmd->addParams('--quiet');
|
function run($oCmd)
|
||||||
}
|
{
|
||||||
if ($aResult['verbose']) {
|
global $aCMDResult;
|
||||||
$oNominatimCmd->addParams('--verbose');
|
if ($aCMDResult['quiet'] ?? false) {
|
||||||
|
$oCmd->addParams('--quiet');
|
||||||
|
}
|
||||||
|
if ($aCMDResult['verbose'] ?? false) {
|
||||||
|
$oCmd->addParams('--verbose');
|
||||||
|
}
|
||||||
|
$oCmd->run(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -119,7 +125,7 @@ if ($aResult['init-updates']) {
|
|||||||
$oCmd->addParams('--no-update-functions');
|
$oCmd->addParams('--no-update-functions');
|
||||||
}
|
}
|
||||||
|
|
||||||
$oCmd->run();
|
run($oCmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($aResult['check-for-updates']) {
|
if ($aResult['check-for-updates']) {
|
||||||
@ -147,7 +153,7 @@ if (isset($aResult['import-diff']) || isset($aResult['import-file'])) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($aResult['calculate-postcodes']) {
|
if ($aResult['calculate-postcodes']) {
|
||||||
(clone($oNominatimCmd))->addParams('refresh', '--postcodes')->run();
|
run((clone($oNominatimCmd))->addParams('refresh', '--postcodes'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$sTemporaryFile = CONST_InstallDir.'/osmosischange.osc';
|
$sTemporaryFile = CONST_InstallDir.'/osmosischange.osc';
|
||||||
@ -196,22 +202,21 @@ if ($bHaveDiff) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($aResult['recompute-word-counts']) {
|
if ($aResult['recompute-word-counts']) {
|
||||||
(clone($oNominatimCmd))->addParams('refresh', '--word-counts')->run();
|
run((clone($oNominatimCmd))->addParams('refresh', '--word-counts'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($aResult['index']) {
|
if ($aResult['index']) {
|
||||||
(clone $oNominatimCmd)
|
run((clone $oNominatimCmd)
|
||||||
->addParams('index', '--minrank', $aResult['index-rank'])
|
->addParams('index', '--minrank', $aResult['index-rank'])
|
||||||
->addParams('--threads', $aResult['index-instances'])
|
->addParams('--threads', $aResult['index-instances']));
|
||||||
->run();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($aResult['update-address-levels']) {
|
if ($aResult['update-address-levels']) {
|
||||||
(clone($oNominatimCmd))->addParams('refresh', '--address-levels')->run();
|
run((clone($oNominatimCmd))->addParams('refresh', '--address-levels'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($aResult['recompute-importance']) {
|
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']) {
|
if ($aResult['import-osmosis'] || $aResult['import-osmosis-all']) {
|
||||||
@ -227,5 +232,5 @@ if ($aResult['import-osmosis'] || $aResult['import-osmosis-all']) {
|
|||||||
$oCmd->addParams('--no-index');
|
$oCmd->addParams('--no-index');
|
||||||
}
|
}
|
||||||
|
|
||||||
exit($oCmd->run());
|
run($oCmd);
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,8 @@ def execute_file(dsn, fname, ignore_errors=False, pre_code=None, post_code=None)
|
|||||||
cmd = ['psql']
|
cmd = ['psql']
|
||||||
if not ignore_errors:
|
if not ignore_errors:
|
||||||
cmd.extend(('-v', 'ON_ERROR_STOP=1'))
|
cmd.extend(('-v', 'ON_ERROR_STOP=1'))
|
||||||
|
if not LOG.isEnabledFor(logging.INFO):
|
||||||
|
cmd.append('--quiet')
|
||||||
proc = subprocess.Popen(cmd, env=get_pg_env(dsn), stdin=subprocess.PIPE)
|
proc = subprocess.Popen(cmd, env=get_pg_env(dsn), stdin=subprocess.PIPE)
|
||||||
|
|
||||||
if not LOG.isEnabledFor(logging.INFO):
|
if not LOG.isEnabledFor(logging.INFO):
|
||||||
|
Loading…
Reference in New Issue
Block a user