diff --git a/src/Database/Database.php b/src/Database/Database.php index b1ea6c1e4..b1e31bda7 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 815cf89b5..59afd5a3a 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); } }