do not overwrite custom set module paths

Given that the module is now copied to the project directory
when no module path is set, we need the information that the
module path is empty. Therefore hand in the default module path
in a separate variable.
This commit is contained in:
Sarah Hoffmann
2021-02-02 17:33:41 +01:00
parent 36447c488a
commit cb06d1f4ca
5 changed files with 11 additions and 7 deletions

View File

@@ -8,6 +8,7 @@ function loadSettings($sProjectDir)
// set of settings.
defined('CONST_DataDir') or define('CONST_DataDir', $_SERVER['NOMINATIM_DATADIR']);
defined('CONST_BinDir') or define('CONST_BinDir', $_SERVER['NOMINATIM_BINDIR']);
defined('CONST_Default_ModulePath') or define('CONST_Default_ModulePath', $_SERVER['NOMINATIM_DATABASE_MODULE_SRC_PATH']);
}
function getSetting($sConfName, $sDefault = null)

View File

@@ -148,7 +148,9 @@ class SetupFunctions
// (aka we are running from the build dir).
$sDest = CONST_InstallDir.'/module';
if ($sDest != CONST_Default_ModulePath) {
mkdir($sDest);
if (!file_exists($sDest)) {
mkdir($sDest);
}
if (!copy(CONST_Default_ModulePath.'/nominatim.so', $sDest.'/nominatim.so')) {
echo "Failed to copy database module to $sDest.";
exit(1);
@@ -158,6 +160,8 @@ class SetupFunctions
} else {
info('Running from build directory. Leaving database module as is.');
}
} else {
info('Using database module from DATABASE_MODULE_PATH ('.getSetting('DATABASE_MODULE_PATH').').');
}
// Try accessing the C module, so we know early if something is wrong
$this->checkModulePresence(); // raises exception on failure