Optimize Database after Deleting Revisions - Version 2.5.1

Version Description

[05/24/2013] = * BUG FIX: some short tags removed * CHANGE: schedule time is only relevant and therefore only shown for 'daily' and 'weekly' schedules * NEW: option to turn the '1-click' button in the admin bar on/off

Download this release

Release Info

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

Code changes from version 2.5 to 2.5.1

Files changed (2) hide show
  1. readme.txt +11 -4
  2. rvg-optimize-db.php +33 -18
readme.txt CHANGED
@@ -6,10 +6,10 @@ Plugin URI: http://cagewebdev.com/index.php/optimize-database-after-deleting-rev
6
  Tags: database, delete, revisions, optimize, post, posts, page, pages, clean, clean up, trash, spam, trashed, spammed, database size, scheduler
7
  Author URI: http://cagewebdev.com
8
  Author: CAGE Web Design | Rolf van Gelder, Eindhoven, The Netherlands
9
- Requires at least: 2.5
10
  Tested up to: 3.5.1
11
- Stable tag: 2.5
12
- Version: 2.5
13
 
14
  == Description ==
15
 
@@ -23,6 +23,7 @@ This plugin is a 'One Click' WordPress Database Cleaner / Optimizer.
23
  * Optimizes the database tables (optionally you can exclude certain tables from optimization)
24
  * Creates a log file of the optimizations (optional)
25
  * Optimization can be scheduled to automatically run once hourly, twice daily, once daily or once weekly at a specific time (optional)
 
26
 
27
  = Settings =
28
  You can find the settings page in the WP Admin Panel » Settings » Optimize DB Options.
@@ -48,6 +49,11 @@ http://wordpress.org/extend/plugins/rvg-optimize-database/
48
 
49
  == Changelog ==
50
 
 
 
 
 
 
51
  = 2.5 [05/24/2013] =
52
  * NEW: you can set a time (hour) for the scheduler to run (thanks to frekel)
53
  * NEW: '1-click run button' in the admin bar (thanks to JB ORSI)
@@ -162,7 +168,8 @@ http://wordpress.org/extend/plugins/rvg-optimize-database/
162
  * WP Admin Panel » Settings » Optimize DB Options'. There you can define the maximum number of - most recent - revisions you want to keep per post or page and some more options.
163
 
164
  = How do I run this plugin? =
165
- * WP Admin Panel » Tools » Optimize Database. Then click the 'Start Optimization'-button. Et voila!
 
166
 
167
  = Why do I see 'Table does not support optimize, doing recreate + analyze instead' while optimizing my database? =
168
  * That is because the table type of that table is not 'MyISAM'
6
  Tags: database, delete, revisions, optimize, post, posts, page, pages, clean, clean up, trash, spam, trashed, spammed, database size, scheduler
7
  Author URI: http://cagewebdev.com
8
  Author: CAGE Web Design | Rolf van Gelder, Eindhoven, The Netherlands
9
+ Requires at least: 2.5.1
10
  Tested up to: 3.5.1
11
+ Stable tag: 2.5.1
12
+ Version: 2.5.1
13
 
14
  == Description ==
15
 
23
  * Optimizes the database tables (optionally you can exclude certain tables from optimization)
24
  * Creates a log file of the optimizations (optional)
25
  * Optimization can be scheduled to automatically run once hourly, twice daily, once daily or once weekly at a specific time (optional)
26
+ * 'Optimize DB (1 click)' link in the admin bar (optional)
27
 
28
  = Settings =
29
  You can find the settings page in the WP Admin Panel » Settings » Optimize DB Options.
49
 
50
  == Changelog ==
51
 
52
+ = 2.5.1 [05/24/2013] =
53
+ * BUG FIX: some short tags removed
54
+ * CHANGE: schedule time is only relevant and therefore only shown for 'daily' and 'weekly' schedules
55
+ * NEW: option to turn the '1-click' button in the admin bar on/off
56
+
57
  = 2.5 [05/24/2013] =
58
  * NEW: you can set a time (hour) for the scheduler to run (thanks to frekel)
59
  * NEW: '1-click run button' in the admin bar (thanks to JB ORSI)
168
  * WP Admin Panel » Settings » Optimize DB Options'. There you can define the maximum number of - most recent - revisions you want to keep per post or page and some more options.
169
 
170
  = How do I run this plugin? =
171
+ * WP Admin Panel » Tools » Optimize Database. Then click the 'Start Optimization'-button.
172
+ * Click the 'Optimize DB (1 click)' link in the Admin Bar (if enabled)
173
 
174
  = Why do I see 'Table does not support optimize, doing recreate + analyze instead' while optimizing my database? =
175
  * That is because the table type of that table is not 'MyISAM'
rvg-optimize-db.php CHANGED
@@ -1,16 +1,16 @@
1
  <?php
2
- $odb_version = '2.5';
3
  $odb_release_date = '05/24/2013';
