Version Description
No Upgrade Notice available.
Download this release
Release Info
Developer | cageehv |
Plugin | Optimize Database after Deleting Revisions |
Version | 1.2 |
Comparing to | |
See all releases |
Code changes from version 1.1.9 to 1.2
- readme.txt +6 -5
- rvg-optimize-db.php +251 -30
readme.txt
CHANGED
@@ -4,18 +4,18 @@ Contributors: Rolf van Gelder
|
|
4 |
Donate link: http://cagewebdev.com
|
5 |
Plugin Name: Optimize Database after Deleting Revisions
|
6 |
Plugin URI: http://cagewebdev.com/index.php/optimize-database-after-deleting-revisions-wordpress-plugin
|
7 |
-
Tags: wp, database, delete, revisions, optimize, posts, pages
|
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.
|
13 |
-
Version: 1.
|
14 |
|
15 |
== Description ==
|
16 |
|
17 |
-
<p>This plugin is a 'one click' database optimizer.</p>
|
18 |
-
<p>It deletes the redundant revisions of posts and pages and, after that, optimizes all database tables.</p>
|
19 |
<p>http://cagewebdev.com/index.php/optimize-database-after-deleting-revisions-wordpress-plugin</p>
|
20 |
<p>Author: Rolf van Gelder, Eindhoven, The Netherlands - http://cagewebdev.com</p>
|
21 |
|
@@ -52,6 +52,7 @@ No Screenshots available.
|
|
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 |
|
4 |
Donate link: http://cagewebdev.com
|
5 |
Plugin Name: Optimize Database after Deleting Revisions
|
6 |
Plugin URI: http://cagewebdev.com/index.php/optimize-database-after-deleting-revisions-wordpress-plugin
|
7 |
+
Tags: wp, database, delete, revisions, optimize, posts, pages, clean up, trash, spam, trashed, spammed
|
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.2
|
13 |
+
Version: 1.2
|
14 |
|
15 |
== Description ==
|
16 |
|
17 |
+
<p><b>This plugin is a 'one click' database optimizer.</b></p>
|
18 |
+
<p>It deletes the redundant revisions of posts and pages, trashed items and/or spammed items and, after that, optimizes all database tables.</p>
|
19 |
<p>http://cagewebdev.com/index.php/optimize-database-after-deleting-revisions-wordpress-plugin</p>
|
20 |
<p>Author: Rolf van Gelder, Eindhoven, The Netherlands - http://cagewebdev.com</p>
|
21 |
|
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 |
+
<p><b>1.2</b> 10/03/2012 Major update: new options 'delete trash', 'delete spam', 'only optimize WordPress tables'</p>
|
56 |
|
57 |
== Frequently Asked Questions ==
|
58 |
|
rvg-optimize-db.php
CHANGED
@@ -1,16 +1,16 @@
|
|
1 |
<?php
|
2 |
-
$version = '1.
|
3 |
-
$release_date = '
|
4 |
/**
|
5 |
* @package Optimize Database after Deleting Revisions
|
6 |
-
* @version 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 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.
|
14 |
Author URI: http://cagewebdev.com
|
15 |
*/
|
16 |
?>
|
@@ -49,30 +49,52 @@ add_action( 'admin_menu', 'rvg_odb_admin_menu' );
|
|
49 |
function rvg_odb_options_page() {
|
50 |
global $version, $release_date;
|
51 |
|
52 |
-
//
|
53 |
if ( isset( $_POST['info_update'] ) ) {
|
54 |
check_admin_referer();
|
55 |
-
|
56 |
-
// Update the Project ID
|
57 |
$rvg_odb_number = trim($_POST['rvg_odb_number']);
|
58 |
update_option('rvg_odb_number', $rvg_odb_number);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
|
60 |
-
//
|
61 |
echo "<div class='updated'><p><strong>Optimize Database after Deleting Revisions options updated</strong> - Click <a href='tools.php?page=rvg-optimize-db.php' style='font-weight:bold'>HERE</a> to run the optimization</p></div>";
|
62 |
}
|
63 |
$rvg_odb_number = get_option('rvg_odb_number');
|
64 |
if(!$rvg_odb_number) $rvg_odb_number = '0';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
65 |
|
66 |
-
//
|
67 |
?>
|
|
|
68 |
<form method="post" action="">
|
69 |
<div class="wrap">
|
70 |
<h2>Using Optimize Database after Deleting Revisions</h2>
|
71 |
<blockquote>
|
72 |
<p><strong>'<em>Optimize Database after Deleting Revisions</em>' is an one-click plugin to optimize your WordPress database.<br />
|
73 |
-
It deletes redundant revisions of posts and pages and, after that, optimizes all database tables.</strong></p>
|
74 |
-
<p>Below you can define the <u>maximum number</u> of - most recent - revisions you want to <u>keep</u> per post or page
|
75 |
-
|
|
|
76 |
<p>To start the optimization:<br />
|
77 |
In the WordPress Dashboard go to ‘<strong>Tools</strong>‘.<br />
|
78 |
Click on ‘<strong>Optimize Database</strong>‘. Et voila! </p>
|
@@ -93,15 +115,36 @@ function rvg_odb_options_page() {
|
|
93 |
<fieldset class='options'>
|
94 |
<table class="editform" cellspacing="2" cellpadding="5">
|
95 |
<tr>
|
96 |
-
<td><label for="<?php echo rvg_odb_number; ?>" style="font-weight:bold;">Maximum number of - most recent - revisions to keep per post / page<br />
|
97 |
-
|
98 |
<td><input type="text" size="5" name="rvg_odb_number" id="rvg_odb_number" value="<?php echo $rvg_odb_number?>" style="font-weight:bold;color:#00F;" /></td>
|
99 |
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
100 |
</table>
|
101 |
</fieldset>
|
102 |
</blockquote>
|
103 |
<p class="submit">
|
104 |
-
<input type='submit' name='info_update' value='
|
105 |
</p>
|
106 |
</div>
|
107 |
</form>
|
@@ -111,12 +154,12 @@ function rvg_odb_options_page() {
|
|
111 |
|
112 |
/********************************************************************************************
|
113 |
|
114 |
-
MAIN FUNCTION FOR DELETING REVISIONS AND OPTIMIZING DATABASE TABLES
|
115 |
|
116 |
*********************************************************************************************/
|
117 |
function rvg_optimize_db()
|
118 |
{
|
119 |
-
global $wpdb, $version;
|
120 |
|
121 |
/****************************************************************************************
|
122 |
|
@@ -128,11 +171,40 @@ function rvg_optimize_db()
|
|
128 |
{ $max_revisions = 0;
|
129 |
update_option('rvg_odb_number', $max_revisions);
|
130 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
131 |
?>
|
132 |
-
|
133 |
-
<h2
|
134 |
-
<p><span style="
|
135 |
-
<p><span style="
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
136 |
<?php
|
137 |
$sql = "
|
138 |
SELECT `post_parent`, `post_title`, COUNT(*) cnt
|
@@ -197,21 +269,167 @@ function rvg_optimize_db()
|
|
197 |
<td align="right" style="border-top:solid 1px #999;font-weight:bold;"><?php echo $total_deleted?></td>
|
198 |
</tr>
|
199 |
</table>
|
200 |
-
<br />
|
201 |
<?php
|
202 |
}
|
203 |
else
|
204 |
{
|
205 |
-
|
206 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
207 |
?>
|
208 |
<?php
|
209 |
/****************************************************************************************
|
210 |
|
211 |
-
|
212 |
|
213 |
******************************************************************************************/
|
214 |
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
215 |
<table border="0" cellspacing="8" cellpadding="2">
|
216 |
<tr>
|
217 |
<td colspan="3" style="font-weight:bold;color:#00F;">OPTIMIZING DATABASE TABLES:</td>
|
@@ -227,9 +445,11 @@ function rvg_optimize_db()
|
|
227 |
$cnt = 0;
|
228 |
while($row = mysql_fetch_row($names))
|
229 |
{
|
230 |
-
$
|
231 |
-
|
232 |
-
|
|
|
|
|
233 |
?>
|
234 |
<tr>
|
235 |
<td align="right"><?php echo $cnt?>.</td>
|
@@ -237,11 +457,12 @@ function rvg_optimize_db()
|
|
237 |
<td><?php echo $result[0]->Msg_text ?></td>
|
238 |
</tr>
|
239 |
<?php
|
240 |
-
|
|
|
241 |
?>
|
242 |
</table>
|
243 |
<br />
|
244 |
-
<span style="font-weight:bold;color:#00F;padding-left:
|
245 |
<?php
|
246 |
}
|
247 |
?>
|
1 |
<?php
|
2 |
+
$version = '1.2';
|
3 |
+
$release_date = '03/10/2012';
|
4 |
/**
|
5 |
* @package Optimize Database after Deleting Revisions
|
6 |
+
* @version 1.2
|
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.2
|
14 |
Author URI: http://cagewebdev.com
|
15 |
*/
|
16 |
?>
|
49 |
function rvg_odb_options_page() {
|
50 |
global $version, $release_date;
|
51 |
|
52 |
+
// SAVE THE OPTIONS
|
53 |
if ( isset( $_POST['info_update'] ) ) {
|
54 |
check_admin_referer();
|
55 |
+
|
|
|
56 |
$rvg_odb_number = trim($_POST['rvg_odb_number']);
|
57 |
update_option('rvg_odb_number', $rvg_odb_number);
|
58 |
+
|
59 |
+
$rvg_clear_trash = 'N';
|
60 |
+
if($_POST['rvg_clear_trash'] == 'Y') $rvg_clear_trash = 'Y';
|
61 |
+
update_option('rvg_clear_trash', $rvg_clear_trash);
|
62 |
+
|
63 |
+
$rvg_clear_spam = 'N';
|
64 |
+
if($_POST['rvg_clear_spam'] == 'Y') $rvg_clear_spam = 'Y';
|
65 |
+
update_option('rvg_clear_spam', $rvg_clear_spam);
|
66 |
+
|
67 |
+
$rvg_wp_only = 'N';
|
68 |
+
if($_POST['rvg_wp_only'] == 'Y') $rvg_wp_only = 'Y';
|
69 |
+
update_option('rvg_wp_only', $rvg_wp_only);
|
70 |
|
71 |
+
// UPDATED MESSAGE
|
72 |
echo "<div class='updated'><p><strong>Optimize Database after Deleting Revisions options updated</strong> - Click <a href='tools.php?page=rvg-optimize-db.php' style='font-weight:bold'>HERE</a> to run the optimization</p></div>";
|
73 |
}
|
74 |
$rvg_odb_number = get_option('rvg_odb_number');
|
75 |
if(!$rvg_odb_number) $rvg_odb_number = '0';
|
76 |
+
|
77 |
+
$rvg_clear_trash = get_option('rvg_clear_trash');
|
78 |
+
if(!$rvg_clear_trash) $rvg_clear_trash = 'N';
|
79 |
+
|
80 |
+
$rvg_clear_spam = get_option('rvg_clear_spam');
|
81 |
+
if(!$rvg_clear_spam) $rvg_clear_spam = 'N';
|
82 |
+
|
83 |
+
$rvg_wp_only = get_option('rvg_wp_only');
|
84 |
+
if(!$rvg_wp_only) $rvg_wp_only = 'N';
|
85 |
|
86 |
+
// CREATE THE OPTIONS PAGE
|
87 |
?>
|
88 |
+
|
89 |
<form method="post" action="">
|
90 |
<div class="wrap">
|
91 |
<h2>Using Optimize Database after Deleting Revisions</h2>
|
92 |
<blockquote>
|
93 |
<p><strong>'<em>Optimize Database after Deleting Revisions</em>' is an one-click plugin to optimize your WordPress database.<br />
|
94 |
+
It deletes redundant revisions of posts and pages, trashed and/or spammed items and, after that, optimizes all database tables.</strong></p>
|
95 |
+
<p>Below you can define the <u>maximum number</u> of - most recent - revisions you want to <u>keep</u> per post or page.<br />
|
96 |
+
If you set the maximum number to '<strong>0</strong>' it means <strong>ALL REVISIONS</strong> will be deleted for all posts and pages.</p>
|
97 |
+
<p>You also can choose if you want to <u>delete</u> all <u>trashed items</u> and/or <u>spammed items</u> during the optimization.</p>
|
98 |
<p>To start the optimization:<br />
|
99 |
In the WordPress Dashboard go to ‘<strong>Tools</strong>‘.<br />
|
100 |
Click on ‘<strong>Optimize Database</strong>‘. Et voila! </p>
|
115 |
<fieldset class='options'>
|
116 |
<table class="editform" cellspacing="2" cellpadding="5">
|
117 |
<tr>
|
118 |
+
<td align="right"><label for="<?php echo rvg_odb_number; ?>" style="font-weight:bold;">Maximum number of - most recent - revisions to keep per post / page<br />
|
119 |
+
('0' means: delete ALL revisions) </label></td>
|
120 |
<td><input type="text" size="5" name="rvg_odb_number" id="rvg_odb_number" value="<?php echo $rvg_odb_number?>" style="font-weight:bold;color:#00F;" /></td>
|
121 |
</tr>
|
122 |
+
<?php
|
123 |
+
if($rvg_clear_trash == 'Y') $rvg_clear_trash_checked = ' checked="checked"'; else $rvg_clear_trash_checked = '';
|
124 |
+
if($rvg_clear_spam == 'Y') $rvg_clear_spam_checked = ' checked="checked"'; else $rvg_clear_spam_checked = '';
|
125 |
+
if($rvg_wp_only == 'Y') $rvg_wp_only_checked = ' checked="checked"'; else $rvg_wp_only_checked = '';
|
126 |
+
?>
|
127 |
+
<tr>
|
128 |
+
<td align="right"><label for="rvg_clear_trash" style="font-weight:bold;">Delete all trashed items<br />
|
129 |
+
</label></td>
|
130 |
+
<td><input name="rvg_clear_trash" type="checkbox" value="Y" <?php echo $rvg_clear_trash_checked?> /></td>
|
131 |
+
</tr>
|
132 |
+
<tr>
|
133 |
+
<td align="right"><label for="rvg_clear_spam" style="font-weight:bold;">Delete all spammed items<br />
|
134 |
+
</label></td>
|
135 |
+
<td><input name="rvg_clear_spam" type="checkbox" value="Y" <?php echo $rvg_clear_spam_checked?> /></td>
|
136 |
+
</tr>
|
137 |
+
<tr>
|
138 |
+
<td align="right"><label for="rvg_wp_only" style="font-weight:bold;">Only optimize WordPress tables<br />
|
139 |
+
(if not checked ALL tables in the database will be optimized)<br />
|
140 |
+
</label></td>
|
141 |
+
<td><input name="rvg_wp_only" type="checkbox" value="Y" <?php echo $rvg_wp_only_checked?> /></td>
|
142 |
+
</tr>
|
143 |
</table>
|
144 |
</fieldset>
|
145 |
</blockquote>
|
146 |
<p class="submit">
|
147 |
+
<input type='submit' name='info_update' value='Save Options' />
|
148 |
</p>
|
149 |
</div>
|
150 |
</form>
|
154 |
|
155 |
/********************************************************************************************
|
156 |
|
157 |
+
MAIN FUNCTION FOR DELETING REVISIONS, TRASH, SPAM AND OPTIMIZING DATABASE TABLES
|
158 |
|
159 |
*********************************************************************************************/
|
160 |
function rvg_optimize_db()
|
161 |
{
|
162 |
+
global $wpdb, $version, $table_prefix;
|
163 |
|
164 |
/****************************************************************************************
|
165 |
|
171 |
{ $max_revisions = 0;
|
172 |
update_option('rvg_odb_number', $max_revisions);
|
173 |
}
|
174 |
+
|
175 |
+
$clear_trash = get_option('rvg_clear_trash');
|
176 |
+
if(!$clear_trash)
|
177 |
+
{ $clear_trash = 'N';
|
178 |
+
update_option('rvg_clear_trash', $clear_trash);
|
179 |
+
}
|
180 |
+
$clear_trash_yn = ($clear_trash == 'N') ? 'NO' : 'YES';
|
181 |
+
|
182 |
+
$clear_spam = get_option('rvg_clear_spam');
|
183 |
+
if(!$clear_spam)
|
184 |
+
{ $clear_spam = 'N';
|
185 |
+
update_option('rvg_clear_spam', $clear_spam);
|
186 |
+
}
|
187 |
+
$clear_spam_yn = ($clear_spam == 'N') ? 'NO' : 'YES';
|
188 |
+
|
189 |
+
$wp_only = get_option('rvg_wp_only');
|
190 |
+
if(!$wp_only)
|
191 |
+
{ $wp_only = 'N';
|
192 |
+
update_option('rvg_wp_only', $wp_only);
|
193 |
+
}
|
194 |
+
$wp_only_yn = ($wp_only == 'N') ? 'NO' : 'YES';
|
195 |
?>
|
196 |
+
<div style="padding-left:8px;">
|
197 |
+
<h2>Optimizing your WordPress Database</h2>
|
198 |
+
<p><span style="font-style:italic;"><a href="http://cagewebdev.com/index.php/optimize-database-after-deleting-revisions-wordpress-plugin/" target="_blank" style="font-weight:bold;">Optimize Database after Deleting Revisions v<?php echo $version?></a> - A WordPress Plugin by <a href="http://cagewebdev.com/" target="_blank" style="font-weight:bold;">Rolf van Gelder</a>, Eindhoven, The Netherlands</span></p>
|
199 |
+
<p><span style="font-style:normal;">Current options:<br />
|
200 |
+
<strong>Maximum number of - most recent - revisions to keep per post / page:</strong> <span style="font-weight:bold;color:#00F;"><?php echo $max_revisions?></span><br />
|
201 |
+
<strong>Delete trashed items:</strong> <span style="font-weight:bold;color:#00F;"><?php echo $clear_trash_yn?></span><br />
|
202 |
+
<strong>Delete spammed items:</strong> <span style="font-weight:bold;color:#00F;"><?php echo $clear_spam_yn?></span><br />
|
203 |
+
<strong>Only optimize WordPress tables:</strong> <span style="font-weight:bold;color:#00F;"><?php echo $wp_only_yn?></span><br />
|
204 |
+
<br />
|
205 |
+
Click <a href="options-general.php?page=rvg_odb_admin" style="font-weight:bold;">HERE</a> to change the above options.</span></p>
|
206 |
+
</div><br />
|
207 |
+
<h2 style="padding-left:8px;">Starting optimization...</h2>
|
208 |
<?php
|
209 |
$sql = "
|
210 |
SELECT `post_parent`, `post_title`, COUNT(*) cnt
|
269 |
<td align="right" style="border-top:solid 1px #999;font-weight:bold;"><?php echo $total_deleted?></td>
|
270 |
</tr>
|
271 |
</table>
|
|
|
272 |
<?php
|
273 |
}
|
274 |
else
|
275 |
{
|
276 |
+
?>
|
277 |
+
<table border="0" cellspacing="8" cellpadding="2">
|
278 |
+
<tr>
|
279 |
+
<td style="font-weight:bold;color:#21759b;">No REVISIONS found to delete...</td>
|
280 |
+
</tr>
|
281 |
+
</table>
|
282 |
+
<?php
|
283 |
+
} // if(count($results)>0)
|
284 |
?>
|
285 |
<?php
|
286 |
/****************************************************************************************
|
287 |
|
288 |
+
DELETE TRASHED ITEMS
|
289 |
|
290 |
******************************************************************************************/
|
291 |
?>
|
292 |
+
<?php
|
293 |
+
if($clear_trash == 'Y')
|
294 |
+
{
|
295 |
+
$sql = "
|
296 |
+
SELECT `post_title`, `post_modified`
|
297 |
+
FROM $wpdb->posts
|
298 |
+
WHERE `post_status` = 'trash'
|
299 |
+
ORDER BY UCASE(`post_title`)
|
300 |
+
";
|
301 |
+
$results = $wpdb -> get_results($sql);
|
302 |
+
|
303 |
+
if(count($results)>0)
|
304 |
+
{ // WE HAVE TRASH TO DELETE!
|
305 |
+
?>
|
306 |
+
<span style="font-weight:bold;color:#000;padding-left:8px;">~~~~~</span>
|
307 |
+
<table border="0" cellspacing="8" cellpadding="2">
|
308 |
+
<tr>
|
309 |
+
<td colspan="4" style="font-weight:bold;color:#00F;">DELETING TRASHED ITEMS:</td>
|
310 |
+
</tr>
|
311 |
+
<tr>
|
312 |
+
<th align="right" style="border-bottom:solid 1px #999;">#</th>
|
313 |
+
<th align="left" style="border-bottom:solid 1px #999;">post / page</th>
|
314 |
+
<th align="left" style="border-bottom:solid 1px #999;">last modified</th>
|
315 |
+
</tr>
|
316 |
+
<?php
|
317 |
+
$nr = 1;
|
318 |
+
$total_deleted = count($results);
|
319 |
+
for($i=0; $i<count($results); $i++)
|
320 |
+
{
|
321 |
+
?>
|
322 |
+
<tr>
|
323 |
+
<td align="right"><?php echo $nr; ?></td>
|
324 |
+
<td><?php echo $results[$i]->post_title; ?></td>
|
325 |
+
<td><?php echo $results[$i]->post_modified; ?></td>
|
326 |
+
</tr>
|
327 |
+
<?php
|
328 |
+
$nr++;
|
329 |
+
}
|
330 |
+
$sql_delete = "
|
331 |
+
DELETE FROM $wpdb->posts WHERE `post_status` = 'trash'
|
332 |
+
";
|
333 |
+
$wpdb -> get_results($sql_delete);
|
334 |
+
?>
|
335 |
+
</table>
|
336 |
+
<?php
|
337 |
+
}
|
338 |
+
else
|
339 |
+
{
|
340 |
+
?>
|
341 |
+
<span style="font-weight:bold;color:#000;padding-left:8px;">~~~~~</span>
|
342 |
+
<table border="0" cellspacing="8" cellpadding="2">
|
343 |
+
<tr>
|
344 |
+
<td style="font-weight:bold;color:#21759b;">No TRASHED ITEMS found to delete...</td>
|
345 |
+
</tr>
|
346 |
+
</table>
|
347 |
+
<?php
|
348 |
+
} // if(count($results)>0)
|
349 |
+
|
350 |
+
} // if($clear_trash == 'Y')
|
351 |
+
?>
|
352 |
+
<?php
|
353 |
+
/****************************************************************************************
|
354 |
+
|
355 |
+
DELETE SPAMMED ITEMS
|
356 |
+
|
357 |
+
******************************************************************************************/
|
358 |
+
?>
|
359 |
+
<?php
|
360 |
+
if($clear_spam == 'Y')
|
361 |
+
{
|
362 |
+
$sql = "
|
363 |
+
SELECT `comment_ID`, `comment_author`, `comment_author_email`, `comment_date`
|
364 |
+
FROM $wpdb->comments
|
365 |
+
WHERE `comment_approved` = 'spam'
|
366 |
+
ORDER BY UCASE(`comment_author`)
|
367 |
+
";
|
368 |
+
$results = $wpdb -> get_results($sql);
|
369 |
+
|
370 |
+
if(count($results)>0)
|
371 |
+
{ // WE HAVE SPAM TO DELETE!
|
372 |
+
?>
|
373 |
+
<span style="font-weight:bold;color:#000;padding-left:8px;">~~~~~</span>
|
374 |
+
<table border="0" cellspacing="8" cellpadding="2">
|
375 |
+
<tr>
|
376 |
+
<td colspan="4" style="font-weight:bold;color:#00F;">DELETING SPAMMED ITEMS:</td>
|
377 |
+
</tr>
|
378 |
+
<tr>
|
379 |
+
<th align="right" style="border-bottom:solid 1px #999;">#</th>
|
380 |
+
<th align="left" style="border-bottom:solid 1px #999;">comment author</th>
|
381 |
+
<th align="left" style="border-bottom:solid 1px #999;">comment author email</th>
|
382 |
+
<th align="left" style="border-bottom:solid 1px #999;">comment date</th>
|
383 |
+
</tr>
|
384 |
+
<?php
|
385 |
+
$nr = 1;
|
386 |
+
$total_deleted = count($results);
|
387 |
+
for($i=0; $i<count($results); $i++)
|
388 |
+
{
|
389 |
+
?>
|
390 |
+
<tr>
|
391 |
+
<td align="right"><?php echo $nr; ?></td>
|
392 |
+
<td><?php echo $results[$i]->comment_author; ?></td>
|
393 |
+
<td><?php echo $results[$i]->comment_author_email; ?></td>
|
394 |
+
<td><?php echo $results[$i]->comment_date; ?></td>
|
395 |
+
</tr>
|
396 |
+
<?php
|
397 |
+
$sql_delete = "
|
398 |
+
DELETE FROM $wpdb->commentmeta WHERE `comment_id` = ".$results[$i]->comment_ID."
|
399 |
+
";
|
400 |
+
$wpdb -> get_results($sql_delete);
|
401 |
+
$nr++;
|
402 |
+
}
|
403 |
+
$sql_delete = "
|
404 |
+
DELETE FROM $wpdb->comments WHERE `comment_approved` = 'spam'
|
405 |
+
";
|
406 |
+
$wpdb -> get_results($sql_delete);
|
407 |
+
?>
|
408 |
+
</table>
|
409 |
+
<?php
|
410 |
+
}
|
411 |
+
else
|
412 |
+
{
|
413 |
+
?>
|
414 |
+
<span style="font-weight:bold;color:#000;padding-left:8px;">~~~~~</span>
|
415 |
+
<table border="0" cellspacing="8" cellpadding="2">
|
416 |
+
<tr>
|
417 |
+
<td style="font-weight:bold;color:#21759b;">No SPAMMED ITEMS found to delete...</td>
|
418 |
+
</tr>
|
419 |
+
</table>
|
420 |
+
<?php
|
421 |
+
} // if(count($results)>0)
|
422 |
+
|
423 |
+
} // if($clear_spam == 'Y')
|
424 |
+
?>
|
425 |
+
<?php
|
426 |
+
/****************************************************************************************
|
427 |
+
|
428 |
+
OPTIMIZE DATABASE TABLES
|
429 |
+
|
430 |
+
******************************************************************************************/
|
431 |
+
?>
|
432 |
+
<span style="font-weight:bold;color:#000;padding-left:8px;">~~~~~</span>
|
433 |
<table border="0" cellspacing="8" cellpadding="2">
|
434 |
<tr>
|
435 |
<td colspan="3" style="font-weight:bold;color:#00F;">OPTIMIZING DATABASE TABLES:</td>
|
445 |
$cnt = 0;
|
446 |
while($row = mysql_fetch_row($names))
|
447 |
{
|
448 |
+
if($wp_only == 'N' || ($wp_only == 'Y' && substr($row[0],0,strlen($table_prefix)) == $table_prefix))
|
449 |
+
{ # ALL TABLES OR THIS IS A WORDPRESS TABLE
|
450 |
+
$cnt++;
|
451 |
+
$query = "OPTIMIZE TABLE ".$row[0];
|
452 |
+
$result = $wpdb -> get_results($query);
|
453 |
?>
|
454 |
<tr>
|
455 |
<td align="right"><?php echo $cnt?>.</td>
|
457 |
<td><?php echo $result[0]->Msg_text ?></td>
|
458 |
</tr>
|
459 |
<?php
|
460 |
+
} // if($wp_only == 'N' || ($wp_only == 'Y' && substr($row[0],0,strlen($table_prefix)) == $table_prefix))
|
461 |
+
} // while($row = mysql_fetch_row($names))
|
462 |
?>
|
463 |
</table>
|
464 |
<br />
|
465 |
+
<span style="font-weight:bold;color:#00F;padding-left:8px;">D O N E !</span>
|
466 |
<?php
|
467 |
}
|
468 |
?>
|