Optimize Database after Deleting Revisions - Version 2.8.2

Version Description

[08/01/2014] = * BUG FIX: all problems with getting the table names should be fixed now!

Download this release

Release Info

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

Code changes from version 2.8.1 to 2.8.2

Files changed (2) hide show
  1. readme.txt +5 -2
  2. rvg-optimize-db.php +17 -19
readme.txt CHANGED
@@ -8,8 +8,8 @@ Author URI: http://cagewebdev.com
8
  Author: CAGE Web Design | Rolf van Gelder, Eindhoven, The Netherlands
9
  Requires at least: 2.0
10
  Tested up to: 3.9.1
11
- Stable tag: 2.8.1
12
- Version: 2.8.1
13
  License: GPLv2 or later
14
 
15
  == Description ==
@@ -61,6 +61,9 @@ http://wordpress.org/plugins/order-your-posts-manually/
61
 
62
  == Changelog ==
63
 
 
 
 
64
  = 2.8.1 [07/31/2014] =
65
  * CHANGE: changed the 'edit_themes' capability back to 'administrator'-role
66
  * BUG FIX: no table names beside checkboxes (rewrote it, so it should work for every site now)
8
  Author: CAGE Web Design | Rolf van Gelder, Eindhoven, The Netherlands
9
  Requires at least: 2.0
10
  Tested up to: 3.9.1
11
+ Stable tag: 2.8.2
12
+ Version: 2.8.2
13
  License: GPLv2 or later
14
 
15
  == Description ==
61
 
62
  == Changelog ==
63
 
64
+ = 2.8.2 [08/01/2014] =
65
+ * BUG FIX: all problems with getting the table names should be fixed now!
66
+
67
  = 2.8.1 [07/31/2014] =
68
  * CHANGE: changed the 'edit_themes' capability back to 'administrator'-role
69
  * BUG FIX: no table names beside checkboxes (rewrote it, so it should work for every site now)
rvg-optimize-db.php CHANGED
@@ -1,16 +1,16 @@
1
  <?php
2
- $odb_version = '2.8.1';
3
  $odb_release_date = '07/31/2014';
4
  /**
5
  * @package Optimize Database after Deleting Revisions
6
- * @version 2.8.1
7
  */
8
  /*
9
  Plugin Name: Optimize Database after Deleting Revisions
10
  Plugin URI: http://cagewebdev.com/index.php/optimize-database-after-deleting-revisions-wordpress-plugin/
11
  Description: Optimizes the Wordpress Database after Cleaning it out - <a href="options-general.php?page=rvg_odb_admin"><strong>plug in options</strong></a>
12
  Author: CAGE Web Design | Rolf van Gelder, Eindhoven, The Netherlands
13
- Version: 2.8.1
14
  Author URI: http://cagewebdev.com
15
  */
16
 
@@ -351,10 +351,9 @@ if($rvg_odb_logging_on == 'Y') $rvg_odb_logging_on_checked = ' checked="checke
351
  </table></td>
352
  </tr>
353
  <?php
354
- # v2.8.1
355
- $res = mysql_query("SHOW TABLES FROM `".DB_NAME."`");
356
- $tables = array();
357
- while($row = mysql_fetch_array($res, MYSQL_NUM)) $tables[] = "$row[0]";
358
  ?>
359
  <tr>
360
  <td colspan="4" valign="top"><table id="table_list" width="100%" border="0" cellspacing="0" cellpadding="4" style="display:block;">
@@ -366,7 +365,7 @@ if($rvg_odb_logging_on == 'Y') $rvg_odb_logging_on_checked = ' checked="checke
366
  <?php
367
  $c = 0;
368
  $t = 0;
369
- # v2.8.1
370
  for ($i=0; $i<count($tables); $i++)
371
  { $t++;
372
  $c++;
@@ -377,18 +376,18 @@ if($rvg_odb_logging_on == 'Y') $rvg_odb_logging_on_checked = ' checked="checke
377
  }
378
  $style = 'normal';
379
  // WORDPRESS TABLE?
380
- if(substr($tables[$i], 0, strlen($table_prefix)) == $table_prefix) $style = 'bold;color:#00F;';
381
 
382
  $cb_checked = '';
383
  $sql = "
384
  SELECT `option_value`
385
  FROM $wpdb->options
386
- WHERE `option_name` = 'rvg_ex_".$tables[$i]."'
387
  ";
388
  $results = $wpdb -> get_results($sql);
389
  if(isset($results[0]->option_value))
390
  if($results[0]->option_value == 'excluded') $cb_checked = ' checked';
391
- echo '<td width="25%" style="font-weight:'.$style.'"><input id="cb_'.$tables[$i].'" name="cb_'.$tables[$i].'" type="checkbox" value="1" '.$cb_checked.' /> '.$tables[$i].'</td>'."\n";
392
  } # for ($i=0; $i<count($tables); $i++)
393
  ?>
394
  </tr>