4
  /**
5
  * @package Optimize Database after Deleting Revisions
6
- * @version 2.5
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.5
14
  Author URI: http://cagewebdev.com
15
  */
16
  ?>
@@ -44,7 +44,7 @@ add_action( 'admin_menu', 'rvg_odb_admin_menu' );
44
 
45
  /********************************************************************************************
46
 
47
- ADD THE '1 CLICK OPTIMIZE DATABASE' ITEM TO THE ADMIN BAR
48
 
49
  *********************************************************************************************/
50
  function rvg_odb_admin_bar()
@@ -53,7 +53,8 @@ function rvg_odb_admin_bar()
53
  $siteurl = site_url('/');
54
  $wp_admin_bar->add_menu( array('id' => 'optimize','title' => __( 'Optimize DB (1 click)'),'href' => __($siteurl.'wp-admin/tools.php?page=rvg-optimize-db.php&action=run') ) );
55
  }
56
- add_action( 'wp_before_admin_bar_render', 'rvg_odb_admin_bar' );
 
57
 
58
 
59
  /********************************************************************************************
@@ -113,7 +114,7 @@ function rvg_odb_options_page() {
113
  $current_hour = substr($current_datetime, 8, 2);
114
 
115
  # jQuery FRAMEWORK
116
- echo '<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>';
117
 
118
  # RVG_WP_ONLY IS DEPRECIATED FROM v2.2
119
  rvg_fix_wp_only();
@@ -158,6 +159,11 @@ function rvg_odb_options_page() {
158
  if(isset($_POST['rvg_clear_spam']))
159
  $rvg_clear_spam = $_POST['rvg_clear_spam'];
160
  update_option('rvg_clear_spam', $rvg_clear_spam);
 
 
 
 
 
161
 
162
  $rvg_odb_logging_on = 'N';
163
  if(isset($_POST['rvg_odb_logging_on']))
@@ -220,15 +226,16 @@ function rvg_odb_options_page() {
220
  if(!$rvg_odb_schedule) $rvg_odb_schedule = '';
221
 
222
  $rvg_odb_schedulehour = get_option('rvg_odb_schedulehour');
 
 
 
223
  ?>
224
  <script type="text/javascript">
225
  function schedule_changed()
226
- {
227
- document.options.rvg_odb_schedulehour.value = '<?php echo$current_hour?>';
228
- if(document.options.rvg_odb_schedule.value == '' || document.options.rvg_odb_schedule.value == 'hourly')
229
- document.options.rvg_odb_schedulehour.disabled = true;
230
  else
231
- document.options.rvg_odb_schedulehour.disabled = false;
232
  }
233
  </script>
234
  <form name="options" method="post" action="">
@@ -251,6 +258,7 @@ function schedule_changed()
251
  </blockquote>
252
  <h2>Optimize Database after Deleting Revisions - Options</h2>
253
  <?php
 
254
  if($rvg_clear_trash == 'Y') $rvg_clear_trash_checked = ' checked="checked"'; else $rvg_clear_trash_checked = '';
255
  if($rvg_clear_spam == 'Y') $rvg_clear_spam_checked = ' checked="checked"'; else $rvg_clear_spam_checked = '';
256
  if($rvg_odb_logging_on == 'Y') $rvg_odb_logging_on_checked = ' checked="checked"'; else $rvg_odb_logging_on_checked = '';
@@ -285,27 +293,34 @@ if($rvg_odb_logging_on == 'Y') $rvg_odb_logging_on_checked = ' checked="checke
285
  <option value="twicedaily">run optimization TWICE A DAY</option>
286
  <option value="daily">run optimization DAILY</option>
287
  <option value="weekly">run optimization WEEKLY</option>
288
- <?php /*?> <option value="test">run optimization TEST</option><?php */?>
289
  </select>
290
  <script type="text/javascript">
291
- document.options.rvg_odb_schedule.value = '<?php echo $rvg_odb_schedule; ?>';
292
- </script>
 
293
  <span style="font-weight:bold;">Time</span>
294
  <select name="rvg_odb_schedulehour" id="rvg_odb_schedulehour">
295
  <?php
296
  for($i=0; $i<=23; $i++)
297
  { if($i<10) $i = '0'.$i;
298
  ?>
299
- <option value="<?=$i?>">
300
- <?=$i.':00'.' hrs'?>
301
- </option>
302
  <?php
303
  }
304
  ?>
305
  </select>
306
  <script type="text/javascript">
307
  document.options.rvg_odb_schedulehour.value = '<?php echo $rvg_odb_schedulehour; ?>';
308
- </script></td>
 
 
 
 
 
 
 
 
309
  </tr>
310
  </table></td>
311
  </tr>
1
  <?php
2
+ $odb_version = '2.5.1';
3
  $odb_release_date = '05/24/2013';
4
  /**
5
  * @package Optimize Database after Deleting Revisions
6
+ * @version 2.5.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.5.1
14
  Author URI: http://cagewebdev.com
15
  */
16
  ?>
44
 
