]> git.mxchange.org Git - friendica.git/commitdiff
Move "OPTIMIZE TABLE" to own Database function
authorPhilipp <admin@philipp.info>
Sat, 13 May 2023 19:05:22 +0000 (21:05 +0200)
committerPhilipp <admin@philipp.info>
Sat, 13 May 2023 19:05:22 +0000 (21:05 +0200)
src/Database/Database.php
src/Federation/Repository/DeliveryQueueItem.php

index b1ea6c1e4ffe4fa2b6db24e31cd93d57dba639b3..b1e31bda747dca7cdb6863c49f5e772d74a34b4b 100644 (file)
@@ -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
         *
index 815cf89b506bb81ec102b882839785a06e573b37..59afd5a3ad512610c5f6097b67fee27cbc8a4247 100644 (file)
@@ -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);
        }
 }