Optimize Database after Deleting Revisions - Version 2.7.4

Version Description

[12/11/2013] = * BUG FIX: added 'backticks' around the database name in a few queries

Download this release

Release Info

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

Code changes from version 2.7.3 to 2.7.4

Files changed (2) hide show
  1. readme.txt +5 -2
  2. rvg-optimize-db.php +17 -15
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.7.1
11
- Stable tag: 2.7.3
12
- Version: 2.7.3
13
 
14
  == Description ==
15
 
@@ -54,6 +54,9 @@ No warranty, use at own risk!
54
 
55
  == Changelog ==
56
 
 
 
 
57
  = 2.7.3 [12/09/2013] =
58
  * BUG FIX: deleted some CR/LF's from the end of the plugin *sigh*
59
 
8
  Author: CAGE Web Design | Rolf van Gelder, Eindhoven, The Netherlands
9
  Requires at least: 2.0
10
  Tested up to: 3.7.1
11
+ Stable tag: 2.7.4
12
+ Version: 2.7.4
13
 
14
  == Description ==
15
 
54
 
55
  == Changelog ==
56
 
57
+ = 2.7.4 [12/11/2013] =
58
+ * BUG FIX: added 'backticks' around the database name in a few queries
59
+
60
  = 2.7.3 [12/09/2013] =
61
  * BUG FIX: deleted some CR/LF's from the end of the plugin *sigh*
62
 
rvg-optimize-db.php CHANGED
@@ -1,16 +1,16 @@
1
  <?php
2
- $odb_version = '2.7.3';
3
- $odb_release_date = '12/09/2013';
4
  /**
5
  * @package Optimize Database after Deleting Revisions
6
- * @version 2.7.3
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.7.3
14
  Author URI: http://cagewebdev.com
15
  */
16
  ?>
@@ -347,7 +347,7 @@ if($rvg_odb_logging_on == 'Y') $rvg_odb_logging_on_checked = ' checked="checke
347
  </table></td>
348
  </tr>
349
  <?php
350
- $names = mysql_query("SHOW TABLES FROM ".DB_NAME);
351
  ?>
352
  <tr>
353
  <td colspan="4" valign="top"><table id="table_list" width="100%" border="0" cellspacing="0" cellpadding="4" style="display:block;">
@@ -497,8 +497,8 @@ function rvg_optimize_db()
497
 
498
  $sql = "
499
  SELECT COUNT(*) cnt
500
- FROM $wpdb->options op
501
- WHERE op.option_name LIKE 'rvg_ex_%'
502
  ";
503
  $results = $wpdb -> get_results($sql);
504
  $number_excluded = $results[0] -> cnt;
@@ -1363,7 +1363,7 @@ function rvg_optimize_tables($display)
1363
  # WP_ONLY IS DEPRECIATED FROM v2.2
1364
  rvg_fix_wp_only();
1365
 
1366
- $names = mysql_query("SHOW TABLES FROM ".DB_NAME);
1367
  $cnt = 0;
1368
  while($row = mysql_fetch_row($names))
1369
  {
@@ -1376,10 +1376,12 @@ function rvg_optimize_tables($display)
1376
  $result = $wpdb -> get_results($query);
1377
 
1378
  $sql = "
1379
- SELECT engine, (data_length + index_length) as size, table_rows
1380
- FROM information_schema.TABLES
1381
- WHERE table_schema = '".strtolower(DB_NAME)."'
1382
- AND table_name = '".$row[0]."'
 
 
1383
  ";
1384
 
1385
  $table_info = $wpdb -> get_results($sql);
@@ -1416,7 +1418,7 @@ function rvg_fix_wp_only()
1416
  $wp_only = get_option('rvg_wp_only');
1417
  if($wp_only == 'Y')
1418
  {
1419
- $names = mysql_query("SHOW TABLES FROM ".DB_NAME);
1420
  while($row = mysql_fetch_row($names))
1421
  { if(substr($row[0],0,strlen($table_prefix)) != $table_prefix)
1422
  { // NOT A WORDPRESS TABLE: EXLUDE IT
@@ -1622,9 +1624,9 @@ function rvg_get_db_size()
1622
  global $wpdb;
1623
 
1624
  $sql = "
1625
- SELECT SUM(data_length + index_length) size
1626
  FROM information_schema.TABLES
1627
- WHERE table_schema = '".strtolower(DB_NAME)."'
1628
  GROUP BY table_schema
1629
  ";
1630
 
1
  <?php
2
+ $odb_version = '2.7.4';
3
+ $odb_release_date = '12/11/2013';
4
  /**
5
  * @package Optimize Database after Deleting Revisions
6
+ * @version 2.7.4
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.7.4
14
  Author URI: http://cagewebdev.com
15
  */
16
  ?>
347
  </table></td>
348
  </tr>
349
  <?php
350
+ $names = mysql_query("SHOW TABLES FROM `".DB_NAME."`");
351
  ?>
352
  <tr>
353
  <td colspan="4" valign="top"><table id="table_list" width="100%" border="0" cellspacing="0" cellpadding="4" style="display:block;">
497
 
498
  $sql = "
499
  SELECT COUNT(*) cnt
500
+ FROM $wpdb->options
501
+ WHERE option_name LIKE 'rvg_ex_%'
502
  ";
503
  $results = $wpdb -> get_results($sql);
504
  $number_excluded = $results[0] -> cnt;
1363
  # WP_ONLY IS DEPRECIATED FROM v2.2
1364
  rvg_fix_wp_only();
1365
 
1366
+ $names = mysql_query("SHOW TABLES FROM `".DB_NAME."`");
1367
  $cnt = 0;
1368
  while($row = mysql_fetch_row($names))
1369
  {
1376
  $result = $wpdb -> get_results($query);
1377
 
1378
  $sql = "
1379
+ SELECT engine, (
1380
+ data_length + index_length
1381
+ ) AS size, table_rows
1382
+ FROM information_schema.TABLES
1383
+ WHERE LCase( table_schema ) = LCase( '".DB_NAME."' )
1384
+ AND table_name = '".$row[0]."'
1385
  ";
1386
 
1387
  $table_info = $wpdb -> get_results($sql);
1418
  $wp_only = get_option('rvg_wp_only');
1419
  if($wp_only == 'Y')
1420
  {
1421
+ $names = mysql_query("SHOW TABLES FROM `".DB_NAME."`");
1422
  while($row = mysql_fetch_row($names))
1423
  { if(substr($row[0],0,strlen($table_prefix)) != $table_prefix)
1424
  { // NOT A WORDPRESS TABLE: EXLUDE IT
1624
  global $wpdb;
1625
 
1626
  $sql = "
1627
+ SELECT SUM( data_length + index_length ) size
1628
  FROM information_schema.TABLES
1629
+ WHERE LCase( table_schema ) = LCase( '".DB_NAME."' )
1630
  GROUP BY table_schema
1631
  ";
1632