move checkModilePresence to class, delete own debug echo

This commit is contained in:
ThomasBarris 2018-09-08 09:26:23 +02:00
parent d10f63b666
commit 9e35e5c2b0
2 changed files with 10 additions and 5 deletions

View File

@ -136,6 +136,11 @@ class SetupFunctions
exit(1); exit(1);
} }
// Try accessing the C module, so we know early if something is wrong
if (!checkModulePresence()) {
fail('error loading nominatim.so module');
}
if (!file_exists(CONST_ExtraDataPath.'/country_osm_grid.sql.gz')) { if (!file_exists(CONST_ExtraDataPath.'/country_osm_grid.sql.gz')) {
echo 'Error: you need to download the country_osm_grid first:'; echo 'Error: you need to download the country_osm_grid first:';
echo "\n wget -O ".CONST_ExtraDataPath."/country_osm_grid.sql.gz https://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";
@ -219,6 +224,11 @@ class SetupFunctions
{ {
info('Create Functions'); info('Create Functions');
// Try accessing the C module, so we know eif something is wrong
// update.php calls this function
if (!checkModulePresence()) {
fail('error loading nominatim.so module');
}
$this->createSqlFunctions(); $this->createSqlFunctions();
} }
@ -330,7 +340,6 @@ class SetupFunctions
} else { } else {
warn('wikipedia redirect dump file not found - some place importance values may be missing'); warn('wikipedia redirect dump file not found - some place importance values may be missing');
} }
echo ' finish wikipedia';
} }
public function loadData($bDisableTokenPrecalc) public function loadData($bDisableTokenPrecalc)

View File

@ -71,10 +71,6 @@ if ($aResult['init-updates']) {
} }
if (!$aResult['no-update-functions']) { if (!$aResult['no-update-functions']) {
// Try accessing the C module,
if (!checkModulePresence()) {
fail('error loading nominatim.so module');
}
// instantiate setupClass to use the function therein // instantiate setupClass to use the function therein
$cSetup = new SetupFunctions($aResult); $cSetup = new SetupFunctions($aResult);
$cSetup->createFunctions(); $cSetup->createFunctions();