Better Delete Revision - Version 1.5

Version Description

  • 17.09.2014 =
  • Update : We've added a fix for compatibility with the plugin NextGen Gallery.
Download this release

Release Info

Developer bestweblayout
Plugin Icon 128x128 Better Delete Revision
Version 1.5
Comparing to
See all releases

Code changes from version 1.3 to 1.5

better-delete-revision.php CHANGED
@@ -14,9 +14,9 @@ throughout use. Removing old revisions and database optimizations is one of the
14
  best things you can do to your Wordpress blog to keep it running as fast as it
15
  can.
16
  Author: Galerio & Urda, BestWebLayout
17
- Version: 1.3
18
  Author URI: http://www.1e2.it/
19
- License: GPLv2 or later
20
  */
21
 
22
  /*
@@ -92,12 +92,12 @@ if ( ! function_exists( 'bdr_page' ) ) {
92
 
93
  $bdr_plugin_info = get_plugin_data( __FILE__ );
94
  $bdr_version = $bdr_plugin_info['Version'];
95
- $bdr_posts = count(
96
- $wpdb->get_results(
97
- "SELECT ID
98
- FROM ($wpdb->posts)
99
  WHERE `post_type` = 'post'"
100
- )
101
  ); ?>
102
  <div class="wrap">
103
  <h2><?php _e( 'Better Delete Revision Manager', 'bdr' ); ?> <font size=1><?php echo $bdr_version; ?></font></h2>
@@ -106,7 +106,7 @@ if ( ! function_exists( 'bdr_page' ) ) {
106
  <p><?php _e( 'Since you started using Better Delete Revision', 'bdr' ); ?>, <span id="bdr_revs_no"><?php echo $bdr_rev_no; ?></span> <?php _e( 'redundant post revisions have been removed!', 'bdr' ); ?></p>
107
  </div><!-- .widget -->
108
  <?php if ( isset( $_POST['bdr_get_rev'] ) && check_admin_referer( plugin_basename( __FILE__ ) ) ) {
109
- $bdr_results = $wpdb->get_results(
110
  "SELECT `ID`,`post_date`,`post_title`,`post_modified`
111
  FROM ($wpdb->posts)
112
  WHERE `post_type` = 'revision'
@@ -143,19 +143,28 @@ if ( ! function_exists( 'bdr_page' ) ) {
143
  </form>
144
  <?php } else { ?>
145
  <div class="updated bdr_no_rev">
146
- <?php _e( 'Great! You have no revisions now!', 'bdr' ); ?>
 
 
147
  </div>
148
  <?php }
149
  } elseif ( isset( $_POST['bdr_del_act'] ) && check_admin_referer( plugin_basename( __FILE__ ) ) ) {
150
- $bdr_results = $wpdb->get_results(
151
- "DELETE a,b,c
152
- FROM $wpdb->posts a
153
- LEFT JOIN $wpdb->term_relationships b
154
- ON (a.ID = b.object_id)
155
- LEFT JOIN $wpdb->postmeta c
156
- ON (a.ID = c.post_id)
157
- WHERE a.post_type = 'revision'"
158
  );
 
 
 
 
 
 
 
 
 
159
  $bdr_del_no = $_POST['bdr_rev_no'];
160
  $bdr_rev_new = $bdr_rev_no + $bdr_del_no;
161
  update_option( 'bdr_rev_no', $bdr_rev_new ); ?>
@@ -203,7 +212,7 @@ if ( ! function_exists( 'bdr_page' ) ) {
203
  <?php foreach ( $bdr_result as $j => $o ) { ?>
204
  <tr>
205
  <?php foreach ( $o as $k => $v ) {
206
- $bdr_tr_class = $j%2 == 1 ? 'active alt' : 'inactive';
207
  if ( $k == 'Msg_type' ) {
208
  continue;
209
  }
@@ -233,7 +242,7 @@ if ( ! function_exists( 'bdr_page' ) ) {
233
  <tfoot>
234
  <tr>
235
  <th colspan="3">
236
- <?php printf(
237
  __( 'If all statuses are %s, then your database does not need any optimization! If any are %s, then click on the following button to optimize your Wordpress database.', 'bdr' ),
238
  sprintf( '<font color="green">%s</font>', __( 'OK', 'bdr' ) ),
239
  sprintf( '<font color="red">%s</font>', __( 'red', 'bdr' ) )
@@ -249,7 +258,7 @@ if ( ! function_exists( 'bdr_page' ) ) {
249
  <input name="submit" type="submit" class="button-primary" value="<?php _e( 'Optimize Wordpress Database', 'bdr' ); ?>" />
250
  </form>
251
  <?php break;
252
- }
253
  } else { ?>
254
  <form class="bdr_form" method="post" action="options-general.php?page=better-delete-revision.php">
255
  <?php wp_nonce_field( plugin_basename( __FILE__ ) ); ?>
@@ -262,20 +271,54 @@ if ( ! function_exists( 'bdr_page' ) ) {
262
  <?php _e( 'Post Revisions are a feature introduced in Wordpress 2.6. Whenever you or Wordpress saves a post or a page, a revision is automatically created and stored in your Wordpress database. Each additional revision will slowly increase the size of your database. If you save a post or page multiple times, your number of revisions will greatly increase overtime. For example, if you have 100 posts and each post has 10 revisions you could be storing up to 1,000 copies of older data!', 'bdr' ); ?>
263
  </p>
264
  <br />
265
- <p>
266
  <?php _e( 'The Better Delete Revision plugin is your #1 choice to quickly and easily removing revision from your Wordpress database. Try it out today to see what a lighter and smaller Wordpress database can do for you!', 'bdr' ); ?>
267
  </p>
268
  <br />
269
  <p>
270
  <?php _e( 'Thank you for using this plugin! I hope you enjoy it!', 'bdr' ); ?>
271
  </p>
272
- <br />
273
  <p><?php _e( 'Author:', 'bdr' ); ?> <a href="http://www.1e2.it" target="_blank">http://www.1e2.it</a></p>
274
  </div>
275
  </div><!-- .wrap -->
276
  <?php }
277
  }
278
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
279
  /*
280
  * Adds Settings link to the plugins page
281
  */
