Better Delete Revision - Version 1.0

Version Description

  • Just complete tested on wordpress 3.0.1

=

Download this release

Release Info

Developer galerio
Plugin Icon 128x128 Better Delete Revision
Version 1.0
Comparing to
See all releases

Version 1.0

better-delete-revision.php ADDED
@@ -0,0 +1,208 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Plugin Name: Better Delete Revision
4
+ Plugin URI: http://www.1e2.it/tag/better-delete-revision
5
+ Description: Better Delete Revision is based on the old "Delete Revision" plugin but it is compatible with latest Wordpress 3.0.1 and has implemented better new features (it is also better then Revision Removal plugin).
6
+ It does not only delete old redundant revisions of post from Database,it also delete every other content related to the revision, like post meta, tags, relationship and so on. Your current published post will never be touched! Your database will be optimized and all waste will be trashed ! In this way, your database will be lighter and small. This is the better optimization of your database you can do to speed up and make faster your Wordpress.
7
+ Revision Post is the new features of WordPress ver 2.6 and above. Every time you made a change to your post or page, it will automatic save add a revision, just like a draft. As many as you made change, the more revision you will have in your database. It will not only increase your database size, but also increase your load time as the server need more time to access the database. If you modify many times, it will be a very frightening number! If you have 100 published posts, your revisiong may be as many as 1,000 articles!
8
+ Better Delete Revision manager is your choice to remove all the revisions quickly to help you to increase the speed of implementation of the SQL statement, and increase the speed of your server load.
9
+ Author: Galerio
10
+ Version: 1.0
11
+ Author URI: http://www.1e2.it
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
14
+ KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
15
+ WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
16
+ PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
17
+ OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
18
+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
19
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
20
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
+ */
22
+
23
+ /*
24
+ Changelog
25
+
26
+ 2010-09-25 v1.0
27
+ First public ver1.0
28
+ */
29
+
30
+ if(!get_option('bdel_revision_no')) {update_option("bdel_revision_no",0);}
31
+ if(!get_option('bdel_revision_getPosts')) {update_option("bdel_revision_getPosts",0);}
32
+
33
+
34
+ $dr_locale = get_locale();
35
+ $dr_mofile = dirname(__FILE__) . "/better-delete-revision-$dr_locale.mo";
36
+ load_textdomain('better-delete-revision', $dr_mofile);
37
+
38
+ function bdelete_revision_main() {
39
+ if (function_exists('add_options_page')) {
40
+ add_options_page('Better Delete Revision', 'Better Delete Revision',8, basename(__FILE__), 'my_options_bdelete_revision');
41
+ }
42
+ }
43
+
44
+ add_action('admin_menu', 'bdelete_revision_main');
45
+
46
+ function my_options_bdelete_revision() {
47
+ $dr_ver = '1.0';
48
+ $get_my_posts = get_my_posts();
49
+ $bdel_revision_no = get_option('bdel_revision_no');
50
+ echo <<<EOT
51
+ <div class="wrap">
52
+ <h2>Better Delete Revision Manager <font size=1>ver $dr_ver</font></h2>
53
+ <div class="widget"><p style="margin:10px;">
54
+ EOT;
55
+ printf(__("Now You have <span style='color:red;font-weight:bolder;'> %s </span> posts. Up to now Better Delete Revision has removed <span id='revs_no' style='color:red;font-weight:bolder;'> %s </span> redundant post revision",'bdelete-revision'), $get_my_posts,$bdel_revision_no);
56
+ echo '</p></div>';
57
+
58
+ if (isset($_POST['del_act'])) {
59
+ bdelete_revision_act();
60
+ $del_no = $_POST['rev_no'];
61
+ update_option("bdel_revision_no",get_option("bdel_revision_no") + $del_no);
62
+ echo '<div class="updated" style="margin-top:50px;"><p><strong>';
63
+ printf(__("Deleted <span style='color:red;font-weight:bolder;'> %s </span> revision posts !",'bdelete-revision'),$del_no);
64
+ echo "</strong></p></div></div><script>
65
+ var del_no = document.getElementById('revs_no').innerHTML;
66
+ document.getElementById('revs_no').innerHTML = Number(del_no)+ $del_no;
67
+ </script>";
68
+ }
69
+ elseif (isset($_POST['get_rev'])) {
70
+ get_my_revision();
71
+
72
+ }
73
+ elseif (isset($_POST['maintain_mysql'])) {
74
+ if ($_POST['operation'] == 'OPTIMIZE' ) {echo maintain_mysql('OPTIMIZE');}
75
+ else echo maintain_mysql('CHECK');
76
+ }
77
+ else {
78
+ echo '<form method="post" action="">';
79
+ echo '<input class="button" type="submit" name="get_rev" value="';
80
+ _e('Check Revision Posts','bdelete-revision');
81
+ echo '" /> <input class="button" type="submit" name="maintain_mysql" value="';
82
+ _e('Optimize Your Database','bdelete-revision');
83
+ echo '" /></form></div>';
84
+
85
+ }
86
+
87
+ echo '<br /><div class="widget"><div style="margin:12px;line-height: 1.5em;">';
88
+ _e('Revision Post is the new features of WordPress ver 2.6 and above. Every time you made a change to your post or page, it will automatic save add a revision, just like a draft. As many as you made change, the more revision you will have in your database. It will not only increase your database size, but also increase your load time as the server need more time to access the database. If you modify many times, it will be a very frightening number!','bdelete-revision');
89
+ _e('If you have 100 published posts, your revisiong may be as many as 1,000 articles!','bdelete-revision');
90
+ echo '<br />';
91
+ _e('Better Delete Revision manager is your choice to remove all the revisions quickly to help you to increase the speed of implementation of the SQL statement, and increase the speed of your server load.','bdelete-revision');
92
+ echo '<br />';
93
+ _e('Thank you for your useing. I hope you like it!','bdelete-revision');
94
+ _e('Author','bdelete-revision');
95
+ echo ': <a href="http://www.1e2.it" target="_blank">http://www.1e2.it</a></div></div>';
96
+
97
+ }
98
+
99
+ function get_my_posts() {
100
+ global $wpdb;
101
+
102
+ $sql = "SELECT ID
103
+ FROM (
104
+ $wpdb->posts
105
+ )
106
+ WHERE `post_type` = 'post'";
107
+ $results = $wpdb -> get_results($sql);
108
+ return count($results);
109
+ }
110
+
111
+ function get_my_revision() {
112
+ global $wpdb;
113
+
114
+ $sql = "SELECT `ID`,`post_date`,`post_title`,`post_modified`
115
+ FROM (
116
+ $wpdb->posts
117
+ )
118
+ WHERE `post_type` = 'revision'
119
+ ORDER BY `ID` DESC";
120
+ $results = $wpdb -> get_results($sql);
121
+ if($results) {
122
+ $res_no = count($results);
123
+ echo "<table class='widefat'><thead>";
124
+ echo "<tr><th width=30> Id </th><th width=450> Title </th><th width=180> Post date </th><th width=180> Last modified </th></tr></thead>";
125
+ for($i = 0 ; $i < $res_no ; $i++) {
126
+ echo "<tr><td>".$results[$i] -> ID."</td>";
127
+ echo "<td>".$results[$i] -> post_title."</td>";
128
+ echo "<td>".$results[$i] -> post_date."</td>";
129
+ echo "<td>".$results[$i] -> post_modified."</td></tr>";
130
+ }
131
+ echo "</table><br />";
132
+ echo "Would you like to remove the revision posts ? <br />";
133
+ echo <<<EOT
134
+ <form method="post" action="">
135
+ <input type="hidden" name="rev_no" value=" $res_no " />
136
+ EOT;
137
+ echo '<input class="button-primary" type="submit" name="del_act" value="';
138
+ printf(__('Yes , I would like to delete them!(A Total Of %s)','bdelete-revision'),$res_no);
139
+ echo '" /><input class="button" type="submit" name="goback" value="';
140
+ _e('No , I prefer to keep it!','bdelete-revision');
141
+ echo '" /></form></div>';
142
+
143
+ }
144
+ else {echo "<div class=\"updated\" style=\"margin:50px 0;padding:6px;line-height:16pt;font-weight:bolder;\">";
145
+ _e('Great, You have no revision posts now!','bdelete-revision');
146
+ echo "</div></div>";}
147
+ }
148
+
149
+ function bdelete_revision_act() {
150
+ global $wpdb;
151
+
152
+ $sql = "DELETE a,b,c FROM $wpdb->posts a LEFT JOIN $wpdb->term_relationships b ON (a.ID = b.object_id) LEFT JOIN $wpdb->postmeta c ON (a.ID = c.post_id) WHERE a.post_type = 'revision'";
153
+ $results = $wpdb -> get_results($sql);
154
+
155
+
156
+ }
157
+
158
+ function maintain_mysql($operation = "CHECK"){
159
+ global $wpdb;
160
+
161
+ $Tables = $wpdb -> get_results('SHOW TABLES IN '.DB_NAME);
162
+ $query = "$operation TABLE ";
163
+
164
+ $Tables_in_DB_NAME = 'Tables_in_'.DB_NAME;
165
+ foreach($Tables as $k=>$v){
166
+ $_tabName = $v -> $Tables_in_DB_NAME ;
167
+ $query .= " `$_tabName`,";
168
+ }
169
+
170
+ $query = substr($query,0,strlen($query)-1);
171
+ $result = $wpdb -> get_results($query);
172
+ if ($operation == "OPTIMIZE") {
173
+ return '<h3>'.__('Optimization of database completed.','bdelete-revision').'</h3>';
174
+ }
175
+
176
+ $res = "<table border=\"0\" class=\"widefat\">";
177
+ $res .= "<thead><tr>
178
+ <th>Table</th>
179
+ <th>OP</th>
180
+ <th>Status</th>
181
+ </tr><thead>";
182
+ $bgcolor = $color3;
183
+ foreach($result as $j=>$o) {
184
+ $res .= "<tr>";
185
+ foreach ($o as $k=>$v) {
186
+ $tdClass = $j%2 == 1 ? 'active alt' : 'inactive';
187
+ if($k == 'Msg_type') continue;
188
+ if($k == 'Msg_text' ) {
189
+ if ($v == 'OK') {
190
+ $res .= "<td class='$tdClass' ><font color='green'><b>$v</b></font></td>";
191
+ }
192
+ else {
193
+ $res .= "<td class='$tdClass' ><font color='red'><b>$v</b></font></td>";
194
+ }
195
+ }
196
+ else $res .= "<td class='$tdClass' >$v</td>";
197
+ }
198
+ $res .= "</tr>";
199
+ }
200
+ $res .= "<tfoot><tr><th colspan=3>".__('If the Status is green <font color=green>OK</font>, then indicated that is normal, does not need any operation, please go back; If is red, then click on the following button to optimize.','bdelete-revision')."</th></tr></tfoot></table>";
201
+ $res .= "<br /><form method='post' action=''>
202
+ <input name='operation' type='hidden' value='OPTIMIZE' />
203
+ <input name='maintain_mysql' type='hidden' value='OPTIMIZE' />
204
+ <input name='submit' type='submit' class='button-primary' value='".__('Optimize your Database','bdelete-revision')."' /></form>";
205
+ return $res;
206
+ }
207
+
208
+ ?>
changelog.txt ADDED
@@ -0,0 +1,2 @@
 
 
1
+ 2010-09-25 v1.0
2
+ First public ver1.0
readme.txt ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === Plugin Name ===
2
+ Contributors: Galerio
3
+ Donate link: http://www.1e2.it/2009/02/altro/una-donazione-per-sostenere-1e2it.html
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
5
+ Requires at least: 2.7
6
+ Tested up to: 3.0.1
7
+ Stable tag: 1.0
8
+
9
+ Remove and delete old revision of posts, pages and related meta content completely then optimize Database: reduce size and optimization to speed up!
10
+
11
+ == Description ==
12
+
13
+ Better Delete Revision does not only delete old redundant revisions of post and page from Database, it also delete every other content related to the revision, like post meta, tags, relationship and so on and then make database optimization.
14
+
15
+ = Your current published post will never be touched! =
16
+
17
+ This plugin is very safe, you will never lost your current articles, it only removes redundant revisions.
18
+
19
+ Better Delete Revision is based on the old "Delete Revision" plugin but it is compatible with latest WordPress 3.0.1 and has implemented better new features (that neither Delete Revision or Revision Removal plugin has!!).
20
+
21
+ Your database will be optimized and all waste will be trashed! In this way, your database will be lighter and small. This is the better optimization of your database you can do to speed up and make faster your WordPress.
22
+
23
+ Revision Post is the new features of WordPress ver 2.6 and above. It is a very important feature because it saves a draft of the post while you are writing it and in this way you can always recall what you have written even if you had a blackout, a server issue or other inconvenient. For this reason it is not recommended to disable Post Revision. But every time you made a change to your post or page, it will automatic save add a revision, just like a draft. As many as you made change, the more revision you will have in your database. It will not only increase your database size, but also increase your load time as the server need more time to access the database. If you modify many times, it will be a very frightening number! If you have 100 published posts, your revisiong may be as many as 1,000 articles!
24
+
25
+ Better Delete Revision manager is your choice to remove all the revisions quickly to help you to increase the speed of the SQL statement, and increase the speed of your server load.
26
+
27
+ = Remember to VOTE IT !!! Thanks =
28
+
29
+ == Installation ==
30
+
31
+ This section describes how to install the plugin and get it working.
32
+
33
+ 1. Upload `better-delete-revision.zip` to the '/wp-content/plugins/' directory
34
+ 2. Unzip the better-delete-revision.zip to the '/wp-content/plugins/better-delete-revision/' directory
35
+ 3. Activate the plugin through the 'Plugins' menu in WordPress
36
+
37
+ == Frequently Asked Questions ==
38
+
39
+ = What does it have more than Delete Revision or Revision Removal or other similar plugin? =
40
+
41
+ It has the ability to remove completely the revision posts and pages and related meta tag, description and other things that are useless. The other plugins doesn't really remove all the waste things.
42
+
43
+ = To clean datebase is safe? =
44
+
45
+ Yes, it's very safe
46
+
47
+ = Will not affect the normal published post? =
48
+
49
+ No. The revision posts is redundancy, is not same to the normal posts. For this reason they can be safely removed to save space, increase database speed.
50
+
51
+ == Screenshots ==
52
+
53
+ 1. Revision Removal Control Panel.
54
+ 2. Database Optimization.
55
+
56
+
57
+ == Changelog ==
58
+
59
+ = 1.0 =
60
+ * Just complete tested on wordpress 3.0.1
61
+
62
+ == Upgrade Notice ==
63
+
64
+ -Coming Soon-
screenshot-1.png ADDED
Binary file
screenshot-2.png ADDED
Binary file