45
  /********************************************************************************************
46
 
47
+ ADD THE '1 CLICK OPTIMIZE DATABASE' ITEM TO THE ADMIN BAR (IF ACTIVATED)
48
 
49
  *********************************************************************************************/
50
  function rvg_odb_admin_bar()
53
  $siteurl = site_url('/');
54
  $wp_admin_bar->add_menu( array('id' => 'optimize','title' => __( 'Optimize DB (1 click)'),'href' => __($siteurl.'wp-admin/tools.php?page=rvg-optimize-db.php&action=run') ) );
55
  }
56
+ $rvg_odb_adminbar = get_option('rvg_odb_adminbar');
57
+ if($rvg_odb_adminbar == "Y") add_action( 'wp_before_admin_bar_render', 'rvg_odb_admin_bar' );
58
 
59
 
60
  /********************************************************************************************
114
  $current_hour = substr($current_datetime, 8, 2);
115
 
116
  # jQuery FRAMEWORK
117
+ echo '<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>';
118
 
119
  # RVG_WP_ONLY IS DEPRECIATED FROM v2.2
120
  rvg_fix_wp_only();
159
  if(isset($_POST['rvg_clear_spam']))
160
  $rvg_clear_spam = $_POST['rvg_clear_spam'];
161
  update_option('rvg_clear_spam', $rvg_clear_spam);
162
+
163
+ $rvg_odb_adminbar = 'N';
164
+ if(isset($_POST['rvg_odb_adminbar']))
165
+ $rvg_odb_adminbar = $_POST['rvg_odb_adminbar'];
166
+ update_option('rvg_odb_adminbar', $rvg_odb_adminbar);
167
 
168
  $rvg_odb_logging_on = 'N';
169
  if(isset($_POST['rvg_odb_logging_on']))
226
  if(!$rvg_odb_schedule) $rvg_odb_schedule = '';
227
 
228
  $rvg_odb_schedulehour = get_option('rvg_odb_schedulehour');
229
+
230
+ $rvg_odb_adminbar = get_option('rvg_odb_adminbar');
231
+ if(!$rvg_odb_adminbar) $rvg_odb_adminbar = 'N';
232
  ?>
233
  <script type="text/javascript">
234
  function schedule_changed()
235
+ { if(document.options.rvg_odb_schedule.value == 'daily' || document.options.rvg_odb_schedule.value == 'weekly')
236
+ $("#schedulehour").show();
 
 
237
  else
238
+ $("#schedulehour").hide();
239
  }
240
  </script>
241
  <form name="options" method="post" action="">
258
  </blockquote>
259
  <h2>Optimize Database after Deleting Revisions - Options</h2>
260
  <?php
261
+ if($rvg_odb_adminbar == 'Y') $rvg_odb_adminbar_checked = ' checked="checked"'; else $rvg_odb_adminbar_checked = '';
262
  if($rvg_clear_trash == 'Y') $rvg_clear_trash_checked = ' checked="checked"'; else $rvg_clear_trash_checked = '';
263
  if($rvg_clear_spam == 'Y') $rvg_clear_spam_checked = ' checked="checked"'; else $rvg_clear_spam_checked = '';
264
  if($rvg_odb_logging_on == 'Y') $rvg_odb_logging_on_checked = ' checked="checked"'; else $rvg_odb_logging_on_checked = '';
293
  <option value="twicedaily">run optimization TWICE A DAY</option>
294
  <option value="daily">run optimization DAILY</option>
295
  <option value="weekly">run optimization WEEKLY</option>
296
+ <?php /*?><option value="test">run optimization TEST</option><?php */?>
297
  </select>
298
  <script type="text/javascript">
299
+ document.options.rvg_odb_schedule.value = '<?php echo $rvg_odb_schedule; ?>';
300
+ </script>
301
+ <span id="schedulehour" style="display:none;">
302
  <span style="font-weight:bold;">Time</span>
303
  <select name="rvg_odb_schedulehour" id="rvg_odb_schedulehour">
304
  <?php
305
  for($i=0; $i<=23; $i++)
306
  { if($i<10) $i = '0'.$i;
307
  ?>
308
+ <option value="<?php echo $i?>"><?php echo $i.':00'.' hrs'?></option>
 
 
309
  <?php
310
  }
311
  ?>
312
  </select>
313
  <script type="text/javascript">
314
  document.options.rvg_odb_schedulehour.value = '<?php echo $rvg_odb_schedulehour; ?>';
315
+ </script>
316
+ </span>
317
+ <script type="text/javascript">schedule_changed();</script>
318
+ </td>
319
+ </tr>
320
+ <tr>
321
+ <td align="right" valign="top"><span style="font-weight:bold;">Show '1-click' link in Admin Bar</span></td>
322
+ <td valign="top"><input name="rvg_odb_adminbar" type="checkbox" value="Y" <?php echo $rvg_odb_adminbar_checked?> />
323
+ (change will be visible after loading the next page)</td>
324
  </tr>
325
  </table></td>
326
  </tr>