14
  best things you can do to your Wordpress blog to keep it running as fast as it
15
  can.
16
  Author: Galerio & Urda, BestWebLayout
17
+ Version: 1.5
18
  Author URI: http://www.1e2.it/
19
+ License: GPLv3 or later
20
  */
21
 
22
  /*
92
 
93
  $bdr_plugin_info = get_plugin_data( __FILE__ );
94
  $bdr_version = $bdr_plugin_info['Version'];
95
+ $bdr_posts = count(
96
+ $wpdb->get_results(
97
+ "SELECT ID
98
+ FROM ($wpdb->posts)
99
  WHERE `post_type` = 'post'"
100
+ )
101
  ); ?>
102
  <div class="wrap">
103
  <h2><?php _e( 'Better Delete Revision Manager', 'bdr' ); ?> <font size=1><?php echo $bdr_version; ?></font></h2>
106
  <p><?php _e( 'Since you started using Better Delete Revision', 'bdr' ); ?>, <span id="bdr_revs_no"><?php echo $bdr_rev_no; ?></span> <?php _e( 'redundant post revisions have been removed!', 'bdr' ); ?></p>
107
  </div><!-- .widget -->
108
  <?php if ( isset( $_POST['bdr_get_rev'] ) && check_admin_referer( plugin_basename( __FILE__ ) ) ) {
109
+ $bdr_results = $wpdb->get_results(
110
  "SELECT `ID`,`post_date`,`post_title`,`post_modified`
111
  FROM ($wpdb->posts)
112
  WHERE `post_type` = 'revision'
143
  </form>
144
  <?php } else { ?>
145
  <div class="updated bdr_no_rev">
146
+ <p>
147
+ <?php _e( 'Great! You have no revisions now!', 'bdr' ); ?>
148
+ </p>
149
  </div>
150
  <?php }
151
  } elseif ( isset( $_POST['bdr_del_act'] ) && check_admin_referer( plugin_basename( __FILE__ ) ) ) {
152
+ $bdr_ngg_fix = bdr_get_ngg_fix();
153
+ $bdr_revisions = $wpdb->get_results(
154
+ "SELECT `ID` AS revision_id
155
+ FROM ($wpdb->posts)
156
+ WHERE `post_type` = 'revision'
157
+ ORDER BY `ID` DESC"
 
 
158
  );
159
+ if ( is_array( $bdr_ngg_fix ) ) {
160
+ remove_action( $bdr_ngg_fix['tag'], array( $bdr_ngg_fix['class'], $bdr_ngg_fix['method'] ), $bdr_ngg_fix['priority'] );
161
+ }
162
+ foreach ( $bdr_revisions as $bdr_revision ) {
163
+ wp_delete_post_revision( $bdr_revision->revision_id );
164
+ }
165
+ if ( is_array( $bdr_ngg_fix ) ) {
166
+ add_action( $bdr_ngg_fix['tag'], array( $bdr_ngg_fix['class'], $bdr_ngg_fix['method'] ), $bdr_ngg_fix['priority'] );
167
+ }
168
  $bdr_del_no = $_POST['bdr_rev_no'];
169
  $bdr_rev_new = $bdr_rev_no + $bdr_del_no;
170
  update_option( 'bdr_rev_no', $bdr_rev_new ); ?>
212
  <?php foreach ( $bdr_result as $j => $o ) { ?>
213
  <tr>
214
  <?php foreach ( $o as $k => $v ) {
215
+ $bdr_tr_class = $j%2 == 1 ? 'active alt' : 'inactive';
216
  if ( $k == 'Msg_type' ) {
217
  continue;
218
  }
242
  <tfoot>
243
  <tr>
244
  <th colspan="3">
245
+ <?php printf(
246
  __( 'If all statuses are %s, then your database does not need any optimization! If any are %s, then click on the following button to optimize your Wordpress database.', 'bdr' ),
247
  sprintf( '<font color="green">%s</font>', __( 'OK', 'bdr' ) ),
248
  sprintf( '<font color="red">%s</font>', __( 'red', 'bdr' ) )
258
  <input name="submit" type="submit" class="button-primary" value="<?php _e( 'Optimize Wordpress Database', 'bdr' ); ?>" />
259
  </form>
260
  <?php break;
261
+ }
262
  } else { ?>
263
  <form class="bdr_form" method="post" action="options-general.php?page=better-delete-revision.php">
264
  <?php wp_nonce_field( plugin_basename( __FILE__ ) ); ?>
271
  <?php _e( 'Post Revisions are a feature introduced in Wordpress 2.6. Whenever you or Wordpress saves a post or a page, a revision is automatically created and stored in your Wordpress database. Each additional revision will slowly increase the size of your database. If you save a post or page multiple times, your number of revisions will greatly increase overtime. For example, if you have 100 posts and each post has 10 revisions you could be storing up to 1,000 copies of older data!', 'bdr' ); ?>
272
  </p>
273
  <br />
274
+ <p>
275
  <?php _e( 'The Better Delete Revision plugin is your #1 choice to quickly and easily removing revision from your Wordpress database. Try it out today to see what a lighter and smaller Wordpress database can do for you!', 'bdr' ); ?>
276
  </p>
277
  <br />
278
  <p>
279
  <?php _e( 'Thank you for using this plugin! I hope you enjoy it!', 'bdr' ); ?>
280
  </p>
281
+ <br />
282
  <p><?php _e( 'Author:', 'bdr' ); ?> <a href="http://www.1e2.it" target="_blank">http://www.1e2.it</a></p>
283
  </div>
284
  </div><!-- .wrap -->
285
  <?php }
286
  }
287
 
288
+ /*
289
+ * Fix for plugin NextGEN Gallery.
290
+ */
291
+ if ( ! function_exists( 'bdr_get_ngg_fix' ) ) {
292
+ function bdr_get_ngg_fix() {
293
+ global $wp_filter;
294
+ if ( ! function_exists( 'get_plugins' ) ) {
295
+ require_once ABSPATH . 'wp-admin/includes/plugin.php';
296
+ }
297
+ $bdr_is_ngg_active = is_plugin_active( 'nextgen-gallery/nggallery.php' );
298
+ $bdr_class = 'M_Attach_To_Post';
299
+ if ( $bdr_is_ngg_active && class_exists( $bdr_class ) ) {
300
+ $bdr_tag = 'after_delete_post';
301
+ $bdr_method = 'cleanup_displayed_galleries';
302
+ $bdr_filters = $wp_filter[ $bdr_tag ];
303
+ if ( ! empty( $bdr_filters ) ) {
304
+ foreach ( $bdr_filters as $bdr_priority => $bdr_filter ) {
305
+ foreach ( $bdr_filter as $bdr_identifier => $bdr_function ) {
306
+ if ( is_array( $bdr_function) AND is_a( $bdr_function['function'][0], $bdr_class ) AND $bdr_method === $bdr_function['function'][1] ) {
307
+ return array(
308
+ 'tag' => $bdr_tag,
309
+ 'class' => $bdr_function['function'][0],
310
+ 'method' => $bdr_method,
311
+ 'priority' => $bdr_priority
312
+ );
313
+ }
314
+ }
315
+ }
316
+ }
317
+ }
318
+ return false;
319
+ }
320
+ }
321
+
322
  /*
323
  * Adds Settings link to the plugins page
324
  */
