mirror of
https://github.com/osm-search/Nominatim.git
synced 2024-11-26 03:55:11 +03:00
make setup.php fail early on missing osm-file
make setup.php fail early if: - no osm-file argument was supplied for --all or --import-data - the supplied osm-file is not existing or not readable (file permissions)
This commit is contained in:
parent
55d3f5a4b9
commit
7ff1395b96
@ -43,6 +43,26 @@
|
|||||||
|
|
||||||
$bDidSomething = false;
|
$bDidSomething = false;
|
||||||
|
|
||||||
|
// Check if osm-file is set and points to a valid file if --all or --import-data is given
|
||||||
|
if ($aCMDResult['import-data'] || $aCMDResult['all'])
|
||||||
|
{
|
||||||
|
if (!isset($aCMDResult['osm-file']))
|
||||||
|
{
|
||||||
|
fail('missing --osm-file for data import');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!file_exists($aCMDResult['osm-file']))
|
||||||
|
{
|
||||||
|
fail('the path supplied to --osm-file does not exist');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!is_readable($aCMDResult['osm-file']))
|
||||||
|
{
|
||||||
|
fail('osm-file "'.$aCMDResult['osm-file'].'" not readable');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// This is a pretty hard core default - the number of processors in the box - 1
|
// This is a pretty hard core default - the number of processors in the box - 1
|
||||||
$iInstances = isset($aCMDResult['threads'])?$aCMDResult['threads']:(getProcessorCount()-1);
|
$iInstances = isset($aCMDResult['threads'])?$aCMDResult['threads']:(getProcessorCount()-1);
|
||||||
if ($iInstances < 1)
|
if ($iInstances < 1)
|
||||||
@ -89,9 +109,9 @@
|
|||||||
passthru('createdb -E UTF-8 '.$aDSNInfo['database']);
|
passthru('createdb -E UTF-8 '.$aDSNInfo['database']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($aCMDResult['create-db'] || $aCMDResult['all'])
|
if ($aCMDResult['setup-db'] || $aCMDResult['all'])
|
||||||
{
|
{
|
||||||
echo "Create DB (2)\n";
|
echo "Setup DB\n";
|
||||||
$bDidSomething = true;
|
$bDidSomething = true;
|
||||||
// TODO: path detection, detection memory, etc.
|
// TODO: path detection, detection memory, etc.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user