]> git.openstreetmap.org Git - nominatim.git/blobdiff - utils/setup.php
Merge pull request #1069 from woodpeck/patch-2
[nominatim.git] / utils / setup.php
index 53778b1c7fe48614559eadef02737bf46dbf05cb..a7f77e557c823eb1a42aed0284827793f936543d 100755 (executable)
@@ -61,8 +61,8 @@ if ($aCMDResult['import-data'] || $aCMDResult['all']) {
 }
 
 
-// This is a pretty hard core default - the number of processors in the box - 1
-$iInstances = isset($aCMDResult['threads'])?$aCMDResult['threads']:(getProcessorCount()-1);
+// by default, use all but one processor, but never more than 15.
+$iInstances = isset($aCMDResult['threads'])?$aCMDResult['threads']:(min(16,getProcessorCount())-1);
 if ($iInstances < 1) {
     $iInstances = 1;
     warn("resetting threads to $iInstances");
@@ -192,7 +192,7 @@ if ($aCMDResult['import-data'] || $aCMDResult['all']) {
         fail("osm2pgsql not found in '$osm2pgsql'");
     }
 
-    if (!is_null(CONST_Osm2pgsql_Flatnode_File)) {
+    if (!is_null(CONST_Osm2pgsql_Flatnode_File) && CONST_Osm2pgsql_Flatnode_File) {
         $osm2pgsql .= ' --flat-nodes '.CONST_Osm2pgsql_Flatnode_File;
     }
     if (CONST_Tablespace_Osm2pgsql_Data)
@@ -690,7 +690,7 @@ if ($aCMDResult['drop']) {
         // been deleted already by CASCADE
     }
 
-    if (!is_null(CONST_Osm2pgsql_Flatnode_File)) {
+    if (!is_null(CONST_Osm2pgsql_Flatnode_File) && CONST_Osm2pgsql_Flatnode_File) {
         if ($aCMDResult['verbose']) echo 'deleting '.CONST_Osm2pgsql_Flatnode_File."\n";
         unlink(CONST_Osm2pgsql_Flatnode_File);
     }