changelog.txt DELETED
@@ -1,15 +0,0 @@
1
- 2014-06-17 v1.3
2
- * Update : We updated all functionality for Wordpress 3.9.1.
3
- * NEW : The Russian and Italian language file added to the plugin.
4
-
5
- 2011-01-25 v1.2 Used the Roles and Capabilities system instead of User Level
6
-
7
- 2010-10-21 v1.1
8
- English corrections
9
- Function cleanup
10
- Source code cleanup
11
- Moved various strings into functions
12
- -Urda
13
-
14
- 2010-09-25 v1.0
15
- First public ver1.0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
css/style.css CHANGED
@@ -18,8 +18,6 @@
18
  }
19
  .bdr_no_rev,
20
  .bdr_updated {
21
- margin: 0 0 20px !important;
22
- padding: 5px;
23
  line-height: 16pt;
24
  font-weight: bolder;
25
  }
18
  }
19
  .bdr_no_rev,
20
  .bdr_updated {
 
 
21
  line-height: 16pt;
22
  font-weight: bolder;
23
  }
languages/bdr-it_IT.mo CHANGED
File without changes
languages/bdr-it_IT.po CHANGED
File without changes
languages/bdr-ru_RU.mo CHANGED
File without changes
languages/bdr-ru_RU.po CHANGED
File without changes
readme.txt CHANGED
@@ -3,20 +3,36 @@ Contributors: galerio, Urda, bestweblayout
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=K72TR62V5ZDU8
4
  Tags: better delete revision, revision, delete, remove, removal, revision removal, delete revision, disable revision, no revision, revision manager, manage revision, remove revision, post revision, page revision, optimize database, database optimization, optimize, fast, light, faster, lighter, speed up, improve site performance, redundant revisions, perform optimization, delete revision from database, remove old database content, reduce database size
