From: Philipp Date: Sat, 13 May 2023 19:05:22 +0000 (+0200) Subject: Move "OPTIMIZE TABLE" to own Database function X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=db5078d51c7b01a6beb7145c866e38d02b2eb284;p=friendica.git Move "OPTIMIZE TABLE" to own Database function --- diff --git a/src/Database/Database.php b/src/Database/Database.php index b1ea6c1e4f..b1e31bda74 100644 --- a/src/Database/Database.php +++ b/src/Database/Database.php @@ -1758,6 +1758,19 @@ class Database return (['list' => $statelist, 'amount' => $processes]); } + /** + * Optimizes tables + * + * @param string $table a given table + * + * @return bool True, if successfully optimized, otherwise false + * @throws \Exception + */ + public function optimizeTable(string $table): bool + { + return $this->e("OPTIMIZE TABLE " . DBA::buildTableString([$table])) !== false; + } + /** * Fetch a database variable * diff --git a/src/Federation/Repository/DeliveryQueueItem.php b/src/Federation/Repository/DeliveryQueueItem.php index 815cf89b50..59afd5a3ad 100644 --- a/src/Federation/Repository/DeliveryQueueItem.php +++ b/src/Federation/Repository/DeliveryQueueItem.php @@ -108,6 +108,6 @@ final class DeliveryQueueItem extends \Friendica\BaseRepository public function optimizeStorage(): bool { - return $this->db->e("OPTIMIZE TABLE " . DBA::buildTableString([self::$table_name])); + return $this->db->optimizeTable(self::$table_name); } }