X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/45abcbc301982b43c39a3b17410a3543666dd925..0981a6403da6575b720eb26d94a5c5cbc9c3cfcc:/utils/setup.php diff --git a/utils/setup.php b/utils/setup.php index b93e4f82..501ad3f2 100755 --- a/utils/setup.php +++ b/utils/setup.php @@ -61,8 +61,11 @@ 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"); @@ -152,7 +155,7 @@ if ($aCMDResult['setup-db'] || $aCMDResult['all']) { if (!file_exists(CONST_ExtraDataPath.'/country_osm_grid.sql.gz')) { echo 'Error: you need to download the country_osm_grid first:'; - echo "\n wget -O ".CONST_ExtraDataPath."/country_osm_grid.sql.gz http://www.nominatim.org/data/country_grid.sql.gz\n"; + echo "\n wget -O ".CONST_ExtraDataPath."/country_osm_grid.sql.gz https://www.nominatim.org/data/country_grid.sql.gz\n"; exit(1); } @@ -192,7 +195,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) @@ -596,6 +599,7 @@ if ($aCMDResult['create-search-indices'] || $aCMDResult['all']) { $bDidSomething = true; $sTemplate = file_get_contents(CONST_BasePath.'/sql/indices.src.sql'); + $sTemplate = str_replace('{www-user}', CONST_Database_Web_User, $sTemplate); $sTemplate = replace_tablespace( '{ts:address-index}', CONST_Tablespace_Address_Index, @@ -690,7 +694,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); }