From: Sarah Hoffmann Date: Sun, 17 Sep 2017 18:07:03 +0000 (+0200) Subject: setup: bail out earl when something is wrong with nominatim.so X-Git-Tag: v3.1.0~83 X-Git-Url: https://git.openstreetmap.org./nominatim.git/commitdiff_plain/61ed3b8ab3c37a8d73297fa73ae327f10e7430be setup: bail out earl when something is wrong with nominatim.so --- diff --git a/utils/setup.php b/utils/setup.php index 1e1ec37b..2369b183 100755 --- a/utils/setup.php +++ b/utils/setup.php @@ -132,11 +132,24 @@ if ($aCMDResult['setup-db'] || $aCMDResult['all']) { $i = chksql($oDB->getOne("select count(*) from pg_user where usename = '".CONST_Database_Web_User."'")); if ($i == 0) { - echo "ERROR: Web user '".CONST_Database_Web_User."' does not exist. Create it with:\n"; + echo "\nERROR: Web user '".CONST_Database_Web_User."' does not exist. Create it with:\n"; echo "\n createuser ".CONST_Database_Web_User."\n\n"; exit(1); } + // Try accessing the C module, so we know early if something is wrong + // and can simply error out. + $sSQL = "CREATE FUNCTION nominatim_test_import_func(text) RETURNS text AS '"; + $sSQL .= CONST_InstallPath."/module/nominatim.so', 'transliteration' LANGUAGE c IMMUTABLE STRICT"; + $sSQL .= ';DROP FUNCTION nominatim_test_import_func(text);'; + $oResult = $oDB->query($sSQL); + + if (PEAR::isError($oResult)) { + echo "\nERROR: Failed to load nominatim module. Reason:\n"; + echo $oResult->userinfo."\n\n"; + exit(1); + } + 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";