Optimize Database after Deleting Revisions - Version 4.8.3

Version Description

[09/01/2019] = * BUG FIX: Scheduler bug fixed

Download this release

Release Info

Developer cageehv
Plugin Icon 128x128 Optimize Database after Deleting Revisions
Version 4.8.3
Comparing to
See all releases

Code changes from version 4.8.2 to 4.8.3

classes/odb-cleaner.php CHANGED
@@ -157,10 +157,10 @@ class ODB_Cleaner {
157
  <?php
158
  } // if ($action == 'analyze_detail' || $action == 'run_detail')
159
 
160
- if (!$scheduler && ($action == 'analyze_detail' || $action == 'run_summary' || $action == 'run_detail')) {
161
  // NUMBER OF DELETED REVISIONS FOR LOG FILE
162
  $odb_class->log_arr["revisions"] = $total_deleted;
163
- } // if (!$scheduler && $action == 'run')
164
  } else {
165
  // NO REVISIONS FOUND
166
  if (!$scheduler) {
@@ -233,7 +233,7 @@ class ODB_Cleaner {
233
 
234
  // LOOP THROUGH THE TRASHED ITEMS AND DELETE THEM
235
  $total_deleted = $this->odb_delete_trash($results, $scheduler, $action);
236
- if (!$scheduler && ($action == 'analyze_detail' || $action == 'run_summary' || $action == 'run_detail')) {
237
  // NUMBER OF DELETED TRASH FOR LOG FILE
238
  $odb_class->log_arr["trash"] = $total_deleted;
239
  } // if (!$scheduler && ($action == 'run_summary' || $action == 'run_detail'))
@@ -316,7 +316,7 @@ class ODB_Cleaner {
316
  // LOOP THROUGH THE SPAMMED ITEMS AND DELETE THEM
317
  $total_deleted = $this->odb_delete_spam($results, $scheduler, $action);
318
 
319
- if (!$scheduler && ($action == 'analyze_detail' || $action == 'run_summary' || $action == 'run_detail')) {
320
  // NUMBER OF DELETED SPAM FOR LOG FILE
321
  $odb_class->log_arr["spam"] = $total_deleted;
322
  } // if (!$scheduler && ($action == 'run_summary' || $action == 'run_detail'))
@@ -399,7 +399,7 @@ class ODB_Cleaner {
399
  // LOOP THROUGH THE UNUSED TAGS AND DELETE THEM
400
  $total_deleted = $this->odb_delete_unused_tags($results, $scheduler, $action);
401
 
402
- if (!$scheduler && ($action == 'analyze_detail' || $action == 'run_summary' || $action == 'run_detail')) {
403
  // NUMBER OF UNUSED TAGS FOR LOG FILE
404
  $odb_class->log_arr["tags"] = $total_deleted;
405
  } // if (!$scheduler && ($action == 'run_summary' || $action == 'run_detail'))
@@ -493,10 +493,11 @@ class ODB_Cleaner {
493
  // LOOP THROUGH THE TRANSIENTS AND DELETE THEM
494
  $total_deleted = $this->odb_delete_transients($results, $scheduler, $action, $option);
495
 
496
- if (!$scheduler && ($action == 'analyze_detail' || $action == 'run_summary' || $action == 'run_detail')) {
497
  // NUMBER OF DELETED SPAM FOR LOG FILE
498
  $odb_class->log_arr["transients"] = $total_deleted;
499
- } // if (!$scheduler && ($action == 'run_summary' || $action == 'run_detail'))
 
500
  if ($action == 'analyze_detail' || $action == 'run_detail') {
501
  ?>
502
  </table>
@@ -581,7 +582,8 @@ class ODB_Cleaner {
581
 
582
  // LOOP THROUGH THE PINGBACKS AND TRACKBACKS AND DELETE THEM
583
  $total_deleted = $this->odb_delete_pingbacks($results, $scheduler, $action);
584
- if (!$scheduler && ($action == 'analyze_detail' || $action == 'run_summary' || $action == 'run_detail')) {
 
585
  // NUMBER OF DELETED PINGBACKS AND TRACKBACKS FOR LOG FILE
586
  $odb_class->log_arr["pingbacks"] = $total_deleted;
587
  } // if (!$scheduler && ($action == 'run_summary' || $action == 'run_detail'))
@@ -671,7 +673,7 @@ class ODB_Cleaner {
671
  // LOOP THROUGH THE ORPHANS THEM
672
  $total_deleted = $this->odb_delete_oembed($results, $scheduler, $action);
673
 
674
- if (!$scheduler && ($action == 'analyze_detail' || $action == 'run_summary' || $action == 'run_detail')) {
675
  // NUMBER OF OEMBED CACHE ITEMS FOR LOG FILE
676
  $odb_class->log_arr["oembeds"] = $total_deleted;
677
  } // if (!$scheduler && ($action == 'run_summary' || $action == 'run_detail')
@@ -759,7 +761,7 @@ class ODB_Cleaner {
759
 
760
  // LOOP THROUGH THE ORPHANS AND DELETE THEM
761
  $total_deleted = $this->odb_delete_orphans($results, $scheduler, $action);
762
- if (!$scheduler && ($action == 'analyze_detail' || $action == 'run_summary' || $action == 'run_detail')) {
763
  // NUMBER OF ORPHANS FOR LOG FILE
764
  $odb_class->log_arr["orphans"] = $total_deleted;
765
  } // if (!$scheduler && ($action == 'run_summary' || $action == 'run_detail')
@@ -846,7 +848,7 @@ class ODB_Cleaner {
846
  // TOTAL SAVING
847
  $odb_class->log_arr["savings"] = $odb_class->odb_utilities_obj->odb_format_size(($this->start_size - $end_size),3);
848
 
849
- if ($action == 'run_summary' || $action == 'run_detail') {
850
  // WRITE RESULTS TO THE DATABASE - v4.6
851
  $odb_class->odb_logger_obj->odb_add_log($odb_class->log_arr);
852
  }
157
  <?php
158
  } // if ($action == 'analyze_detail' || $action == 'run_detail')
159
 
160
+ if ($action == 'analyze_detail' || $action == 'run_summary' || $action == 'run_detail') {
161
  // NUMBER OF DELETED REVISIONS FOR LOG FILE
162
  $odb_class->log_arr["revisions"] = $total_deleted;
163
+ } // if ($action == 'analyze_detail' || $action == 'run_summary' || $action == 'run_detail')
164
  } else {
165
  // NO REVISIONS FOUND
166
  if (!$scheduler) {
233
 
234
  // LOOP THROUGH THE TRASHED ITEMS AND DELETE THEM
235
  $total_deleted = $this->odb_delete_trash($results, $scheduler, $action);
236
+ if ($action == 'analyze_detail' || $action == 'run_summary' || $action == 'run_detail') {
237
  // NUMBER OF DELETED TRASH FOR LOG FILE
238
  $odb_class->log_arr["trash"] = $total_deleted;
239
  } // if (!$scheduler && ($action == 'run_summary' || $action == 'run_detail'))
316
  // LOOP THROUGH THE SPAMMED ITEMS AND DELETE THEM
317
  $total_deleted = $this->odb_delete_spam($results, $scheduler, $action);
318
 
319
+ if ($action == 'analyze_detail' || $action == 'run_summary' || $action == 'run_detail') {
320
  // NUMBER OF DELETED SPAM FOR LOG FILE
321
  $odb_class->log_arr["spam"] = $total_deleted;
322
  } // if (!$scheduler && ($action == 'run_summary' || $action == 'run_detail'))
399
  // LOOP THROUGH THE UNUSED TAGS AND DELETE THEM
400
  $total_deleted = $this->odb_delete_unused_tags($results, $scheduler, $action);
401
 
402
+ if ($action == 'analyze_detail' || $action == 'run_summary' || $action == 'run_detail') {
403
  // NUMBER OF UNUSED TAGS FOR LOG FILE
404
  $odb_class->log_arr["tags"] = $total_deleted;
405
  } // if (!$scheduler && ($action == 'run_summary' || $action == 'run_detail'))
493
  // LOOP THROUGH THE TRANSIENTS AND DELETE THEM
494
  $total_deleted = $this->odb_delete_transients($results, $scheduler, $action, $option);
495
 
496
+ if ($action == 'analyze_detail' || $action == 'run_summary' || $action == 'run_detail') {
497
  // NUMBER OF DELETED SPAM FOR LOG FILE
498
  $odb_class->log_arr["transients"] = $total_deleted;
499
+ } // if (!$scheduler && ($action == 'run_summary' || $action == 'run_detail'))
500
+
501
  if ($action == 'analyze_detail' || $action == 'run_detail') {
502
  ?>
503
  </table>
582
 
583
  // LOOP THROUGH THE PINGBACKS AND TRACKBACKS AND DELETE THEM
584
  $total_deleted = $this->odb_delete_pingbacks($results, $scheduler, $action);
585
+
586
+ if ($action == 'analyze_detail' || $action == 'run_summary' || $action == 'run_detail') {
587
  // NUMBER OF DELETED PINGBACKS AND TRACKBACKS FOR LOG FILE
588
  $odb_class->log_arr["pingbacks"] = $total_deleted;
589
  } // if (!$scheduler && ($action == 'run_summary' || $action == 'run_detail'))
673
  // LOOP THROUGH THE ORPHANS THEM
674
  $total_deleted = $this->odb_delete_oembed($results, $scheduler, $action);
675
 
676
+ if ($action == 'analyze_detail' || $action == 'run_summary' || $action == 'run_detail') {
677
  // NUMBER OF OEMBED CACHE ITEMS FOR LOG FILE
678
  $odb_class->log_arr["oembeds"] = $total_deleted;
679
  } // if (!$scheduler && ($action == 'run_summary' || $action == 'run_detail')
761
 
762
  // LOOP THROUGH THE ORPHANS AND DELETE THEM
763
  $total_deleted = $this->odb_delete_orphans($results, $scheduler, $action);
764
+ if ($action == 'analyze_detail' || $action == 'run_summary' || $action == 'run_detail') {
765
  // NUMBER OF ORPHANS FOR LOG FILE
766
  $odb_class->log_arr["orphans"] = $total_deleted;
767
  } // if (!$scheduler && ($action == 'run_summary' || $action == 'run_detail')
848
  // TOTAL SAVING
849
  $odb_class->log_arr["savings"] = $odb_class->odb_utilities_obj->odb_format_size(($this->start_size - $end_size),3);
850
 
851
+ if ($scheduler || $action == 'run_summary' || $action == 'run_detail') {
852
  // WRITE RESULTS TO THE DATABASE - v4.6
853
  $odb_class->odb_logger_obj->odb_add_log($odb_class->log_arr);
854
  }
classes/odb-displayer.php CHANGED
@@ -185,8 +185,10 @@ class ODB_Displayer {
185
  if(!defined('RUN_OPTIMIZE_DATABASE')) {
186
  echo '
187
  <div id="odb-start-buttons" class="odb-padding-left">
 
188
  <p>
189
  <input class="button odb-normal" type="button" name="change_options" value="'.__('Change Settings', $odb_class->odb_txt_domain).'" onclick="self.location=\'options-general.php?page=odb_settings_page\'">
 
190
  ';
191
 
192
  // v4.6
@@ -211,21 +213,19 @@ function odb_confirm_delete() {
211
  // NOT RUNNING: SHOW LOG- AND START BUTTONS
212
  if($odb_class->odb_logger_obj->odb_log_count() > 0) {
213
  echo '
214
- &nbsp;
215
  <input class="button odb-normal" type="button" name="view_log" value="'.__('View Log', $odb_class->odb_txt_domain).'" onclick="self.location=\'tools.php?page=rvg-optimize-database&action=view_log\'">
216
  &nbsp;
217
  <input class="button odb-normal" type="button" name="clear_log" value="'.__('Clear Log', $odb_class->odb_txt_domain).'" onclick="return odb_confirm_delete();">
218
- &nbsp;
219
  ';
220
  } // if($odb_class->odb_logger_obj->odb_log_count() > 0)
221
 
222
  // v4.8.0
223
  echo '
224
- &nbsp;
225
- <input class="button-primary button-large" type="button" name="analyze_summary" value="'.__('Analyze (summary)', $odb_class->odb_txt_domain).'" onclick="self.location=\'tools.php?page=rvg-optimize-database&action=analyze_summary\'" class="odb-bold">
226
  &nbsp;
227
  <input class="button-primary button-large" type="button" name="analyze_detail" value="'.__('Analyze (detail)', $odb_class->odb_txt_domain).'" onclick="self.location=\'tools.php?page=rvg-optimize-database&action=analyze_detail\'" class="odb-bold">
228
- &nbsp;
229
  <input class="button-primary button-large" type="button" name="run_summary" value="'.__('Optimize (summary)', $odb_class->odb_txt_domain).'" onclick="self.location=\'tools.php?page=rvg-optimize-database&action=run_summary\'" class="odb-bold">
230
  &nbsp;
231
  <input class="button-primary button-large" type="button" name="run_detail" value="'.__('Optimize (detail)', $odb_class->odb_txt_domain).'" onclick="self.location=\'tools.php?page=rvg-optimize-database&action=run_detail\'" class="odb-bold">
185
  if(!defined('RUN_OPTIMIZE_DATABASE')) {
186
  echo '
187
  <div id="odb-start-buttons" class="odb-padding-left">
188
+ <br>
189
  <p>
190
  <input class="button odb-normal" type="button" name="change_options" value="'.__('Change Settings', $odb_class->odb_txt_domain).'" onclick="self.location=\'options-general.php?page=odb_settings_page\'">
191
+ <br><br>
192
  ';
193
 
194
  // v4.6
213
  // NOT RUNNING: SHOW LOG- AND START BUTTONS
214
  if($odb_class->odb_logger_obj->odb_log_count() > 0) {
215
  echo '
 
216
  <input class="button odb-normal" type="button" name="view_log" value="'.__('View Log', $odb_class->odb_txt_domain).'" onclick="self.location=\'tools.php?page=rvg-optimize-database&action=view_log\'">
217
  &nbsp;
218
  <input class="button odb-normal" type="button" name="clear_log" value="'.__('Clear Log', $odb_class->odb_txt_domain).'" onclick="return odb_confirm_delete();">
219
+ <br><br>
220
  ';
221
  } // if($odb_class->odb_logger_obj->odb_log_count() > 0)
222
 
223
  // v4.8.0
224
  echo '
225
+ <input class="button-primary button-large" type="button" name="analyze_summary" value="'.__('Analyze (summary)', $odb_class->odb_txt_domain).'" onclick="self.location=\'tools.php?page=rvg-optimize-database&action=analyze_summary\'" class="odb-bold">
 
226
  &nbsp;
227
  <input class="button-primary button-large" type="button" name="analyze_detail" value="'.__('Analyze (detail)', $odb_class->odb_txt_domain).'" onclick="self.location=\'tools.php?page=rvg-optimize-database&action=analyze_detail\'" class="odb-bold">
228
+ <br><br>
229
  <input class="button-primary button-large" type="button" name="run_summary" value="'.__('Optimize (summary)', $odb_class->odb_txt_domain).'" onclick="self.location=\'tools.php?page=rvg-optimize-database&action=run_summary\'" class="odb-bold">
230
  &nbsp;
231
  <input class="button-primary button-large" type="button" name="run_detail" value="'.__('Optimize (detail)', $odb_class->odb_txt_domain).'" onclick="self.location=\'tools.php?page=rvg-optimize-database&action=run_detail\'" class="odb-bold">
classes/odb-logger.php CHANGED
@@ -68,7 +68,7 @@ class ODB_Logger {
68
  ";
69
  $wpdb->get_results($this->sql);
70
  } // if($odb_class->odb_rvg_options['logging_on'] == "Y")
71
- } // add_log_db()
72
 
73
 
74
  /********************************************************************************************
68
  ";
69
  $wpdb->get_results($this->sql);
70
  } // if($odb_class->odb_rvg_options['logging_on'] == "Y")
71
+ } // odb_add_log()
72
 
73
 
74
  /********************************************************************************************
readme.txt CHANGED
@@ -10,8 +10,8 @@ Contributors: cageehv
10
  Requires at least: 2.8
11
  Requires PHP: 5.0
12
  Tested up to: 5.2.2
13
- Stable tag: 4.8.2
14
- Version: 4.8.2
15
  License: GPLv2 or later
16
 
17
  == Description ==
@@ -111,6 +111,9 @@ http://cagewebdev.com/category/news-tech-art/wordpress/
111
  * If you run the plugin from any of the sites, it will cleanup ALL the sites in the network!
112
 
113
  == Changelog ==
 
 
 
114
  = 4.8.2 [08/15/2019] =
115
  * CHANGE: Rewrote the deletion of (expired) transients
116
 
10
  Requires at least: 2.8
11
  Requires PHP: 5.0
12
  Tested up to: 5.2.2
13
+ Stable tag: 4.8.3
14
+ Version: 4.8.3
15
  License: GPLv2 or later
16
 
17
  == Description ==
111
  * If you run the plugin from any of the sites, it will cleanup ALL the sites in the network!
112
 
113
  == Changelog ==
114
+ = 4.8.3 [09/01/2019] =
115
+ * BUG FIX: Scheduler bug fixed
116
+
117
  = 4.8.2 [08/15/2019] =
118
  * CHANGE: Rewrote the deletion of (expired) transients
119
 
rvg-optimize-database.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /**
3
  * @package Optimize Database after Deleting Revisions
4
- * @version 4.8.2
5
  */
6
  /*
7
  Plugin Name: Optimize Database after Deleting Revisions
@@ -10,7 +10,7 @@ Description: Optimizes the Wordpress Database after Cleaning it out
10
  Author: CAGE Web Design | Rolf van Gelder, Eindhoven, The Netherlands
11
  Author URI: http://cagewebdev.com
12
  Network: True
13
- Version: 4.8.2
14
  */
15
 
16
  /********************************************************************************************
@@ -28,8 +28,8 @@ $odb_class = new OptimizeDatabase();
28
 
29
  class OptimizeDatabase {
30
  // VERSION
31
- var $odb_version = '4.8.2';
32
- var $odb_release_date = '08/15/2019';
33
 
34
  // PLUGIN OPTIONS
35
  var $odb_rvg_options = array();
@@ -701,12 +701,12 @@ class OptimizeDatabase {
701
  ****************************************************************************************/
702
  $this->odb_displayer_obj->display_start_buttons($action);
703
 
704
- // REGISTER THE LAST RUN
705
- $this->odb_rvg_options['last_run'] = current_time('M j, Y @ H:i', 0);
706
  // DELETE REDUNDANT DATA
707
  $this->odb_cleaner_obj->odb_run_cleaner($scheduler, $action);
708
 
709
- if (!$scheduler && ($action == 'run_summary' || $action == 'run_detail')) {
 
 
710
  // OPTIMIZE DATABASE TABLES
711
  $this->odb_cleaner_obj->odb_run_optimizer($scheduler, $action);
712
  // SHOW RESULTS
1
  <?php
2
  /**
3
  * @package Optimize Database after Deleting Revisions
4
+ * @version 4.8.3
5
  */
6
  /*
7
  Plugin Name: Optimize Database after Deleting Revisions
10
  Author: CAGE Web Design | Rolf van Gelder, Eindhoven, The Netherlands
11
  Author URI: http://cagewebdev.com
12
  Network: True
13
+ Version: 4.8.3
14
  */
15
 
16
  /********************************************************************************************
28
 
29
  class OptimizeDatabase {
30
  // VERSION
31
+ var $odb_version = '4.8.3';
32
+ var $odb_release_date = '09/01/2019';
33
 
34
  // PLUGIN OPTIONS
35
  var $odb_rvg_options = array();
701
  ****************************************************************************************/
702
  $this->odb_displayer_obj->display_start_buttons($action);
703
 
 
 
704
  // DELETE REDUNDANT DATA
705
  $this->odb_cleaner_obj->odb_run_cleaner($scheduler, $action);
706
 
707
+ if ($scheduler || $action == 'run_summary' || $action == 'run_detail') {
708
+ // REGISTER THE LAST RUN
709
+ $this->odb_rvg_options['last_run'] = current_time('M j, Y @ H:i', 0);
710
  // OPTIMIZE DATABASE TABLES
711
  $this->odb_cleaner_obj->odb_run_optimizer($scheduler, $action);
712
  // SHOW RESULTS