X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/3737712044b50ec1319afeebcd24d0ca2d0b181d..80f7392fb1eff5c6b26e5f85b6873bb133576275:/lib/setup/SetupClass.php diff --git a/lib/setup/SetupClass.php b/lib/setup/SetupClass.php index 100e3847..ac0f8f02 100755 --- a/lib/setup/SetupClass.php +++ b/lib/setup/SetupClass.php @@ -16,6 +16,7 @@ class SetupFunctions protected $bEnableDiffUpdates; protected $bEnableDebugStatements; protected $bNoPartitions; + protected $bDrop; protected $oDB = null; public function __construct(array $aCMDResult) @@ -74,6 +75,8 @@ class SetupFunctions } else { $this->bEnableDiffUpdates = false; } + + $this->bDrop = $aCMDResult['drop']; } public function createDB() @@ -208,6 +211,11 @@ class SetupFunctions if (!$this->sIgnoreErrors && !$this->oDB->getRow('select * from place limit 1')) { fail('No Data'); } + + if ($this->bDrop) { + $this->dropTable('planet_osm_nodes'); + $this->removeFlatnodeFile(); + } } public function createFunctions() @@ -409,8 +417,10 @@ class SetupFunctions $aFilenames = glob(CONST_Tiger_Data_Path.'/*.sql'); info('Found '.count($aFilenames).' SQL files in path '.CONST_Tiger_Data_Path); - if (empty($aFilenames)) return; - + if (empty($aFilenames)) { + warn('Tiger data import selected but no files found in path '.CONST_Tiger_Data_Path); + return; + } $sTemplate = file_get_contents(CONST_BasePath.'/sql/tiger_import_start.sql'); $sTemplate = $this->replaceSqlPatterns($sTemplate); @@ -519,11 +529,10 @@ class SetupFunctions public function index($bIndexNoanalyse) { - $sOutputFile = ''; $sBaseCmd = CONST_BasePath.'/nominatim/nominatim.py' .' -d '.escapeshellarg($this->aDSNInfo['database']) .' -P '.escapeshellarg($this->aDSNInfo['port']) - .' -t '.escapeshellarg($this->iInstances.$sOutputFile); + .' -t '.escapeshellarg($this->iInstances); if (!$this->bQuiet) { $sBaseCmd .= ' -v'; } @@ -576,6 +585,9 @@ class SetupFunctions } $sTemplate = file_get_contents(CONST_BasePath.'/sql/indices.src.sql'); + if (!$this->bDrop) { + $sTemplate .= file_get_contents(CONST_BasePath.'/sql/indices_updates.src.sql'); + } if (!$this->dbReverseOnly()) { $sTemplate .= file_get_contents(CONST_BasePath.'/sql/indices_search.src.sql'); } @@ -655,6 +667,11 @@ class SetupFunctions $this->dropTable($sDrop); } + $this->removeFlatnodeFile(); + } + + private function removeFlatnodeFile() + { if (!is_null(CONST_Osm2pgsql_Flatnode_File) && CONST_Osm2pgsql_Flatnode_File) { if (file_exists(CONST_Osm2pgsql_Flatnode_File)) { if ($this->bVerbose) echo 'Deleting '.CONST_Osm2pgsql_Flatnode_File."\n"; @@ -678,6 +695,7 @@ class SetupFunctions $sBasePath = CONST_BasePath.'/sql/functions/'; $sTemplate = file_get_contents($sBasePath.'utils.sql'); $sTemplate .= file_get_contents($sBasePath.'normalization.sql'); + $sTemplate .= file_get_contents($sBasePath.'ranking.sql'); $sTemplate .= file_get_contents($sBasePath.'importance.sql'); $sTemplate .= file_get_contents($sBasePath.'address_lookup.sql'); $sTemplate .= file_get_contents($sBasePath.'interpolation.sql');