mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-02-15 10:57:58 +00:00
implicitly connect to database during setup
Make access to the DB object a function, so that the connection can be opened implicitly when the object is accessed for the first time. This way we no longer need to check beforehand if a specific function of the setup needs DB access or not. Also move the check for the module to the relevant sub step.
This commit is contained in:
@@ -77,18 +77,11 @@ if ($aCMDResult['create-db'] || $aCMDResult['all']) {
|
||||
$oSetup->createDB();
|
||||
}
|
||||
|
||||
if (!$aCMDResult['setup-website']) {
|
||||
$oSetup->connect();
|
||||
// Try accessing the C module, so we know early if something is wrong
|
||||
checkModulePresence(); // raises exception on failure
|
||||
}
|
||||
|
||||
if ($aCMDResult['setup-db'] || $aCMDResult['all']) {
|
||||
$bDidSomething = true;
|
||||
$oSetup->setupDB();
|
||||
}
|
||||
|
||||
|
||||
if ($aCMDResult['import-data'] || $aCMDResult['all']) {
|
||||
$bDidSomething = true;
|
||||
$oSetup->importData($aCMDResult['osm-file']);
|
||||
|
||||
Reference in New Issue
Block a user