X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FDatabase%2FDBStructure.php;h=6291d0ffc4b643a2f32bfbad6f2edb2ca10ff92a;hb=c4870a16d4ffbd37d6c4f379abfe2d18cacb88ff;hp=dc1e785a50071dac4875bbcc3967ea0d76b60f3e;hpb=6db89adc04dce3390d3e5086eea385daea1b8e22;p=friendica.git diff --git a/src/Database/DBStructure.php b/src/Database/DBStructure.php index dc1e785a50..6291d0ffc4 100644 --- a/src/Database/DBStructure.php +++ b/src/Database/DBStructure.php @@ -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 {