]> git.openstreetmap.org Git - nominatim.git/blobdiff - lib-php/setup/SetupClass.php
move table creation to jinja-based preprocessing
[nominatim.git] / lib-php / setup / SetupClass.php
index b0081fd873ce3bce62cbc318c3b6e815db1026dc..b4875ebfa23d9d7112783d6982aecd7f41226fa2 100755 (executable)
@@ -13,7 +13,6 @@ class SetupFunctions
     protected $sIgnoreErrors;
     protected $bEnableDiffUpdates;
     protected $bEnableDebugStatements;
-    protected $bNoPartitions;
     protected $bDrop;
     protected $oDB = null;
     protected $oNominatimCmd;
@@ -51,11 +50,6 @@ class SetupFunctions
         } else {
             $this->bEnableDebugStatements = false;
         }
-        if (isset($aCMDResult['no-partitions'])) {
-            $this->bNoPartitions = $aCMDResult['no-partitions'];
-        } else {
-            $this->bNoPartitions = false;
-        }
         if (isset($aCMDResult['enable-diff-updates'])) {
             $this->bEnableDiffUpdates = $aCMDResult['enable-diff-updates'];
         } else {
@@ -83,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');
@@ -348,24 +306,6 @@ class SetupFunctions
         $oCmd->run(!$this->sIgnoreErrors);
     }
 
-    private function pgsqlRunPartitionScript($sTemplate)
-    {
-        $sSQL = 'select distinct partition from country_name';
-        $aPartitions = $this->db()->getCol($sSQL);
-        if (!$this->bNoPartitions) $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);