Version Description
- 2010-10-21 v1.1
- English corrections
- Function cleanup
- Source code cleanup
- Moved various strings into functions *
Download this release
Release Info
Developer | galerio |
Plugin | Better Delete Revision |
Version | 1.1 |
Comparing to | |
See all releases |
Code changes from version 1.0 to 1.1
- better-delete-revision.php +175 -97
- changelog.txt +9 -2
- misc-docs/sql-queries.txt +55 -0
- misc-docs/various-writings.txt +23 -0
- php/functions.php +51 -0
- readme.txt +40 -21
- todo.txt +16 -0
better-delete-revision.php
CHANGED
@@ -1,13 +1,25 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
Plugin Name: Better Delete Revision
|
|
|
4 |
Plugin URI: http://www.1e2.it/tag/better-delete-revision
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
Author URI: http://www.1e2.it
|
12 |
|
13 |
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
|
@@ -23,58 +35,100 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
23 |
/*
|
24 |
Changelog
|
25 |
|
|
|
|
|
|
|
26 |
2010-09-25 v1.0
|
27 |
First public ver1.0
|
28 |
*/
|
29 |
|
30 |
-
|
31 |
-
|
32 |
-
|
|
|
|
|
|
|
|
|
|
|
33 |
|
34 |
-
|
35 |
-
|
36 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
|
38 |
-
|
39 |
-
|
40 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
}
|
42 |
-
|
43 |
|
|
|
44 |
add_action('admin_menu', 'bdelete_revision_main');
|
45 |
|
46 |
-
|
47 |
-
|
48 |
-
|
|
|
|
|
|
|
49 |
$bdel_revision_no = get_option('bdel_revision_no');
|
50 |
echo <<<EOT
|
51 |
<div class="wrap">
|
52 |
-
<h2>Better Delete Revision Manager
|
53 |
<div class="widget"><p style="margin:10px;">
|
54 |
EOT;
|
55 |
-
|
56 |
-
|
|
|
|
|
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>
|
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 |
-
|
|
|
70 |
get_my_revision();
|
71 |
-
|
72 |
}
|
73 |
-
|
74 |
-
|
75 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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');
|
@@ -84,93 +138,97 @@ EOT;
|
|
84 |
|
85 |
}
|
86 |
|
87 |
-
echo
|
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 |
-
|
|
|
|
|
|
|
|
|
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 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
|
|
|
|
|
|
|
|
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 |
-
|
|
|
|
|
139 |
echo '" /><input class="button" type="submit" name="goback" value="';
|
140 |
-
|
|
|
|
|
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
|
146 |
echo "</div></div>";}
|
147 |
}
|
148 |
|
149 |
-
|
|
|
|
|
|
|
|
|
150 |
global $wpdb;
|
151 |
|
152 |
-
$sql = "DELETE a,b,c
|
|
|
|
|
|
|
|
|
|
|
|
|
153 |
$results = $wpdb -> get_results($sql);
|
154 |
-
|
155 |
-
|
156 |
}
|
157 |
|
158 |
-
|
|
|
|
|
|
|
|
|
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 |
-
|
166 |
-
|
167 |
-
|
|
|
|
|
168 |
}
|
169 |
|
170 |
$query = substr($query,0,strlen($query)-1);
|
171 |
$result = $wpdb -> get_results($query);
|
172 |
-
|
173 |
-
|
|
|
|
|
174 |
}
|
175 |
|
176 |
$res = "<table border=\"0\" class=\"widefat\">";
|
@@ -180,29 +238,49 @@ function maintain_mysql($operation = "CHECK"){
|
|
180 |
<th>Status</th>
|
181 |
</tr><thead>";
|
182 |
$bgcolor = $color3;
|
183 |
-
|
|
|
|
|
184 |
$res .= "<tr>";
|
185 |
-
|
|
|
|
|
186 |
$tdClass = $j%2 == 1 ? 'active alt' : 'inactive';
|
187 |
-
|
188 |
-
if($k == '
|
189 |
-
|
190 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
191 |
}
|
192 |
-
else
|
193 |
-
|
|
|
194 |
}
|
195 |
}
|
196 |
-
else
|
|
|
|
|
|
|
197 |
}
|
|
|
198 |
$res .= "</tr>";
|
199 |
}
|
200 |
-
|
|
|
|
|
|
|
|
|
|
|
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
|
|
|
205 |
return $res;
|
206 |
-
|
207 |
-
|
208 |
-
?>
|
1 |
<?php
|
2 |
/*
|
3 |
Plugin Name: Better Delete Revision
|
4 |
+
|
5 |
Plugin URI: http://www.1e2.it/tag/better-delete-revision
|
6 |
+
|
7 |
+
Description: Better Delete Revision is based on the old "Delete Revision" plugin
|
8 |
+
but it is compatible with the latest version of Wordpress (3.0.3) with improved
|
9 |
+
features. It not only deletes redundant revisions of posts from your Wordpress
|
10 |
+
Database, it also deletes other database content related to each revision such
|
11 |
+
meta information, tags, relationships, and more. Your current published,
|
12 |
+
scheduled, and draft posts are never touched by this plugin! This plugin can
|
13 |
+
also perform optimizations on your Wordpress database. With optimization and old
|
14 |
+
revision removal this plugin will keep your database lighter and smaller
|
15 |
+
throughout use. Removing old revisions and database optimizations is one of the
|
16 |
+
best things you can do to your Wordpress blog to keep it running as fast as it
|
17 |
+
can.
|
18 |
+
|
19 |
+
Version: 1.1
|
20 |
+
|
21 |
+
Author: Galerio & Urda
|
22 |
+
|
23 |
Author URI: http://www.1e2.it
|
24 |
|
25 |
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
|
35 |
/*
|
36 |
Changelog
|
37 |
|
38 |
+
2010-10-?? v1.1
|
39 |
+
Typo and English Corrections
|
40 |
+
|
41 |
2010-09-25 v1.0
|
42 |
First public ver1.0
|
43 |
*/
|
44 |
|
45 |
+
/* Check if various options exist in the current Wordpress Database */
|
46 |
+
/*
|
47 |
+
* Option to track total revisions removed from the system.
|
48 |
+
*/
|
49 |
+
if(!get_option('bdel_revision_no'))
|
50 |
+
{
|
51 |
+
update_option("bdel_revision_no",0);
|
52 |
+
}
|
53 |
|
54 |
+
/*
|
55 |
+
* Local, translations, this appears to not be used
|
56 |
+
* at all throughout the plugin at this time.
|
57 |
+
*/
|
58 |
+
$dr_locale = get_locale();
|
59 |
+
$dr_mofile = dirname(__FILE__) . "/better-delete-revision-$dr_locale.mo";
|
60 |
+
load_textdomain('better-delete-revision', $dr_mofile);
|
61 |
+
|
62 |
+
/*
|
63 |
+
* Load required plugin files.
|
64 |
+
*/
|
65 |
+
require_once( 'php/functions.php' );
|
66 |
|
67 |
+
/*
|
68 |
+
* add_options_page( $page_title, $menu_title, $capability,
|
69 |
+
* $menu_slug, $function);
|
70 |
+
*/
|
71 |
+
function bdelete_revision_main()
|
72 |
+
{
|
73 |
+
if(function_exists('add_options_page'))
|
74 |
+
{
|
75 |
+
add_options_page('Better Delete Revision',
|
76 |
+
'Better Delete Revision',
|
77 |
+
8,
|
78 |
+
basename(__FILE__),
|
79 |
+
'my_options_bdelete_revision');
|
80 |
}
|
81 |
+
}
|
82 |
|
83 |
+
/* Add the above action to the Wordpress Admin Menu */
|
84 |
add_action('admin_menu', 'bdelete_revision_main');
|
85 |
|
86 |
+
/*
|
87 |
+
*
|
88 |
+
*/
|
89 |
+
function my_options_bdelete_revision()
|
90 |
+
{
|
91 |
+
$bdr_version = get_bdr_version();
|
92 |
$bdel_revision_no = get_option('bdel_revision_no');
|
93 |
echo <<<EOT
|
94 |
<div class="wrap">
|
95 |
+
<h2>Better Delete Revision Manager <font size=1>Version $bdr_version</font></h2>
|
96 |
<div class="widget"><p style="margin:10px;">
|
97 |
EOT;
|
98 |
+
|
99 |
+
echo get_count_notice();
|
100 |
+
|
101 |
+
echo '</p></div>';
|
102 |
|
103 |
+
if (isset($_POST['del_act']))
|
104 |
+
{
|
105 |
bdelete_revision_act();
|
106 |
$del_no = $_POST['rev_no'];
|
107 |
update_option("bdel_revision_no",get_option("bdel_revision_no") + $del_no);
|
108 |
echo '<div class="updated" style="margin-top:50px;"><p><strong>';
|
109 |
+
printf(__("Deleted <span style='color:red;font-weight:bolder;'> %s </span> revisions!",'bdelete-revision'),$del_no);
|
110 |
echo "</strong></p></div></div><script>
|
111 |
var del_no = document.getElementById('revs_no').innerHTML;
|
112 |
document.getElementById('revs_no').innerHTML = Number(del_no)+ $del_no;
|
113 |
</script>";
|
114 |
}
|
115 |
+
else if (isset($_POST['get_rev']))
|
116 |
+
{
|
117 |
get_my_revision();
|
|
|
118 |
}
|
119 |
+
else if (isset($_POST['maintain_mysql']))
|
120 |
+
{
|
121 |
+
if ($_POST['operation'] == 'OPTIMIZE' )
|
122 |
+
{
|
123 |
+
echo maintain_mysql('OPTIMIZE');
|
124 |
+
}
|
125 |
+
else
|
126 |
+
{
|
127 |
+
echo maintain_mysql('CHECK');
|
128 |
+
}
|
129 |
}
|
130 |
+
else
|
131 |
+
{
|
132 |
echo '<form method="post" action="">';
|
133 |
echo '<input class="button" type="submit" name="get_rev" value="';
|
134 |
_e('Check Revision Posts','bdelete-revision');
|
138 |
|
139 |
}
|
140 |
|
141 |
+
echo get_bdr_footer();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
142 |
}
|
143 |
|
144 |
+
/*
|
145 |
+
*
|
146 |
+
*/
|
147 |
+
function get_my_revision()
|
148 |
+
{
|
149 |
global $wpdb;
|
150 |
|
151 |
$sql = "SELECT `ID`,`post_date`,`post_title`,`post_modified`
|
152 |
+
FROM ($wpdb->posts)
|
|
|
|
|
153 |
WHERE `post_type` = 'revision'
|
154 |
ORDER BY `ID` DESC";
|
155 |
$results = $wpdb -> get_results($sql);
|
156 |
+
if($results)
|
157 |
+
{
|
158 |
+
$res_no = count($results);
|
159 |
+
echo "<table class='widefat'><thead>";
|
160 |
+
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>";
|
161 |
+
|
162 |
+
for($i = 0 ; $i < $res_no ; $i++)
|
163 |
+
{
|
164 |
+
echo "<tr><td>".$results[$i] -> ID."</td>";
|
165 |
+
echo "<td>".$results[$i] -> post_title."</td>";
|
166 |
+
echo "<td>".$results[$i] -> post_date."</td>";
|
167 |
+
echo "<td>".$results[$i] -> post_modified."</td></tr>";
|
168 |
+
}
|
169 |
+
|
170 |
+
echo "</table><br />";
|
171 |
+
echo "Would you like to remove the revision posts ? <br />";
|
172 |
+
echo <<<EOT
|
173 |
<form method="post" action="">
|
174 |
<input type="hidden" name="rev_no" value=" $res_no " />
|
175 |
EOT;
|
176 |
echo '<input class="button-primary" type="submit" name="del_act" value="';
|
177 |
+
|
178 |
+
printf(__('Yes , I would like to delete them! (A Total Of %s)','bdelete-revision'),$res_no);
|
179 |
+
|
180 |
echo '" /><input class="button" type="submit" name="goback" value="';
|
181 |
+
|
182 |
+
_e('No , I prefer to keep them!','bdelete-revision');
|
183 |
+
|
184 |
echo '" /></form></div>';
|
|
|
185 |
}
|
186 |
else {echo "<div class=\"updated\" style=\"margin:50px 0;padding:6px;line-height:16pt;font-weight:bolder;\">";
|
187 |
+
_e('Great! You have no revisions now!','bdelete-revision');
|
188 |
echo "</div></div>";}
|
189 |
}
|
190 |
|
191 |
+
/*
|
192 |
+
*
|
193 |
+
*/
|
194 |
+
function bdelete_revision_act()
|
195 |
+
{
|
196 |
global $wpdb;
|
197 |
|
198 |
+
$sql = "DELETE a,b,c
|
199 |
+
FROM $wpdb->posts a
|
200 |
+
LEFT JOIN $wpdb->term_relationships b
|
201 |
+
ON (a.ID = b.object_id)
|
202 |
+
LEFT JOIN $wpdb->postmeta c
|
203 |
+
ON (a.ID = c.post_id)
|
204 |
+
WHERE a.post_type = 'revision'";
|
205 |
$results = $wpdb -> get_results($sql);
|
|
|
|
|
206 |
}
|
207 |
|
208 |
+
/*
|
209 |
+
*
|
210 |
+
*/
|
211 |
+
function maintain_mysql($operation = "CHECK")
|
212 |
+
{
|
213 |
global $wpdb;
|
214 |
|
215 |
$Tables = $wpdb -> get_results('SHOW TABLES IN '.DB_NAME);
|
216 |
$query = "$operation TABLE ";
|
217 |
|
218 |
$Tables_in_DB_NAME = 'Tables_in_'.DB_NAME;
|
219 |
+
|
220 |
+
foreach($Tables as $k=>$v)
|
221 |
+
{
|
222 |
+
$_tabName = $v -> $Tables_in_DB_NAME ;
|
223 |
+
$query .= " `$_tabName`,";
|
224 |
}
|
225 |
|
226 |
$query = substr($query,0,strlen($query)-1);
|
227 |
$result = $wpdb -> get_results($query);
|
228 |
+
|
229 |
+
if ($operation == "OPTIMIZE")
|
230 |
+
{
|
231 |
+
return '<h3>'.__('Optimization of database completed!','bdelete-revision').'</h3>';
|
232 |
}
|
233 |
|
234 |
$res = "<table border=\"0\" class=\"widefat\">";
|
238 |
<th>Status</th>
|
239 |
</tr><thead>";
|
240 |
$bgcolor = $color3;
|
241 |
+
|
242 |
+
foreach($result as $j=>$o)
|
243 |
+
{
|
244 |
$res .= "<tr>";
|
245 |
+
|
246 |
+
foreach ($o as $k=>$v)
|
247 |
+
{
|
248 |
$tdClass = $j%2 == 1 ? 'active alt' : 'inactive';
|
249 |
+
|
250 |
+
if($k == 'Msg_type')
|
251 |
+
{
|
252 |
+
continue;
|
253 |
+
}
|
254 |
+
|
255 |
+
if($k == 'Msg_text' )
|
256 |
+
{
|
257 |
+
if ($v == 'OK')
|
258 |
+
{
|
259 |
+
$res .= "<td class='$tdClass' ><font color='green'><b>$v</b></font></td>";
|
260 |
}
|
261 |
+
else
|
262 |
+
{
|
263 |
+
$res .= "<td class='$tdClass' ><font color='red'><b>$v</b></font></td>";
|
264 |
}
|
265 |
}
|
266 |
+
else
|
267 |
+
{
|
268 |
+
$res .= "<td class='$tdClass' >$v</td>";
|
269 |
+
}
|
270 |
}
|
271 |
+
|
272 |
$res .= "</tr>";
|
273 |
}
|
274 |
+
|
275 |
+
$res .= "<tfoot><tr><th colspan=3>";
|
276 |
+
$res .= "If all statuses are <font color='green'>OK</font>, then your database does not need any optimization! ";
|
277 |
+
$res .= "If any are <font color='red'>red</font>, then click on the following button to optimize your Wordpress database.";
|
278 |
+
$res .= "</th></tr></tfoot></table>";
|
279 |
+
|
280 |
$res .= "<br /><form method='post' action=''>
|
281 |
<input name='operation' type='hidden' value='OPTIMIZE' />
|
282 |
<input name='maintain_mysql' type='hidden' value='OPTIMIZE' />
|
283 |
+
<input name='submit' type='submit' class='button-primary' value='".__('Optimize Wordpress Database','bdelete-revision')."' /></form>";
|
284 |
+
|
285 |
return $res;
|
286 |
+
}
|
|
|
|
changelog.txt
CHANGED
@@ -1,2 +1,9 @@
|
|
1 |
-
2010-
|
2 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
2010-10-21 v1.1
|
2 |
+
English corrections
|
3 |
+
Function cleanup
|
4 |
+
Source code cleanup
|
5 |
+
Moved various strings into functions
|
6 |
+
-Urda
|
7 |
+
|
8 |
+
2010-09-25 v1.0
|
9 |
+
First public ver1.0
|
misc-docs/sql-queries.txt
ADDED
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
SQL NOTES
|
2 |
+
--------------------------------------------------------------------------------
|
3 |
+
|
4 |
+
function get_my_posts()
|
5 |
+
LINE ~136
|
6 |
+
|
7 |
+
"SELECT ID
|
8 |
+
FROM ($wpdb->posts)
|
9 |
+
WHERE `post_type` = 'post'";
|
10 |
+
|
11 |
+
Translates to literal SQL Query:
|
12 |
+
|
13 |
+
SELECT ID
|
14 |
+
FROM DBPREFIX_wp_posts
|
15 |
+
WHERE `post_type` = 'post'
|
16 |
+
|
17 |
+
--------------------------------------------------------------------------------
|
18 |
+
|
19 |
+
function get_my_revision()
|
20 |
+
LINE ~147
|
21 |
+
|
22 |
+
"SELECT `ID`,`post_date`,`post_title`,`post_modified`
|
23 |
+
FROM ($wpdb->posts)
|
24 |
+
WHERE `post_type` = 'revision'
|
25 |
+
ORDER BY `ID` DESC";
|
26 |
+
|
27 |
+
Translates to literal SQL Query:
|
28 |
+
|
29 |
+
SELECT `ID` , `post_date` , `post_title` , `post_modified`
|
30 |
+
FROM DBPREFIX_wp_posts
|
31 |
+
WHERE `post_type` = 'revision'
|
32 |
+
ORDER BY `ID` DESC ;
|
33 |
+
|
34 |
+
--------------------------------------------------------------------------------
|
35 |
+
|
36 |
+
function bdelete_revision_act()
|
37 |
+
LINE ~191
|
38 |
+
|
39 |
+
"DELETE a,b,c
|
40 |
+
FROM $wpdb->posts a
|
41 |
+
LEFT JOIN $wpdb->term_relationships b
|
42 |
+
ON (a.ID = b.object_id)
|
43 |
+
LEFT JOIN $wpdb->postmeta c
|
44 |
+
ON (a.ID = c.post_id)
|
45 |
+
WHERE a.post_type = 'revision'";
|
46 |
+
|
47 |
+
Translates to *NON-DELETE* literal SQL Query:
|
48 |
+
|
49 |
+
SELECT *
|
50 |
+
FROM DBPREFIX_wp_posts a
|
51 |
+
LEFT JOIN DBPREFIX_wp_term_relationships b ON ( a.ID = b.object_id )
|
52 |
+
LEFT JOIN DBPREFIX_wp_postmeta c ON ( a.ID = c.post_id )
|
53 |
+
WHERE a.post_type = 'revision';
|
54 |
+
|
55 |
+
--------------------------------------------------------------------------------
|
misc-docs/various-writings.txt
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Description:
|
2 |
+
|
3 |
+
Better Delete Revision is based on the old "Delete Revision" plugin
|
4 |
+
but it is compatible with the latest version of Wordpress (3.0.1) with improved
|
5 |
+
features. It not only deletes redundant revisions of posts from your Wordpress
|
6 |
+
Database, it also deletes other database content related to each revision such
|
7 |
+
meta information, tags, relationships, and more. Your current published,
|
8 |
+
scheduled, and draft posts are never touched by this plugin! This plugin can
|
9 |
+
also perform optimizations on your Wordpress database. With optimization and old
|
10 |
+
revision removal this plugin will keep your database lighter and smaller
|
11 |
+
throughout use. Removing old revisions and database optimizations is one of the
|
12 |
+
best things you can do to your Wordpress blog to keep it running as fast as it
|
13 |
+
can.
|
14 |
+
|
15 |
+
Post Revisions are a feature introduced in Wordpress 2.6. Whenever you or
|
16 |
+
Wordpress saves a post or a page, a revision is automatically created and stored
|
17 |
+
in your Wordpress database. Each additional revision will slowly increase the
|
18 |
+
size of your database. If you save a post or page multiple times, your number of
|
19 |
+
revisions will greatly increase overtime. For example, if you have 100 posts and
|
20 |
+
each post has 10 revisions you could be storing up to 1,000 copies of older
|
21 |
+
data! The Better Delete Revision plugin is your #1 choice to quickly and easily
|
22 |
+
removing revision from your Wordpress database. Try it out today to see what a
|
23 |
+
lighter and smaller Wordpress database can do for you!
|
php/functions.php
ADDED
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
function get_count_notice()
|
4 |
+
{
|
5 |
+
return "You have <span style='color:red;font-weight:bolder;'>" .
|
6 |
+
" " . get_my_posts() . " " .
|
7 |
+
"</span> posts." .
|
8 |
+
"<br />" .
|
9 |
+
"Since you started using Better Delete Revision, " .
|
10 |
+
"<span id='revs_no' style='color:red;font-weight:bolder;'>" .
|
11 |
+
" " . get_option('bdel_revision_no') . " " .
|
12 |
+
"</span> redundant post revisions have been removed!";
|
13 |
+
}
|
14 |
+
|
15 |
+
function get_bdr_footer()
|
16 |
+
{
|
17 |
+
$returnString = "";
|
18 |
+
$returnString .= '<br /><div class="widget"><div style="margin:12px; line-height: 1.5em">';
|
19 |
+
$returnString .= 'Post Revisions are a feature introduced in Wordpress 2.6. ';
|
20 |
+
$returnString .= 'Whenever you or Wordpress saves a post or a page, a ';
|
21 |
+
$returnString .= 'revision is automatically created and stored in your ';
|
22 |
+
$returnString .= 'Wordpress database. Each additional revision will slowly ';
|
23 |
+
$returnString .= 'increase the size of your database. If you save a post or ';
|
24 |
+
$returnString .= 'page multiple times, your number of revisions will greatly ';
|
25 |
+
$returnString .= 'increase overtime. For example, if you have 100 posts and ';
|
26 |
+
$returnString .= 'each post has 10 revisions you could be storing up to ';
|
27 |
+
$returnString .= '1,000 copies of older data!<br /><br />';
|
28 |
+
$returnString .= 'The Better Delete Revision ';
|
29 |
+
$returnString .= 'plugin is your #1 choice to quickly and easily removing ';
|
30 |
+
$returnString .= 'revision from your Wordpress database. Try it out today to ';
|
31 |
+
$returnString .= 'see what a lighter and smaller Wordpress database can do for you!<br /><br />';
|
32 |
+
$returnString .= 'Thank you for using this plugin! I hope you enjoy it!<br /><br />';
|
33 |
+
$returnString .= 'Author: ';
|
34 |
+
$returnString .= '<A href="http://www.1e2.it" target="_blank">http://www.1e2.it</a></div></div>';
|
35 |
+
|
36 |
+
return $returnString;
|
37 |
+
}
|
38 |
+
function get_bdr_version()
|
39 |
+
{
|
40 |
+
return '1.1';
|
41 |
+
}
|
42 |
+
|
43 |
+
function get_my_posts()
|
44 |
+
{
|
45 |
+
global $wpdb;
|
46 |
+
$sql = "SELECT ID
|
47 |
+
FROM ($wpdb->posts)
|
48 |
+
WHERE `post_type` = 'post'";
|
49 |
+
$results = $wpdb -> get_results($sql);
|
50 |
+
return count($results);
|
51 |
+
}
|
readme.txt
CHANGED
@@ -1,31 +1,28 @@
|
|
1 |
=== Plugin Name ===
|
2 |
-
Contributors: Galerio
|
3 |
-
Donate link: http://www.1e2.it/
|
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.
|
7 |
-
Stable tag: 1.
|
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
|
|
|
|
|
|
|
14 |
|
15 |
-
|
16 |
|
17 |
-
|
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.
|
@@ -34,6 +31,10 @@ This section describes how to install the plugin and get it working.
|
|
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? =
|
@@ -55,10 +56,28 @@ No. The revision posts is redundancy, is not same to the normal posts. For this
|
|
55 |
|
56 |
|
57 |
== Changelog ==
|
58 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
= 1.0 =
|
60 |
-
* Just
|
61 |
-
|
62 |
-
==
|
63 |
-
|
64 |
-
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
=== Plugin Name ===
|
2 |
+
Contributors: Galerio, Urda
|
3 |
+
Donate link: http://www.1e2.it/donazione
|
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.3
|
7 |
+
Stable tag: 1.1
|
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 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.
|
14 |
+
Better Delete Revision is based on the old "Delete Revision" plugin but it is compatible with the latest version of Wordpress (3.0.3) with improved features.
|
15 |
+
= Your current published, scheduled, and draft posts are never touched by this plugin! =
|
16 |
+
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.
|
17 |
|
18 |
+
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! 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!
|
19 |
|
20 |
+
Home Page: http://www.1e2.it/tag/better-delete-revision on www.1e2.it
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
|
22 |
= Remember to VOTE IT !!! Thanks =
|
23 |
|
24 |
+
Thanks goes to Urda for version 1.1
|
25 |
+
|
26 |
== Installation ==
|
27 |
|
28 |
This section describes how to install the plugin and get it working.
|
31 |
2. Unzip the better-delete-revision.zip to the '/wp-content/plugins/better-delete-revision/' directory
|
32 |
3. Activate the plugin through the 'Plugins' menu in WordPress
|
33 |
|
34 |
+
= Upgrade Notice =
|
35 |
+
|
36 |
+
Just copy the new files over the old ones or use the automatic upgrade function of your Wordpress.
|
37 |
+
|
38 |
== Frequently Asked Questions ==
|
39 |
|
40 |
= What does it have more than Delete Revision or Revision Removal or other similar plugin? =
|
56 |
|
57 |
|
58 |
== Changelog ==
|
59 |
+
= 1.1 =
|
60 |
+
* 2010-10-21 v1.1
|
61 |
+
* English corrections
|
62 |
+
* Function cleanup
|
63 |
+
* Source code cleanup
|
64 |
+
* Moved various strings into functions
|
65 |
+
* = by Urda =
|
66 |
+
|
67 |
= 1.0 =
|
68 |
+
* Just completed test on wordpress 3.0.1
|
69 |
+
|
70 |
+
== Todo ==
|
71 |
+
|
72 |
+
- General
|
73 |
+
* Clean up code to fit within an 80-character margin limit. Not only doe this assit with various code editors, it forces the programmer to keep the code clean and effecient!
|
74 |
+
* Move strings into a constant file, for easier updating and tracking.
|
75 |
+
* Create a CSS file in charge of handling styles for look and feel.
|
76 |
+
|
77 |
+
- Internationalization
|
78 |
+
* Needs to be done correctly, some code is using 'echo', other code is using the _e() calls from Wordpress. Either Internationalization needs to be implemented, or yank it all together for the time being.
|
79 |
+
|
80 |
+
- SQL Related
|
81 |
+
* Add sometime of documentation explaining each and every SQL query
|
82 |
+
* Possibly Move SQL queries into abstracted file?
|
83 |
+
* Clean up SQL (ID vs `ID`)
|
todo.txt
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
- General
|
2 |
+
* Clean up code to fit within an 80-character margin limit. Not only doe
|
3 |
+
this assit with various code editors, it forces the programmer to keep the
|
4 |
+
code clean and effecient!
|
5 |
+
* Move strings into a constant file, for easier updating and tracking.
|
6 |
+
* Create a CSS file in charge of handling styles for look and feel.
|
7 |
+
|
8 |
+
- Internationalization
|
9 |
+
* Needs to be done correctly, some code is using 'echo', other code is using
|
10 |
+
the _e() calls from Wordpress. Either Internationalization needs to be
|
11 |
+
implemented, or yank it all together for the time being.
|
12 |
+
|
13 |
+
- SQL Related
|
14 |
+
* Add sometime of documentation explaining each and every SQL query
|
15 |
+
* Possibly Move SQL queries into abstracted file?
|
16 |
+
* Clean up SQL (ID vs `ID`)
|