X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/0947b618085f7d46515a3ec06cab5ed818e8635f..504922ffbecd42eed01dfb9da6bbf2c7aae9a094:/lib/setup/SetupClass.php diff --git a/lib/setup/SetupClass.php b/lib/setup/SetupClass.php index 4e3d6ece..d17fdca7 100755 --- a/lib/setup/SetupClass.php +++ b/lib/setup/SetupClass.php @@ -42,7 +42,10 @@ class SetupFunctions $this->iCacheMemory = getCacheMemoryMB(); } - $this->sModulePath = getSetting('DATABASE_MODULE_PATH', CONST_InstallDir.'/module'); + $this->sModulePath = getSetting('DATABASE_MODULE_PATH'); + if (!$this->sModulePath) { + $this->sModulePath = CONST_Default_ModulePath; + } info('module path: ' . $this->sModulePath); // parse database string @@ -287,7 +290,7 @@ class SetupFunctions public function importWikipediaArticles() { - $sWikiArticlePath = getSettings('WIKIPEDIA_DATA_PATH', CONST_DataDir.'/data'); + $sWikiArticlePath = getSetting('WIKIPEDIA_DATA_PATH', CONST_DataDir.'/data'); $sWikiArticlesFile = $sWikiArticlePath.'/wikimedia-importance.sql.gz'; if (file_exists($sWikiArticlesFile)) { info('Importing wikipedia articles and redirects'); @@ -546,26 +549,15 @@ class SetupFunctions { $this->checkModulePresence(); // raises exception on failure - $oBaseCmd = (new \Nominatim\Shell(CONST_DataDir.'/nominatim/nominatim.py')) - ->addParams('--database', $this->aDSNInfo['database']) - ->addParams('--port', $this->aDSNInfo['port']) - ->addParams('--threads', $this->iInstances); + $oBaseCmd = (new \Nominatim\Shell(getSetting('NOMINATIM_TOOL'))) + ->addParams('index'); - if (!$this->bQuiet) { - $oBaseCmd->addParams('-v'); + if ($this->bQuiet) { + $oBaseCmd->addParams('-q'); } if ($this->bVerbose) { $oBaseCmd->addParams('-v'); } - if (isset($this->aDSNInfo['hostspec'])) { - $oBaseCmd->addParams('--host', $this->aDSNInfo['hostspec']); - } - if (isset($this->aDSNInfo['username'])) { - $oBaseCmd->addParams('--user', $this->aDSNInfo['username']); - } - if (isset($this->aDSNInfo['password'])) { - $oBaseCmd->addEnvPair('PGPASSWORD', $this->aDSNInfo['password']); - } info('Index ranks 0 - 4'); $oCmd = (clone $oBaseCmd)->addParams('--maxrank', 4); @@ -578,14 +570,14 @@ class SetupFunctions if (!$bIndexNoanalyse) $this->pgsqlRunScript('ANALYSE'); info('Index administrative boundaries'); - $oCmd = (clone $oBaseCmd)->addParams('-b'); + $oCmd = (clone $oBaseCmd)->addParams('--boundaries-only'); $iStatus = $oCmd->run(); if ($iStatus != 0) { fail('error status ' . $iStatus . ' running nominatim!'); } info('Index ranks 5 - 25'); - $oCmd = (clone $oBaseCmd)->addParams('--minrank', 5, '--maxrank', 25); + $oCmd = (clone $oBaseCmd)->addParams('--no-boundaries', '--minrank', 5, '--maxrank', 25); $iStatus = $oCmd->run(); if ($iStatus != 0) { fail('error status ' . $iStatus . ' running nominatim!'); @@ -594,7 +586,7 @@ class SetupFunctions if (!$bIndexNoanalyse) $this->pgsqlRunScript('ANALYSE'); info('Index ranks 26 - 30'); - $oCmd = (clone $oBaseCmd)->addParams('--minrank', 26); + $oCmd = (clone $oBaseCmd)->addParams('--no-boundaries', '--minrank', 26); $iStatus = $oCmd->run(); if ($iStatus != 0) { fail('error status ' . $iStatus . ' running nominatim!'); @@ -706,31 +698,57 @@ class SetupFunctions } /** - * Setup settings-frontend.php in the build/website directory + * Setup the directory for the API scripts. * * @return null */ public function setupWebsite() { - $rOutputFile = fopen(CONST_InstallDir.'/settings/settings-frontend.php', 'w'); - - fwrite($rOutputFile, "bVerbose) echo 'Deleting '.$sFName."\n"; - unlink($sFName); - } + if ($this->bVerbose) echo 'Deleting '.$sFName."\n"; + unlink($sFName); } }