Optimize Database after Deleting Revisions - Version 4.8.4

Version Description

[09/07/2019] = * CHANGE: Improved performance

Download this release

Release Info

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

Code changes from version 4.8.3 to 4.8.4

classes/odb-cleaner.php CHANGED
@@ -1877,10 +1877,13 @@ function odb_confirm_delete() {
1877
  ********************************************************************************************/
1878
  function odb_optimize_tables($scheduler, $action) {
1879
  global $odb_class, $wpdb;
 
 
 
1880
 
1881
  $cnt = 0;
1882
- for ($i = 0; $i < count($odb_class->odb_tables); $i++) {
1883
- if(!isset($odb_class->odb_rvg_excluded_tabs[$odb_class->odb_tables[$i][0]])) {
1884
  # TABLE NOT EXCLUDED
1885
  $cnt++;
1886
 
@@ -1889,7 +1892,7 @@ function odb_confirm_delete() {
1889
  FROM information_schema.TABLES
1890
  WHERE table_schema = '%s'
1891
  AND table_name = '%s'
1892
- ", DB_NAME, $odb_class->odb_tables[$i][0]);
1893
  $table_info = $wpdb->get_results($sql);
1894
 
1895
  if($odb_class->odb_rvg_options["optimize_innodb"] == 'N' && strtolower($table_info[0]->engine) == 'innodb') {
@@ -1898,7 +1901,7 @@ function odb_confirm_delete() {
1898
  } else {
1899
  // v4.6.3
1900
  if (strtolower($table_info[0]->engine) == 'myisam') {
1901
- $result = $this->odb_optimize_myisam($odb_class->odb_tables[$i][0]);
1902
  $msg = $result[0]->Msg_text;
1903
  if ($msg == 'OK') {
1904
  $msg = __('<span class="odb-optimized">TABLE OPTIMIZED</span>', 'rvg-optimize-database');
@@ -1906,7 +1909,7 @@ function odb_confirm_delete() {
1906
  $msg = __('Table is already up to date', 'rvg-optimize-database');
1907
  }
1908
  } else {
1909
- $result = $this->odb_optimize_innodb($odb_class->odb_tables[$i][0]);
1910
  $msg = $result[0]->Msg_text;
1911
  if ($msg == 'Table is already up to date') {
1912
  $msg = __('Table is already up to date', 'rvg-optimize-database');
@@ -1920,7 +1923,7 @@ function odb_confirm_delete() {
1920
  ?>
1921
  <tr>
1922
  <td align="right" valign="top"><?php echo $cnt?>.</td>
1923
- <td valign="top" class="odb-bold"><?php echo $odb_class->odb_tables[$i][0] ?></td>
1924
  <td valign="top"><?php echo $msg ?></td>
1925
  <td valign="top"><?php echo $table_info[0]->engine ?></td>
1926
  <td align="right" valign="top"><?php echo $table_info[0]->table_rows ?></td>
@@ -1929,7 +1932,7 @@ function odb_confirm_delete() {
1929
  <?php
1930
  } // if (!$scheduler && ($action == 'analyze_detail' || $action == 'run_detail'))
1931
  } // if(!$excluded)
1932
- } // for ($i = 0; $i < count($odb_class->odb_tables); $i++)
1933
  return $cnt;
1934
  } // odb_optimize_tables()
1935
 
1877
  ********************************************************************************************/
1878
  function odb_optimize_tables($scheduler, $action) {
1879
  global $odb_class, $wpdb;
1880
+
1881
+ // GET THE DATABASE TABLES
1882
+ $odb_tables = $odb_class->odb_utilities_obj->odb_get_tables();
1883
 
1884
  $cnt = 0;
1885
+ for ($i = 0; $i < count($odb_tables); $i++) {
1886
+ if(!isset($odb_class->odb_rvg_excluded_tabs[$odb_tables[$i][0]])) {
1887
  # TABLE NOT EXCLUDED
1888
  $cnt++;
1889
 
1892
  FROM information_schema.TABLES
1893
  WHERE table_schema = '%s'
1894
  AND table_name = '%s'
1895
+ ", DB_NAME, $odb_tables[$i][0]);
1896
  $table_info = $wpdb->get_results($sql);
1897
 
1898
  if($odb_class->odb_rvg_options["optimize_innodb"] == 'N' && strtolower($table_info[0]->engine) == 'innodb') {
1901
  } else {
1902
  // v4.6.3
1903
  if (strtolower($table_info[0]->engine) == 'myisam') {
1904
+ $result = $this->odb_optimize_myisam($odb_tables[$i][0]);
1905
  $msg = $result[0]->Msg_text;
1906
  if ($msg == 'OK') {
1907
  $msg = __('<span class="odb-optimized">TABLE OPTIMIZED</span>', 'rvg-optimize-database');
1909
  $msg = __('Table is already up to date', 'rvg-optimize-database');
1910
  }
1911
  } else {
1912
+ $result = $this->odb_optimize_innodb($odb_tables[$i][0]);
1913
  $msg = $result[0]->Msg_text;
1914
  if ($msg == 'Table is already up to date') {
1915
  $msg = __('Table is already up to date', 'rvg-optimize-database');
1923
  ?>
1924
  <tr>
1925
  <td align="right" valign="top"><?php echo $cnt?>.</td>
1926
+ <td valign="top" class="odb-bold"><?php echo $odb_tables[$i][0] ?></td>
1927
  <td valign="top"><?php echo $msg ?></td>
1928
  <td valign="top"><?php echo $table_info[0]->engine ?></td>
1929
  <td align="right" valign="top"><?php echo $table_info[0]->table_rows ?></td>
1932
  <?php
1933
  } // if (!$scheduler && ($action == 'analyze_detail' || $action == 'run_detail'))
1934
  } // if(!$excluded)
1935
+ } // for ($i = 0; $i < count($odb_tables); $i++)
1936
  return $cnt;
1937
  } // odb_optimize_tables()
1938
 
includes/settings-page.php CHANGED
@@ -8,7 +8,7 @@
8
  <?php
9
  if (isset($_POST['info_update'])) {
10
  // SAVE SETTINGS
11
- check_admin_referer('odb_action', 'odb_nonce');
12
 
13
  $current_datetime = Date('YmdHis');
14
  $current_date = substr($current_datetime, 0, 8);
@@ -219,6 +219,9 @@ $cb_optimize_innodb = ($this->odb_rvg_options['optimize_innodb'] == "Y") ? $c :
219
  // DISPLAY HEADER
220
  $this->odb_displayer_obj->display_header();
221
 
 
 
 
222
  // DISPLAY FORM
223
  echo '
224
  <div class="odb-padding-left">
@@ -462,16 +465,16 @@ echo '
462
  <div id="odb-options-tables-wrapper">
463
  ';
464
 
465
- for ($i=0; $i<count($this->odb_tables); $i++) {
466
  $class = '';
467
  for($j=0; $j<count($this->odb_ms_prefixes); $j++)
468
- if(substr($this->odb_tables[$i][0], 0, strlen($this->odb_ms_prefixes[$j])) == $this->odb_ms_prefixes[$j]) $class = ' odb-wp-table';
469
  $cb_checked = '';
470
- if(isset($this->odb_rvg_excluded_tabs[$this->odb_tables[$i][0]])) $cb_checked = ' checked';
471
  ?>
472
- <div class="odb-options-table<?php echo $class;?>" title="<?php echo $this->odb_tables[$i][0];?>">
473
- <input id="cb_<?php echo $this->odb_tables[$i][0];?>" name="cb_<?php echo $this->odb_tables[$i][0];?>" type="checkbox" value="1"<?php echo $cb_checked; ?>>
474
- <?php echo $this->odb_tables[$i][0];?></div>
475
  <?php
476
  }
477
 
8
  <?php
9
  if (isset($_POST['info_update'])) {
10
  // SAVE SETTINGS
11
+ check_admin_referer('odb_action', 'odb_nonce');
12
 
13
  $current_datetime = Date('YmdHis');
14
  $current_date = substr($current_datetime, 0, 8);
219
  // DISPLAY HEADER
220
  $this->odb_displayer_obj->display_header();
221
 
222
+ // GET THE DATABASE TABLES
223
+ $odb_tables = $this->odb_utilities_obj->odb_get_tables();
224
+
225
  // DISPLAY FORM
226
  echo '
227
  <div class="odb-padding-left">
465
  <div id="odb-options-tables-wrapper">
466
  ';
467
 
468
+ for ($i=0; $i<count($odb_tables); $i++) {
469
  $class = '';
470
  for($j=0; $j<count($this->odb_ms_prefixes); $j++)
471
+ if(substr($odb_tables[$i][0], 0, strlen($this->odb_ms_prefixes[$j])) == $this->odb_ms_prefixes[$j]) $class = ' odb-wp-table';
472
  $cb_checked = '';
473
+ if(isset($this->odb_rvg_excluded_tabs[$odb_tables[$i][0]])) $cb_checked = ' checked';
474
  ?>
475
+ <div class="odb-options-table<?php echo $class;?>" title="<?php echo $odb_tables[$i][0];?>">
476
+ <input id="cb_<?php echo $odb_tables[$i][0];?>" name="cb_<?php echo $odb_tables[$i][0];?>" type="checkbox" value="1"<?php echo $cb_checked; ?>>
477
+ <?php echo $odb_tables[$i][0];?></div>
478
  <?php
479
  }
480
 
readme.txt CHANGED
@@ -9,9 +9,9 @@ Author: CAGE Web Design | Rolf van Gelder, Eindhoven, The Netherlands
9
  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.3
14
- Version: 4.8.3
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.3 [09/01/2019] =
115
  * BUG FIX: Scheduler bug fixed
116
 
9
  Contributors: cageehv
10
  Requires at least: 2.8
11
  Requires PHP: 5.0
12
+ Tested up to: 5.2.3
13
+ Stable tag: 4.8.4
14
+ Version: 4.8.4
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.4 [09/07/2019] =
115
+ * CHANGE: Improved performance
116
+
117
  = 4.8.3 [09/01/2019] =
118
  * BUG FIX: Scheduler bug fixed
119
 
rvg-optimize-database.php CHANGED
@@ -1,7 +1,7 @@
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,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.3
14
  */
15
 
16
  /********************************************************************************************
@@ -28,8 +28,8 @@ $odb_class = new OptimizeDatabase();
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();
@@ -135,9 +135,6 @@ class OptimizeDatabase {
135
 
136
  // INITIALIZE WORDPRESS HOOKS
137
  $this->odb_init_hooks();
138
-
139
- // GET THE DATABASE TABLES
140
- $this->odb_tables = $this->odb_utilities_obj->odb_get_tables();
141
 
142
  // GET EXCLUDED TABLES FROM SETTINGS
143
  $this->odb_rvg_excluded_tabs = $this->odb_multisite_obj->odb_ms_get_option('odb_rvg_excluded_tabs');
1
  <?php
2
  /**
3
  * @package Optimize Database after Deleting Revisions
4
+ * @version 4.8.4
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.4
14
  */
15
 
16
  /********************************************************************************************
28
 
29
  class OptimizeDatabase {
30
  // VERSION
31
+ var $odb_version = '4.8.4';
32
+ var $odb_release_date = '09/07/2019';
33
 
34
  // PLUGIN OPTIONS
35
  var $odb_rvg_options = array();
135
 
136
  // INITIALIZE WORDPRESS HOOKS
137
  $this->odb_init_hooks();
 
 
 
138
 
139
  // GET EXCLUDED TABLES FROM SETTINGS
140
  $this->odb_rvg_excluded_tabs = $this->odb_multisite_obj->odb_ms_get_option('odb_rvg_excluded_tabs');