]> git.openstreetmap.org Git - nominatim.git/blobdiff - utils/setup.php
Merge branch 'master' of http://github.com/twain47/Nominatim
[nominatim.git] / utils / setup.php
index fb83dd0aa9fbc02aad2ed0c07075917f940395a5..8e3d1cb5fc108c49cd59f2363c49a3bc5c2a23ef 100755 (executable)
 
        $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
        $iInstances = isset($aCMDResult['threads'])?$aCMDResult['threads']:(getProcessorCount()-1);
        if ($iInstances < 1)
                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;
                // TODO: path detection, detection memory, etc.