@@ -1348,20 +1347,19 @@ function rvg_optimize_tables($display)
1348
  {
1349
  global $wpdb, $table_prefix;
1350
 
1351
- # v2.8.1
1352
- $res = mysql_query("SHOW TABLES FROM `".DB_NAME."`");
1353
- $tables = array();
1354
- while($row = mysql_fetch_array($res, MYSQL_NUM)) $tables[] = "$row[0]";
1355
 
1356
  $cnt = 0;
1357
  for ($i=0; $i<count($tables); $i++)
1358
  {
1359
- $excluded = get_option('rvg_ex_'.$tables[$i]);
1360
 
1361
  if(!$excluded)
1362
  { # TABLE NOT EXCLUDED
1363
  $cnt++;
1364
- $query = "OPTIMIZE TABLE ".$tables[$i];
1365
  $result = $wpdb -> get_results($query);
1366
 
1367
  // v2.7.5
@@ -1371,7 +1369,7 @@ function rvg_optimize_tables($display)
1371
  ) AS size, table_rows
1372
  FROM information_schema.TABLES
1373
  WHERE table_schema = '".strtolower(DB_NAME)."'
1374
- AND table_name = '".$tables[$i]."'
1375
  ";
1376
 
1377
  $table_info = $wpdb -> get_results($sql);
@@ -1381,7 +1379,7 @@ function rvg_optimize_tables($display)
1381
  ?>
1382
  <tr>
1383
  <td align="right" valign="top"><?php echo $cnt?>.</td>
1384
- <td valign="top" style="font-weight:bold;"><?php echo $tables[$i] ?></td>
1385
  <td valign="top"><?php echo $result[0]->Msg_text ?></td>
1386
  <td valign="top"><?php echo $table_info[0]->engine ?></td>
1387
  <td align="right" valign="top"><?php echo $table_info[0]->table_rows ?></td>
1
  <?php
2
+ $odb_version = '2.8.2';
3
  $odb_release_date = '07/31/2014';
4
  /**
5
  * @package Optimize Database after Deleting Revisions
6
+ * @version 2.8.2
7
  */
8
  /*
9
  Plugin Name: Optimize Database after Deleting Revisions
10
  Plugin URI: http://cagewebdev.com/index.php/optimize-database-after-deleting-revisions-wordpress-plugin/
11
  Description: Optimizes the Wordpress Database after Cleaning it out - <a href="options-general.php?page=rvg_odb_admin"><strong>plug in options</strong></a>
12
  Author: CAGE Web Design | Rolf van Gelder, Eindhoven, The Netherlands
13
+ Version: 2.8.2
14
  Author URI: http://cagewebdev.com
15
  */
16
 
351
  </table></td>
352
  </tr>
353
  <?php
354
+ # v2.8.2
355
+ $tables = $wpdb->get_results("SHOW TABLES FROM `".DB_NAME."`",ARRAY_N);
356
+ // print_r($tables);
 
357
  ?>
358
  <tr>
359
  <td colspan="4" valign="top"><table id="table_list" width="100%" border="0" cellspacing="0" cellpadding="4" style="display:block;">
365
  <?php
366
  $c = 0;
367
  $t = 0;
368
+ # v2.8.2
369
  for ($i=0; $i<count($tables); $i++)
370
  { $t++;
371
  $c++;
376
  }
377
  $style = 'normal';
378
  // WORDPRESS TABLE?
379
+ if(substr($tables[$i][0], 0, strlen($table_prefix)) == $table_prefix) $style = 'bold;color:#00F;';
380
 
381
  $cb_checked = '';
382
  $sql = "
383
  SELECT `option_value`
384
  FROM $wpdb->options
385
+ WHERE `option_name` = 'rvg_ex_".$tables[$i][0]."'
386
  ";
387
  $results = $wpdb -> get_results($sql);
388
  if(isset($results[0]->option_value))
389
  if($results[0]->option_value == 'excluded') $cb_checked = ' checked';
390
+ echo '<td width="25%" style="font-weight:'.$style.'"><input id="cb_'.$tables[$i][0].'" name="cb_'.$tables[$i][0].'" type="checkbox" value="1" '.$cb_checked.' /> '.$tables[$i][0].'</td>'."\n";
391
  } # for ($i=0; $i<count($tables); $i++)
392
  ?>
393
  </tr>
1347
  {
1348
  global $wpdb, $table_prefix;
1349
 
1350
+ # v2.8.2
1351
+ $tables = $wpdb->get_results("SHOW TABLES FROM `".DB_NAME."`",ARRAY_N);
1352
+ // print_r($tables);
 
1353
 
1354
  $cnt = 0;
1355
  for ($i=0; $i<count($tables); $i++)
1356
  {
1357
+ $excluded = get_option('rvg_ex_'.$tables[$i][0]);
1358
 
1359
  if(!$excluded)
1360
  { # TABLE NOT EXCLUDED
1361
  $cnt++;
1362
+ $query = "OPTIMIZE TABLE ".$tables[$i][0];
1363
  $result = $wpdb -> get_results($query);
1364
 
1365
  // v2.7.5
1369
  ) AS size, table_rows
1370
  FROM information_schema.TABLES
1371
  WHERE table_schema = '".strtolower(DB_NAME)."'
1372
+ AND table_name = '".$tables[$i][0]."'
1373
  ";
1374
 
1375
  $table_info = $wpdb -> get_results($sql);
1379
  ?>
1380
  <tr>
1381
  <td align="right" valign="top"><?php echo $cnt?>.</td>
1382
+ <td valign="top" style="font-weight:bold;"><?php echo $tables[$i][0] ?></td>
1383
  <td valign="top"><?php echo $result[0]->Msg_text ?></td>
1384
  <td valign="top"><?php echo $table_info[0]->engine ?></td>
1385
  <td align="right" valign="top"><?php echo $table_info[0]->table_rows ?></td>