X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/d4b633bfc50188f36e3c4a8b2b99c3a0e6a7f12e..0847964a2788c3560ea7a5133508790c2c07adc8:/lib/setup_functions.php?ds=sidebyside diff --git a/lib/setup_functions.php b/lib/setup_functions.php index 89736ae0..dc84cf92 100755 --- a/lib/setup_functions.php +++ b/lib/setup_functions.php @@ -15,26 +15,20 @@ function checkInFile($sOSMFile) } } -function checkModulePresence() +function getOsm2pgsqlBinary() { - // Try accessing the C module, so we know early if something is wrong - // and can simply error out. - $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);'; - - $oDB = new \Nominatim\DB(); - $oDB->connect(); - - $bResult = true; - try { - $oDB->exec($sSQL); - } catch (\Nominatim\DatabaseError $e) { - echo "\nERROR: Failed to load nominatim module. Reason:\n"; - echo $oDB->getLastError()[2] . "\n\n"; - $bResult = false; + $sBinary = getSetting('OSM2PGSQL_BINARY'); + + return $sBinary ? $sBinary : CONST_Default_Osm2pgsql; +} + +function getImportStyle() +{ + $sStyle = getSetting('IMPORT_STYLE'); + + if (in_array($sStyle, array('admin', 'street', 'address', 'full', 'extratags'))) { + return CONST_DataDir.'/settings/import-'.$sStyle.'.style'; } - return $bResult; + return $sStyle; }