Optimize Database after Deleting Revisions - Version 1.1.9

Version Description

No Upgrade Notice available.

Download this release

Release Info

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

Code changes from version 1.1.8 to 1.1.9

Files changed (2) hide show
  1. readme.txt +3 -2
  2. rvg-optimize-db.php +18 -13
readme.txt CHANGED
@@ -9,8 +9,8 @@ Author URI: http://cagewebdev.com
9
  Author: Rolf van Gelder, Eindhoven, The Netherlands
10
  Requires at least: 2.0
11
  Tested up to: 3.4.2
12
- Stable tag: 1.1.8
13
- Version: 1.1.8
14
 
15
  == Description ==
16
 
@@ -51,6 +51,7 @@ No Screenshots available.
51
  <p><b>1.1.6</b> 09/01/2012 Fixed the link to the options page</p>
52
  <p><b>1.1.7</b> 09/03/2012 Some textual and link fixes</p>
53
  <p><b>1.1.8</b> 09/08/2012 Another link fix</p>
 
54
 
55
  == Frequently Asked Questions ==
56
 
9
  Author: Rolf van Gelder, Eindhoven, The Netherlands
10
  Requires at least: 2.0
11
  Tested up to: 3.4.2
12
+ Stable tag: 1.1.9
13
+ Version: 1.1.9
14
 
15
  == Description ==
16
 
51
  <p><b>1.1.6</b> 09/01/2012 Fixed the link to the options page</p>
52
  <p><b>1.1.7</b> 09/03/2012 Some textual and link fixes</p>
53
  <p><b>1.1.8</b> 09/08/2012 Another link fix</p>
54
+ <p><b>1.1.9</b> 09/27/2012 Using a different method for retrieving database table names</p>
55
 
56
  == Frequently Asked Questions ==
57
 
rvg-optimize-db.php CHANGED
@@ -1,16 +1,16 @@
1
  <?php
2
- $version = '1.1.8';
3
- $release_date = '08/09/2012';
4
  /**
5
  * @package Optimize Database after Deleting Revisions
6
- * @version 1.1.8
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 Deleting Revisions - <a href="options-general.php?page=rvg_odb_admin"><strong>plug in options</strong></a>
12
  Author: Rolf van Gelder, Eindhoven, The Netherlands
13
- Version: 1.1.8
14
  Author URI: http://cagewebdev.com
15
  */
16
  ?>
@@ -123,7 +123,11 @@ function rvg_optimize_db()
123
  DELETE REVISIONS
124
 
125
  ******************************************************************************************/
126
- $max_revisions = get_option('rvg_odb_number');
 
 
 
 
127
  ?>
128
 
129
  <h2 style="padding-left:8px;">Optimizing your WordPress Database</h2>
@@ -207,9 +211,6 @@ function rvg_optimize_db()
207
  OPTIMIZE TABLES
208
 
209
  ******************************************************************************************/
210
- # GET TABLE NAMES
211
- $Tables = $wpdb -> get_results('SHOW TABLES IN '.DB_NAME);
212
- $Tables_in_DB_NAME = 'Tables_in_'.DB_NAME;
213
  ?>
214
  <table border="0" cellspacing="8" cellpadding="2">
215
  <tr>
@@ -220,15 +221,19 @@ function rvg_optimize_db()
220
  <th style="border-bottom:solid 1px #999;" align="left">table name</th>
221
  <th style="border-bottom:solid 1px #999;" align="left">optimization result</th>
222
  </tr>
223
- <?php
224
- for ($i=0; $i<count($Tables); $i++)
 
 
 
225
  {
226
- $query = "OPTIMIZE TABLE ".$Tables[$i]->$Tables_in_DB_NAME;
 
227
  $result = $wpdb -> get_results($query);
228
  ?>
229
  <tr>
230
- <td align="right"><?php echo ($i+1)?>.</td>
231
- <td style="font-weight:bold;"><?php echo $Tables[$i]->$Tables_in_DB_NAME ?></td>
232
  <td><?php echo $result[0]->Msg_text ?></td>
233
  </tr>
234
  <?php
1
  <?php
2
+ $version = '1.1.9';
3
+ $release_date = '27/09/2012';
4
  /**
5
  * @package Optimize Database after Deleting Revisions
6
+ * @version 1.1.9
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 Deleting Revisions - <a href="options-general.php?page=rvg_odb_admin"><strong>plug in options</strong></a>
12
  Author: Rolf van Gelder, Eindhoven, The Netherlands
13
+ Version: 1.1.9
14
  Author URI: http://cagewebdev.com
15
  */
16
  ?>
123
  DELETE REVISIONS
124
 
125
  ******************************************************************************************/
126
+ $max_revisions = get_option('rvg_odb_number');
127
+ if(!$max_revisions)
128
+ { $max_revisions = 0;
129
+ update_option('rvg_odb_number', $max_revisions);
130
+ }
131
  ?>
132
 
133
  <h2 style="padding-left:8px;">Optimizing your WordPress Database</h2>
211
  OPTIMIZE TABLES
212
 
213
  ******************************************************************************************/
 
 
 
214
  ?>
215
  <table border="0" cellspacing="8" cellpadding="2">
216
  <tr>
221
  <th style="border-bottom:solid 1px #999;" align="left">table name</th>
222
  <th style="border-bottom:solid 1px #999;" align="left">optimization result</th>
223
  </tr>
224
+ <?php
225
+ # GET TABLE NAMES
226
+ $names = mysql_list_tables(DB_NAME);
227
+ $cnt = 0;
228
+ while($row = mysql_fetch_row($names))
229
  {
230
+ $cnt++;
231
+ $query = "OPTIMIZE TABLE ".$row[0];
232
  $result = $wpdb -> get_results($query);
233
  ?>
234
  <tr>
235
+ <td align="right"><?php echo $cnt?>.</td>
236
+ <td style="font-weight:bold;"><?php echo $row[0] ?></td>
237
  <td><?php echo $result[0]->Msg_text ?></td>
238
  </tr>
239
  <?php