]> git.mxchange.org Git - friendica.git/commitdiff
Config to enable the optimizing of all tables
authorMichael <heluecht@pirati.ca>
Mon, 20 Feb 2023 14:46:58 +0000 (14:46 +0000)
committerMichael <heluecht@pirati.ca>
Mon, 20 Feb 2023 14:46:58 +0000 (14:46 +0000)
src/Worker/OptimizeTables.php
static/defaults.config.php

index 9a49e42561b02fdda475a6201fb124458015d965..bb4cc9e482258be8585fd3e5bd146d58c159951d 100644 (file)
@@ -40,34 +40,37 @@ class OptimizeTables
 
                Logger::info('Optimize start');
 
-               DBA::e("OPTIMIZE TABLE `apcontact`");
                DBA::e("OPTIMIZE TABLE `cache`");
-               DBA::e("OPTIMIZE TABLE `contact`");
-               DBA::e("OPTIMIZE TABLE `contact-relation`");
-               DBA::e("OPTIMIZE TABLE `conversation`");
-               DBA::e("OPTIMIZE TABLE `diaspora-contact`");
-               DBA::e("OPTIMIZE TABLE `diaspora-interaction`");
-               DBA::e("OPTIMIZE TABLE `fcontact`");
-               DBA::e("OPTIMIZE TABLE `gserver`");
-               DBA::e("OPTIMIZE TABLE `gserver-tag`");
                DBA::e("OPTIMIZE TABLE `locks`");
-               DBA::e("OPTIMIZE TABLE `inbox-status`");
-               DBA::e("OPTIMIZE TABLE `item-uri`");
-               DBA::e("OPTIMIZE TABLE `notification`");
-               DBA::e("OPTIMIZE TABLE `notify`");
                DBA::e("OPTIMIZE TABLE `oembed`");
                DBA::e("OPTIMIZE TABLE `parsed_url`");
                DBA::e("OPTIMIZE TABLE `session`");
-               DBA::e("OPTIMIZE TABLE `photo`");
-               DBA::e("OPTIMIZE TABLE `post`");
-               DBA::e("OPTIMIZE TABLE `post-content`");
-               DBA::e("OPTIMIZE TABLE `post-delivery-data`");
-               DBA::e("OPTIMIZE TABLE `post-link`");
-               DBA::e("OPTIMIZE TABLE `post-thread`");
-               DBA::e("OPTIMIZE TABLE `post-thread-user`");
-               DBA::e("OPTIMIZE TABLE `post-user`");
-               DBA::e("OPTIMIZE TABLE `storage`");
-               DBA::e("OPTIMIZE TABLE `tag`");
+
+               if (DI::config()->get('system', 'optimize_all_tables')) {
+                       DBA::e("OPTIMIZE TABLE `apcontact`");
+                       DBA::e("OPTIMIZE TABLE `contact`");
+                       DBA::e("OPTIMIZE TABLE `contact-relation`");
+                       DBA::e("OPTIMIZE TABLE `conversation`");
+                       DBA::e("OPTIMIZE TABLE `diaspora-contact`");
+                       DBA::e("OPTIMIZE TABLE `diaspora-interaction`");
+                       DBA::e("OPTIMIZE TABLE `fcontact`");
+                       DBA::e("OPTIMIZE TABLE `gserver`");
+                       DBA::e("OPTIMIZE TABLE `gserver-tag`");
+                       DBA::e("OPTIMIZE TABLE `inbox-status`");
+                       DBA::e("OPTIMIZE TABLE `item-uri`");
+                       DBA::e("OPTIMIZE TABLE `notification`");
+                       DBA::e("OPTIMIZE TABLE `notify`");
+                       DBA::e("OPTIMIZE TABLE `photo`");
+                       DBA::e("OPTIMIZE TABLE `post`");
+                       DBA::e("OPTIMIZE TABLE `post-content`");
+                       DBA::e("OPTIMIZE TABLE `post-delivery-data`");
+                       DBA::e("OPTIMIZE TABLE `post-link`");
+                       DBA::e("OPTIMIZE TABLE `post-thread`");
+                       DBA::e("OPTIMIZE TABLE `post-thread-user`");
+                       DBA::e("OPTIMIZE TABLE `post-user`");
+                       DBA::e("OPTIMIZE TABLE `storage`");
+                       DBA::e("OPTIMIZE TABLE `tag`");
+               }
 
                Logger::info('Optimize end');
 
index 2c45e45e48677055e0470e7abccc11adbe3e3d3a..90886347e5349263bace4ffa0c72efb563aa831f 100644 (file)
@@ -487,6 +487,10 @@ return [
                // Don't show smilies.
                'no_smilies' => false,
 
+               // optimize_all_tables (Boolean)
+               // Optimizes all tables instead of only tables like workerqueue or the cache
+               'optimize_all_tables' => false,
+
                // paranoia (Boolean)
                // Log out users if their IP address changed.
                'paranoia' => false,