]> git.mxchange.org Git - friendica.git/blobdiff - src/Database/DBStructure.php
Merge branch '2023.09-rc' into move-mentionbutton-to-navbar
[friendica.git] / src / Database / DBStructure.php
index dc1e785a50071dac4875bbcc3967ea0d76b60f3e..6291d0ffc4b643a2f32bfbad6f2edb2ca10ff92a 100644 (file)
@@ -57,6 +57,18 @@ class DBStructure
                echo DI::l10n()->t('The database version had been set to %s.', $version);
        }
 
+       /**
+        * Drops a specific table
+        *
+        * @param string $table the table name
+        *
+        * @return bool true if possible, otherwise false
+        */
+       public static function dropTable(string $table): bool
+       {
+               return DBA::isResult(DBA::e('DROP TABLE ' . DBA::quoteIdentifier($table) . ';'));
+       }
+
        /**
         * Drop unused tables
         *
@@ -94,8 +106,7 @@ class DBStructure
                                        $sql = 'DROP TABLE ' . DBA::quoteIdentifier($table) . ';';
                                        echo $sql . "\n";
 
-                                       $result = DBA::e($sql);
-                                       if (!DBA::isResult($result)) {
+                                       if (!static::dropTable($table)) {
                                                self::printUpdateError($sql);
                                        }
                                } else {