X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/a0dbeabed1a18e9bedb6cb2a6eed4c2b5fbf45cc..64ace51e02790bf88e162a15236c5ac2af865c5e:/lib/setup_functions.php diff --git a/lib/setup_functions.php b/lib/setup_functions.php index b1417678..43f30a09 100755 --- a/lib/setup_functions.php +++ b/lib/setup_functions.php @@ -17,22 +17,15 @@ function checkInFile($sOSMFile) function checkModulePresence() { - // Try accessing the C module, so we know early if something is wrong - // and can simply error out. + // Try accessing the C module, so we know early if something is wrong. + // Raises Nominatim\DatabaseError on failure + $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 = &getDB(); - $oResult = $oDB->query($sSQL); - - $bResult = true; - - if (PEAR::isError($oResult)) { - echo "\nERROR: Failed to load nominatim module. Reason:\n"; - echo $oResult->userinfo . "\n\n"; - $bResult = false; - } - return $bResult; + $oDB = new \Nominatim\DB(); + $oDB->connect(); + $oDB->exec($sSQL, null, 'Database server failed to load '.$sModulePath.'/nominatim.so module'); }