X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/879aafc9161dc2cc10198aa467d6dc6e0ca80f01..3737712044b50ec1319afeebcd24d0ca2d0b181d:/lib/setup/SetupClass.php?ds=inline diff --git a/lib/setup/SetupClass.php b/lib/setup/SetupClass.php index bf44e04b..100e3847 100755 --- a/lib/setup/SetupClass.php +++ b/lib/setup/SetupClass.php @@ -10,6 +10,7 @@ class SetupFunctions protected $iInstances; protected $sModulePath; protected $aDSNInfo; + protected $bQuiet; protected $bVerbose; protected $sIgnoreErrors; protected $bEnableDiffUpdates; @@ -49,6 +50,7 @@ class SetupFunctions } // setting member variables based on command line options stored in $aCMDResult + $this->bQuiet = $aCMDResult['quiet']; $this->bVerbose = $aCMDResult['verbose']; //setting default values which are not set by the update.php array @@ -518,10 +520,16 @@ class SetupFunctions public function index($bIndexNoanalyse) { $sOutputFile = ''; - $sBaseCmd = CONST_InstallPath.'/nominatim/nominatim -i' + $sBaseCmd = CONST_BasePath.'/nominatim/nominatim.py' .' -d '.escapeshellarg($this->aDSNInfo['database']) .' -P '.escapeshellarg($this->aDSNInfo['port']) .' -t '.escapeshellarg($this->iInstances.$sOutputFile); + if (!$this->bQuiet) { + $sBaseCmd .= ' -v'; + } + if ($this->bVerbose) { + $sBaseCmd .= ' -v'; + } if (isset($this->aDSNInfo['hostspec'])) { $sBaseCmd .= ' -H '.escapeshellarg($this->aDSNInfo['hostspec']); } @@ -558,6 +566,15 @@ class SetupFunctions { info('Create Search indices'); + $sSQL = 'SELECT relname FROM pg_class, pg_index '; + $sSQL .= 'WHERE pg_index.indisvalid = false AND pg_index.indexrelid = pg_class.oid'; + $aInvalidIndices = $this->oDB->getCol($sSQL); + + foreach ($aInvalidIndices as $sIndexName) { + info("Cleaning up invalid index $sIndexName"); + $this->oDB->exec("DROP INDEX $sIndexName;"); + } + $sTemplate = file_get_contents(CONST_BasePath.'/sql/indices.src.sql'); if (!$this->dbReverseOnly()) { $sTemplate .= file_get_contents(CONST_BasePath.'/sql/indices_search.src.sql');