X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/33ff96fd8323040f4551839e55c061b048329f66..213bf7d19d0e99355954bfacfe0833695f770151:/lib/setup_functions.php diff --git a/lib/setup_functions.php b/lib/setup_functions.php index 43f30a09..dab6a8e7 100755 --- a/lib/setup_functions.php +++ b/lib/setup_functions.php @@ -15,17 +15,18 @@ function checkInFile($sOSMFile) } } -function checkModulePresence() +function getOsm2pgsqlBinary() { - // Try accessing the C module, so we know early if something is wrong. - // Raises Nominatim\DatabaseError on failure + return getSetting('OSM2PGSQL_BINARY', CONST_Default_Osm2pgsql); +} + +function getImportStyle() +{ + $sStyle = getSetting('IMPORT_STYLE'); - $sModulePath = CONST_Database_Module_Path; - $sSQL = "CREATE FUNCTION nominatim_test_import_func(text) RETURNS text AS '"; - $sSQL .= $sModulePath . "/nominatim.so', 'transliteration' LANGUAGE c IMMUTABLE STRICT"; - $sSQL .= ';DROP FUNCTION nominatim_test_import_func(text);'; + if (in_array($sStyle, array('admin', 'street', 'address', 'full', 'extratags'))) { + return CONST_DataDir.'/settings/import-'.$sStyle.'.style'; + } - $oDB = new \Nominatim\DB(); - $oDB->connect(); - $oDB->exec($sSQL, null, 'Database server failed to load '.$sModulePath.'/nominatim.so module'); + return $sStyle; }