]> git.mxchange.org Git - friendica.git/commitdiff
We already have got a function to check if a table exists
authorMichael <heluecht@pirati.ca>
Fri, 15 May 2020 18:32:53 +0000 (18:32 +0000)
committerMichael <heluecht@pirati.ca>
Fri, 15 May 2020 18:32:53 +0000 (18:32 +0000)
src/Database/DBA.php
src/Database/DBStructure.php
src/Database/Database.php

index f35428718d8fe9c6d9d02e22ad590dd91c89b036..9825d06c683a7791fee2a9ff95e9d7ff43f0b3e2 100644 (file)
@@ -741,17 +741,6 @@ class DBA
                return DI::dba()->processlist();
        }
 
-       /**
-        * Test if the given table exists
-        *
-        * @param string $table
-        * @return bool
-        */
-       public static function tableExists(string $table)
-       {
-               return DI::dba()->tableExists($table);
-       }
-
        /**
         * Fetch a database variable
         *
index a02d6cf1b4e3f4452a406d84dbd20e859355e51c..566aea2348661ff9591e36e7c1e4de0fb9eede27 100644 (file)
@@ -988,7 +988,7 @@ class DBStructure
         */
        public static function checkInitialValues()
        {
-               if (DBA::tableExists('contact') && !DBA::exists('contact', ['id' => 0])) {
+               if (self::existsTable('contact') && !DBA::exists('contact', ['id' => 0])) {
                        DBA::insert('contact', ['nurl' => '']);
                        $lastid = DBA::lastInsertId();
                        if ($lastid != 0) {
@@ -996,7 +996,7 @@ class DBStructure
                        }               
                }
 
-               if (DBA::tableExists('permissionset') && !DBA::exists('permissionset', ['id' => 0])) {
+               if (self::existsTable('permissionset') && !DBA::exists('permissionset', ['id' => 0])) {
                        DBA::insert('permissionset', ['allow_cid' => '', 'allow_gid' => '', 'deny_cid' => '', 'deny_gid' => '']);       
                        $lastid = DBA::lastInsertId();
                        if ($lastid != 0) {
@@ -1004,7 +1004,7 @@ class DBStructure
                        }
                }
        
-               if (DBA::tableExists('tag') && !DBA::exists('tag', ['id' => 0])) {
+               if (self::existsTable('tag') && !DBA::exists('tag', ['id' => 0])) {
                        DBA::insert('tag', ['name' => '']);
                        $lastid = DBA::lastInsertId();
                        if ($lastid != 0) {
index 97840141a246426e063db126f5c5b166ff6bf52d..7adb88ffa87aec4c6d1cff7025b9b28ffc0a9596 100644 (file)
@@ -1660,18 +1660,6 @@ class Database
                return (["list" => $statelist, "amount" => $processes]);
        }
 
-       /**
-        * Test if the given table exists
-        *
-        * @param string $table
-        * @return bool
-        */
-       public function tableExists(string $table)
-       {
-               return $this->exists(['information_schema' => 'tables'],
-                       ['table_name' => $table, 'table_schema' => $this->databaseName()]);
-       }
-
        /**
         * Fetch a database variable
         *