5
  Requires at least: 2.7
6
- Tested up to: 3.9.1
7
- Stable tag: 1.3
8
- License: GPLv2 or later
9
- License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
11
  Remove and delete old revision of posts, pages and related meta content completely then optimize Database: reduce size and optimization to speed up!
12
 
13
- == Description ==
14
 
15
- = PLEASE, DON'T USE IT UNTIL VERSION 2.0 BECAUSE IT IS AFFECTED BY A BUG THAT CAN POTENTIALLY DELETE OTHER STUFF IN SOME RARE CASES. =
 
 
 
16
 
17
- I'm sorry and I hope to get it safely works soon.
18
 
 
19
 
 
 
 
 
 
 
 
 
 
 
 
 
20
 
21
  == Installation ==
22
 
@@ -51,6 +67,12 @@ No. The revision posts is redundancy, is not the same that the normal posts. For
51
 
52
  == Changelog ==
53
 
 
 
 
 
 
 
54
  = V1.3 - 17.06.2014 =
55
  * Update : We updated all functionality for Wordpress 3.9.1.
56
  * NEW : The Russian and Italian language files are added to the plugin.
@@ -70,6 +92,12 @@ No. The revision posts is redundancy, is not the same that the normal posts. For
70
 
71
  == Upgrade Notice ==
72
 
 
 
 
 
 
 
73
  = V1.3 =
74
  We updated all functionality for Wordpress 3.9.1. The Russian and Italian language file are added to the plugin.
75
 
