]> git.openstreetmap.org Git - nominatim.git/blobdiff - lib/setup/SetupClass.php
Nominatim::DB tests against separate postgresql database
[nominatim.git] / lib / setup / SetupClass.php
index b422ded16bfce9aafccb1bb0cc6ad4e49e6b490f..7c1c628e0e70171b08a60d103b17cdaf152fdf60 100755 (executable)
@@ -84,7 +84,7 @@ class SetupFunctions
         info('Create DB');
         $oDB = new \Nominatim\DB;
 
-        if ($oDB->databaseExists()) {
+        if ($oDB->checkConnection()) {
             fail('database already exists ('.CONST_Database_DSN.')');
         }
 
@@ -529,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';
         }
@@ -652,7 +651,7 @@ class SetupFunctions
                        );
 
         $aDropTables = array();
-        $aHaveTables = $this->oDB->getCol("SELECT tablename FROM pg_tables WHERE schemaname='public'");
+        $aHaveTables = $this->oDB->getListOfTables();
 
         foreach ($aHaveTables as $sTable) {
             $bFound = false;
@@ -696,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');
@@ -858,7 +858,7 @@ class SetupFunctions
     private function dropTable($sName)
     {
         if ($this->bVerbose) echo "Dropping table $sName\n";
-        $this->oDB->exec('DROP TABLE IF EXISTS '.$sName.' CASCADE');
+        $this->oDB->deleteTable($sName);
     }
 
     /**