X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FDatabase%2FDBStructure.php;h=6291d0ffc4b643a2f32bfbad6f2edb2ca10ff92a;hb=c4870a16d4ffbd37d6c4f379abfe2d18cacb88ff;hp=579b9cdc118902b07be1ec3ccdb5868b4563e2f4;hpb=9ff3aca3b26adbfadda67e5f37d292e742d455bc;p=friendica.git diff --git a/src/Database/DBStructure.php b/src/Database/DBStructure.php index 579b9cdc11..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 * @@ -74,7 +86,7 @@ class DBStructure $old_tables = ['fserver', 'gcign', 'gcontact', 'gcontact-relation', 'gfollower' ,'glink', 'item-delivery-data', 'item-activity', 'item-content', 'item_id', 'participation', 'poll', 'poll_result', 'queue', 'retriever_rule', 'deliverq', 'dsprphotoq', 'ffinder', 'sign', 'spam', 'term', 'user-item', 'thread', 'item', 'challenge', - 'auth_codes', 'tokens', 'clients', 'profile_check', 'host', 'conversation', 'fcontact', 'config', 'addon']; + 'auth_codes', 'tokens', 'clients', 'profile_check', 'host', 'conversation', 'fcontact', 'addon']; $tables = DBA::selectToArray('INFORMATION_SCHEMA.TABLES', ['TABLE_NAME'], ['TABLE_SCHEMA' => DBA::databaseName(), 'TABLE_TYPE' => 'BASE TABLE']); @@ -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 {