+ if (!getSetting('DATABASE_MODULE_PATH')) {
+ // If no custom module path is set then copy the module into the
+ // project directory, but only if it is not the same file already
+ // (aka we are running from the build dir).
+ $sDest = CONST_InstallDir.'/module';
+ if ($sDest != CONST_Default_ModulePath) {
+ mkdir($sDest);
+ if (!copy(CONST_Default_ModulePath.'/nominatim.so', $sDest.'/nominatim.so')) {
+ echo "Failed to copy database module to $sDest.";
+ exit(1);
+ }
+ chmod($sDest.'/nominatim.so', 0755);
+ info("Database module installed at $sDest.");
+ } else {
+ info('Running from build directory. Leaving database module as is.');
+ }
+ }