@@ -80,4 +108,4 @@ Used the Role and Capabilities system instead of User Level.
80
  English corrections. Function cleanup. Source code cleanup. Moved various strings into functions.
81
 
82
  = V1.0 =
83
- Just completed test on Wordpress 3.0.1
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=K72TR62V5ZDU8
4
  Tags: better delete revision, revision, delete, remove, removal, revision removal, delete revision, disable revision, no revision, revision manager, manage revision, remove revision, post revision, page revision, optimize database, database optimization, optimize, fast, light, faster, lighter, speed up, improve site performance, redundant revisions, perform optimization, delete revision from database, remove old database content, reduce database size
5
  Requires at least: 2.7
6
+ Tested up to: 4.0
7
+ Stable tag: 1.5
8
+ License: GPLv3 or later
9
+ License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
11
  Remove and delete old revision of posts, pages and related meta content completely then optimize Database: reduce size and optimization to speed up!
12
 
13
+ == Description ==
14
 
15
+ Better Delete Revision not only deletes redundant revisions of posts from your Wordpress Database, it also deletes other database content related to each revision such meta information, tags, relationships, and more.
16
+ Better Delete Revision is based on the old "Delete Revision" plugin but it is compatible with the latest version of Wordpress (3.x) with improved features.
17
+ = Your current published, scheduled, and draft posts are never touched by this plugin! =
18
+ This plugin can also perform optimizations on your Wordpress database. With optimization and old revision removal this plugin will keep your database lighter and smaller throughout use. Removing old revisions and database optimizations is one of the best things you can do to your Wordpress blog to keep it running as fast as it can.
19
 
20
+ Please pay ATTENTION, if you use the NextGEN Gallery plugin, some problems may occur when deleting revisions of posts or pages that contain the shortcode of the NextGEN Gallery plugin. So if you also use the NextGEN Gallery plugin we recommend you to make a backup before using the Better Delete Revision.
21
 
22
+ Wordpress MU or customs installation (like some pre-made installation of some Hosting Providers) are not yet supported. Wordpress MU support is in our TODO list.
23
 
24
+ Post Revisions are a feature introduced in Wordpress 2.6. Whenever you or Wordpress saves a post or a page, it automatically creates a revision and stores in your Wordpress database. Each additional revision will slowly increase the size of your database. If you save a post or page multiple times, your number of revisions will greatly increase overtime. For example, if you have 100 posts and each post has 10 revisions you could be storing up to 1,000 copies of older data! The Better Delete Revision plugin is your #1 choice to quickly and easily removing revision from your Wordpress database. Try it out today to see what a lighter and smaller Wordpress database can do for you!
25
+
26
+ Home Page: http://www.1e2.it/tag/better-delete-revision on www.1e2.it
27
+
28
+ = Remember to VOTE IT !!! Thanks =
29
+
30
+ Thanks goes to Urda for version 1.1
31
+
32
+ = Translation =
33
+
34
+ * Russian (ru_RU)
35
+ * Italian (it_IT)
36
 
37
  == Installation ==
38
 
67
 
68
  == Changelog ==
69
 
70
+ = V1.5 - 17.09.2014 =
71
+ * Update : We've added a fix for compatibility with the plugin NextGen Gallery.
72
+
73
+ = V1.4 - 18.07.2014 =
74
+ * Update : We updated function of plugin for deleting revisions.
75
+
76
  = V1.3 - 17.06.2014 =
77
  * Update : We updated all functionality for Wordpress 3.9.1.
78
  * NEW : The Russian and Italian language files are added to the plugin.
92
 
93
  == Upgrade Notice ==
94
 
95
+ = V1.5 =
96
+ We've added a fix for compatibility with the plugin NextGen Gallery.
97
+
98
+ = V1.4 =
99
+ We updated function of plugin for deleting revisions.
100
+
101
  = V1.3 =
102
  We updated all functionality for Wordpress 3.9.1. The Russian and Italian language file are added to the plugin.
103
 
108
  English corrections. Function cleanup. Source code cleanup. Moved various strings into functions.
109
 
110
  = V1.0 =
111
+ Just completed test on Wordpress 3.0.1
screenshot-1.png CHANGED
Binary file
screenshot-2.png CHANGED
Binary file