X-Git-Url: https://git.openstreetmap.org/nominatim.git/blobdiff_plain/6cda021d9b4dfe566516e7625fa64f8c510d981a..eacabb0e962cf5301c63622204dd8efa0ce0a7ac:/lib-php/setup/SetupClass.php diff --git a/lib-php/setup/SetupClass.php b/lib-php/setup/SetupClass.php index 75168619..b4875ebf 100755 --- a/lib-php/setup/SetupClass.php +++ b/lib-php/setup/SetupClass.php @@ -77,42 +77,6 @@ class SetupFunctions $this->createSqlFunctions(); } - public function createTables($bReverseOnly = false) - { - info('Create Tables'); - - $sTemplate = file_get_contents(CONST_SqlDir.'/tables.sql'); - $sTemplate = $this->replaceSqlPatterns($sTemplate); - - $this->pgsqlRunScript($sTemplate, false); - - if ($bReverseOnly) { - $this->dropTable('search_name'); - } - - (clone($this->oNominatimCmd))->addParams('refresh', '--address-levels')->run(); - } - - public function createTableTriggers() - { - info('Create Tables'); - - $sTemplate = file_get_contents(CONST_SqlDir.'/table-triggers.sql'); - $sTemplate = $this->replaceSqlPatterns($sTemplate); - - $this->pgsqlRunScript($sTemplate, false); - } - - public function createPartitionTables() - { - info('Create Partition Tables'); - - $sTemplate = file_get_contents(CONST_SqlDir.'/partition-tables.src.sql'); - $sTemplate = $this->replaceSqlPatterns($sTemplate); - - $this->pgsqlRunPartitionScript($sTemplate); - } - public function importTigerData($sTigerPath) { info('Import Tiger data'); @@ -342,24 +306,6 @@ class SetupFunctions $oCmd->run(!$this->sIgnoreErrors); } - private function pgsqlRunPartitionScript($sTemplate) - { - $sSQL = 'select distinct partition from country_name order by partition'; - $aPartitions = $this->db()->getCol($sSQL); - if ($aPartitions[0] != 0) $aPartitions[] = 0; - - preg_match_all('#^-- start(.*?)^-- end#ms', $sTemplate, $aMatches, PREG_SET_ORDER); - foreach ($aMatches as $aMatch) { - $sResult = ''; - foreach ($aPartitions as $sPartitionName) { - $sResult .= str_replace('-partition-', $sPartitionName, $aMatch[1]); - } - $sTemplate = str_replace($aMatch[0], $sResult, $sTemplate); - } - - $this->pgsqlRunScript($sTemplate); - } - private function pgsqlRunScriptFile($sFilename) { if (!file_exists($sFilename)) fail('unable to find '.$sFilename);