Version Description
[12/06/2013] = * NEW: deletion of expired transients (optional)
Download this release
Release Info
Developer | cageehv |
Plugin | Optimize Database after Deleting Revisions |
Version | 2.7 |
Comparing to | |
See all releases |
Code changes from version 2.6 to 2.7
- readme.txt +9 -5
- rvg-optimize-db.php +170 -28
readme.txt
CHANGED
@@ -3,13 +3,13 @@ Contributors: CAGE Web Design | Rolf van Gelder
|
|
3 |
Donate link: http://cagewebdev.com
|
4 |
Plugin Name: Optimize Database after Deleting Revisions
|
5 |
Plugin URI: http://cagewebdev.com/index.php/optimize-database-after-deleting-revisions-wordpress-plugin
|
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.
|
10 |
-
Tested up to: 3.
|
11 |
-
Stable tag: 2.
|
12 |
-
Version: 2.
|
13 |
|
14 |
== Description ==
|
15 |
|
@@ -21,6 +21,7 @@ This plugin is a 'One Click' WordPress Database Cleaner / Optimizer.
|
|
21 |
* Deletes spammed comments (optional)
|
22 |
* Deletes unused tags (optional)
|
23 |
* Deletes 'orphan postmeta items'
|
|
|
24 |
* Optimizes the database tables (optionally you can exclude certain tables from optimization)
|
25 |
* Creates a log file of the optimizations (optional)
|
26 |
* Optimization can be scheduled to automatically run once hourly, twice daily, once daily or once weekly at a specific time (optional)
|
@@ -53,6 +54,9 @@ No warranty, use at own risk!
|
|
53 |
|
54 |
== Changelog ==
|
55 |
|
|
|
|
|
|
|
56 |
= 2.6 [07/22/2013] =
|
57 |
* NEW: deletion of unused tags (optional)
|
58 |
|
3 |
Donate link: http://cagewebdev.com
|
4 |
Plugin Name: Optimize Database after Deleting Revisions
|
5 |
Plugin URI: http://cagewebdev.com/index.php/optimize-database-after-deleting-revisions-wordpress-plugin
|
6 |
+
Tags: database, delete, revisions, optimize, post, posts, page, pages, clean, clean up, trash, spam, trashed, spammed, database size, scheduler, transients
|
7 |
Author URI: http://cagewebdev.com
|
8 |
Author: CAGE Web Design | Rolf van Gelder, Eindhoven, The Netherlands
|
9 |
+
Requires at least: 2.0
|
10 |
+
Tested up to: 3.7.1
|
11 |
+
Stable tag: 2.7
|
12 |
+
Version: 2.7
|
13 |
|
14 |
== Description ==
|
15 |
|
21 |
* Deletes spammed comments (optional)
|
22 |
* Deletes unused tags (optional)
|
23 |
* Deletes 'orphan postmeta items'
|
24 |
+
* Deletes 'expired transients'
|
25 |
* Optimizes the database tables (optionally you can exclude certain tables from optimization)
|
26 |
* Creates a log file of the optimizations (optional)
|
27 |
* Optimization can be scheduled to automatically run once hourly, twice daily, once daily or once weekly at a specific time (optional)
|
54 |
|
55 |
== Changelog ==
|
56 |
|
57 |
+
= 2.7 [12/06/2013] =
|
58 |
+
* NEW: deletion of expired transients (optional)
|
59 |
+
|
60 |
= 2.6 [07/22/2013] =
|
61 |
* NEW: deletion of unused tags (optional)
|
62 |
|
rvg-optimize-db.php
CHANGED
@@ -1,16 +1,16 @@
|
|
1 |
<?php
|
2 |
-
$odb_version = '2.
|
3 |
-
$odb_release_date = '
|
4 |
/**
|
5 |
* @package Optimize Database after Deleting Revisions
|
6 |
-
* @version 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 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.
|
14 |
Author URI: http://cagewebdev.com
|
15 |
*/
|
16 |
?>
|
@@ -160,6 +160,11 @@ function rvg_odb_options_page()
|
|
160 |
if(isset($_POST['rvg_clear_tags']))
|
161 |
$rvg_clear_tags = $_POST['rvg_clear_tags'];
|
162 |
update_option('rvg_clear_tags', $rvg_clear_tags);
|
|
|
|
|
|
|
|
|
|
|
163 |
|
164 |
$rvg_odb_adminbar = 'N';
|
165 |
if(isset($_POST['rvg_odb_adminbar']))
|
@@ -222,6 +227,9 @@ function rvg_odb_options_page()
|
|
222 |
|
223 |
$rvg_clear_tags = get_option('rvg_clear_tags');
|
224 |
if(!$rvg_clear_tags) $rvg_clear_tags = 'N';
|
|
|
|
|
|
|
225 |
|
226 |
$rvg_odb_logging_on = get_option('rvg_odb_logging_on');
|
227 |
if(!$rvg_odb_logging_on) $rvg_odb_logging_on = 'N';
|
@@ -266,6 +274,7 @@ if($rvg_odb_adminbar == 'Y') $rvg_odb_adminbar_checked = ' checked="checked"';
|
|
266 |
if($rvg_clear_trash == 'Y') $rvg_clear_trash_checked = ' checked="checked"'; else $rvg_clear_trash_checked = '';
|
267 |
if($rvg_clear_spam == 'Y') $rvg_clear_spam_checked = ' checked="checked"'; else $rvg_clear_spam_checked = '';
|
268 |
if($rvg_clear_tags == 'Y') $rvg_clear_tags_checked = ' checked="checked"'; else $rvg_clear_tags_checked = '';
|
|
|
269 |
if($rvg_odb_logging_on == 'Y') $rvg_odb_logging_on_checked = ' checked="checked"'; else $rvg_odb_logging_on_checked = '';
|
270 |
?>
|
271 |
<blockquote>
|
@@ -289,7 +298,11 @@ if($rvg_odb_logging_on == 'Y') $rvg_odb_logging_on_checked = ' checked="checke
|
|
289 |
<tr>
|
290 |
<td width="50%" align="right" valign="top"><span style="font-weight:bold;">Delete unused tags</span></td>
|
291 |
<td width="50%" valign="top"><input name="rvg_clear_tags" type="checkbox" value="Y" <?php echo $rvg_clear_tags_checked?> /></td>
|
292 |
-
</tr>
|
|
|
|
|
|
|
|
|
293 |
<tr>
|
294 |
<td width="50%" align="right" valign="top"><span style="font-weight:bold;">Keep a log</span></td>
|
295 |
<td width="50%" valign="top"><input name="rvg_odb_logging_on" type="checkbox" value="Y" <?php echo $rvg_odb_logging_on_checked?> /></td>
|
@@ -438,6 +451,13 @@ function rvg_optimize_db()
|
|
438 |
}
|
439 |
$clear_tags_yn = ($clear_tags == 'N') ? 'NO' : 'YES';
|
440 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
441 |
$rvg_odb_logging_on = get_option('rvg_odb_logging_on');
|
442 |
if(!$rvg_odb_logging_on)
|
443 |
{ $rvg_odb_logging_on = 'N';
|
@@ -496,6 +516,7 @@ function rvg_optimize_db()
|
|
496 |
<strong>Delete trashed items:</strong> <span style="font-weight:bold;color:#00F;"><?php echo $clear_trash_yn?></span><br />
|
497 |
<strong>Delete spammed items:</strong> <span style="font-weight:bold;color:#00F;"><?php echo $clear_spam_yn?></span><br />
|
498 |
<strong>Delete unused tags:</strong> <span style="font-weight:bold;color:#00F;"><?php echo $clear_tags_yn?></span><br />
|
|
|
499 |
<strong>Keep a log:</strong> <span style="font-weight:bold;color:#00F;"><?php echo $rvg_odb_logging_on_yn?></span><br />
|
500 |
<strong>Number of excluded tables:</strong> <span style="font-weight:bold;color:#00F;"><?php echo $number_excluded?></span><br />
|
501 |
<strong>Scheduler:</strong> <span style="font-weight:bold;color:#00F;"><?php echo $rvg_odb_schedule_txt?></span>
|
@@ -743,6 +764,47 @@ function rvg_optimize_db()
|
|
743 |
// NUMBER OF tags DELETED FOR LOG FILE
|
744 |
$log_arr["tags"] = $total_deleted;
|
745 |
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
746 |
<?php
|
747 |
/****************************************************************************************
|
748 |
|
@@ -896,7 +958,13 @@ function rvg_optimize_db_cron()
|
|
896 |
if(!$clear_tags)
|
897 |
{ $clear_tags = 'N';
|
898 |
update_option('rvg_clear_tags', $clear_tags);
|
899 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
900 |
|
901 |
// GET THE SIZE OF THE DATABASE BEFORE OPTIMIZATION
|
902 |
$start_size = rvg_get_db_size();
|
@@ -950,8 +1018,16 @@ function rvg_optimize_db_cron()
|
|
950 |
$total_deleted = rvg_delete_tags();
|
951 |
}
|
952 |
|
953 |
-
// NUMBER OF
|
954 |
$log_arr["tags"] = $total_deleted;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
955 |
|
956 |
// DELETE ORPHANS
|
957 |
$total_deleted = rvg_delete_orphans(false);
|
@@ -1150,6 +1226,69 @@ function rvg_delete_tags()
|
|
1150 |
} // rvg_delete_tags()
|
1151 |
?>
|
1152 |
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1153 |
/********************************************************************************************
|
1154 |
|
1155 |
DELETE ORPHAN POSTMETA RECORDS
|
@@ -1350,21 +1489,23 @@ td {
|
|
1350 |
</div>
|
1351 |
<table width="100%" border="0" cellspacing="6" cellpadding="1">
|
1352 |
<tr>
|
1353 |
-
<th width="
|
1354 |
-
<th width="
|
1355 |
revisions</th>
|
1356 |
-
<th width="
|
1357 |
trash</th>
|
1358 |
-
<th width="
|
1359 |
spam</th>
|
1360 |
-
<th width="
|
1361 |
-
tags</th>
|
1362 |
-
<th width="
|
|
|
|
|
1363 |
orphans</th>
|
1364 |
-
<th width="
|
1365 |
-
<th width="
|
1366 |
-
<th width="
|
1367 |
-
<th width="
|
1368 |
</tr>
|
1369 |
</table>
|
1370 |
';
|
@@ -1376,16 +1517,17 @@ td {
|
|
1376 |
$html = '
|
1377 |
<table width="100%" border="0" cellspacing="6" cellpadding="0">
|
1378 |
<tr>
|
1379 |
-
<td width="
|
1380 |
-
<td width="
|
1381 |
-
<td width="
|
1382 |
-
<td width="
|
1383 |
-
<td width="
|
1384 |
-
<td width="
|
1385 |
-
<td width="
|
1386 |
-
<td width="
|
1387 |
-
<td width="
|
1388 |
-
<td width="
|
|
|
1389 |
</tr>
|
1390 |
</table>
|
1391 |
';
|
1 |
<?php
|
2 |
+
$odb_version = '2.7';
|
3 |
+
$odb_release_date = '12/06/2013';
|
4 |
/**
|
5 |
* @package Optimize Database after Deleting Revisions
|
6 |
+
* @version 2.7
|
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.7
|
14 |
Author URI: http://cagewebdev.com
|
15 |
*/
|
16 |
?>
|
160 |
if(isset($_POST['rvg_clear_tags']))
|
161 |
$rvg_clear_tags = $_POST['rvg_clear_tags'];
|
162 |
update_option('rvg_clear_tags', $rvg_clear_tags);
|
163 |
+
|
164 |
+
$rvg_clear_transients = 'N';
|
165 |
+
if(isset($_POST['rvg_clear_transients']))
|
166 |
+
$rvg_clear_transients = $_POST['rvg_clear_transients'];
|
167 |
+
update_option('rvg_clear_transients', $rvg_clear_transients);
|
168 |
|
169 |
$rvg_odb_adminbar = 'N';
|
170 |
if(isset($_POST['rvg_odb_adminbar']))
|
227 |
|
228 |
$rvg_clear_tags = get_option('rvg_clear_tags');
|
229 |
if(!$rvg_clear_tags) $rvg_clear_tags = 'N';
|
230 |
+
|
231 |
+
$rvg_clear_transients = get_option('rvg_clear_transients');
|
232 |
+
if(!$rvg_clear_transients) $rvg_clear_transients = 'N';
|
233 |
|
234 |
$rvg_odb_logging_on = get_option('rvg_odb_logging_on');
|
235 |
if(!$rvg_odb_logging_on) $rvg_odb_logging_on = 'N';
|
274 |
if($rvg_clear_trash == 'Y') $rvg_clear_trash_checked = ' checked="checked"'; else $rvg_clear_trash_checked = '';
|
275 |
if($rvg_clear_spam == 'Y') $rvg_clear_spam_checked = ' checked="checked"'; else $rvg_clear_spam_checked = '';
|
276 |
if($rvg_clear_tags == 'Y') $rvg_clear_tags_checked = ' checked="checked"'; else $rvg_clear_tags_checked = '';
|
277 |
+
if($rvg_clear_transients == 'Y') $rvg_clear_transients_checked = ' checked="checked"'; else $rvg_clear_transients_checked = '';
|
278 |
if($rvg_odb_logging_on == 'Y') $rvg_odb_logging_on_checked = ' checked="checked"'; else $rvg_odb_logging_on_checked = '';
|
279 |
?>
|
280 |
<blockquote>
|
298 |
<tr>
|
299 |
<td width="50%" align="right" valign="top"><span style="font-weight:bold;">Delete unused tags</span></td>
|
300 |
<td width="50%" valign="top"><input name="rvg_clear_tags" type="checkbox" value="Y" <?php echo $rvg_clear_tags_checked?> /></td>
|
301 |
+
</tr>
|
302 |
+
<tr>
|
303 |
+
<td width="50%" align="right" valign="top"><span style="font-weight:bold;">Delete expired transients</span></td>
|
304 |
+
<td width="50%" valign="top"><input name="rvg_clear_transients" type="checkbox" value="Y" <?php echo $rvg_clear_transients_checked?> /></td>
|
305 |
+
</tr>
|
306 |
<tr>
|
307 |
<td width="50%" align="right" valign="top"><span style="font-weight:bold;">Keep a log</span></td>
|
308 |
<td width="50%" valign="top"><input name="rvg_odb_logging_on" type="checkbox" value="Y" <?php echo $rvg_odb_logging_on_checked?> /></td>
|
451 |
}
|
452 |
$clear_tags_yn = ($clear_tags == 'N') ? 'NO' : 'YES';
|
453 |
|
454 |
+
$clear_transients = get_option('rvg_clear_transients');
|
455 |
+
if(!$clear_transients)
|
456 |
+
{ $clear_transients = 'N';
|
457 |
+
update_option('rvg_clear_transients', $clear_transients);
|
458 |
+
}
|
459 |
+
$clear_transients_yn = ($clear_transients == 'N') ? 'NO' : 'YES';
|
460 |
+
|
461 |
$rvg_odb_logging_on = get_option('rvg_odb_logging_on');
|
462 |
if(!$rvg_odb_logging_on)
|
463 |
{ $rvg_odb_logging_on = 'N';
|
516 |
<strong>Delete trashed items:</strong> <span style="font-weight:bold;color:#00F;"><?php echo $clear_trash_yn?></span><br />
|
517 |
<strong>Delete spammed items:</strong> <span style="font-weight:bold;color:#00F;"><?php echo $clear_spam_yn?></span><br />
|
518 |
<strong>Delete unused tags:</strong> <span style="font-weight:bold;color:#00F;"><?php echo $clear_tags_yn?></span><br />
|
519 |
+
<strong>Delete expired transients:</strong> <span style="font-weight:bold;color:#00F;"><?php echo $clear_transients_yn?></span><br />
|
520 |
<strong>Keep a log:</strong> <span style="font-weight:bold;color:#00F;"><?php echo $rvg_odb_logging_on_yn?></span><br />
|
521 |
<strong>Number of excluded tables:</strong> <span style="font-weight:bold;color:#00F;"><?php echo $number_excluded?></span><br />
|
522 |
<strong>Scheduler:</strong> <span style="font-weight:bold;color:#00F;"><?php echo $rvg_odb_schedule_txt?></span>
|
764 |
// NUMBER OF tags DELETED FOR LOG FILE
|
765 |
$log_arr["tags"] = $total_deleted;
|
766 |
?>
|
767 |
+
<?php
|
768 |
+
/****************************************************************************************
|
769 |
+
|
770 |
+
DELETE EXPIRED TRANSIENTS
|
771 |
+
|
772 |
+
******************************************************************************************/
|
773 |
+
?>
|
774 |
+
<?php
|
775 |
+
if($clear_transients == 'Y')
|
776 |
+
{
|
777 |
+
// DELETE UNUSED TAGS
|
778 |
+
$total_deleted = rvg_delete_transients();
|
779 |
+
|
780 |
+
if($total_deleted>0)
|
781 |
+
{ // TRANSIENTS DELETED
|
782 |
+
?>
|
783 |
+
<span style="font-weight:bold;color:#000;padding-left:8px;">~~~~~</span>
|
784 |
+
<table border="0" cellspacing="8" cellpadding="2">
|
785 |
+
<tr>
|
786 |
+
<td><span style="font-weight:bold;color:#00F;">NUMBER OF EXPIRED TRANSIENTS DELETED:</span> <span style="font-weight:bold;"><?php echo $total_deleted;?></span></td>
|
787 |
+
</tr>
|
788 |
+
</table>
|
789 |
+
<?php
|
790 |
+
}
|
791 |
+
else
|
792 |
+
{
|
793 |
+
?>
|
794 |
+
<span style="font-weight:bold;color:#000;padding-left:8px;">~~~~~</span>
|
795 |
+
<table border="0" cellspacing="8" cellpadding="2">
|
796 |
+
<tr>
|
797 |
+
<td style="font-weight:bold;color:#21759b;">No EXPIRED TRANSIENTS found to delete...</td>
|
798 |
+
</tr>
|
799 |
+
</table>
|
800 |
+
<?php
|
801 |
+
} // if(count($results)>0)
|
802 |
+
|
803 |
+
} // if($clear_transients == 'Y')
|
804 |
+
|
805 |
+
// NUMBER OF transients DELETED FOR LOG FILE
|
806 |
+
$log_arr["transients"] = $total_deleted;
|
807 |
+
?>
|
808 |
<?php
|
809 |
/****************************************************************************************
|
810 |
|
958 |
if(!$clear_tags)
|
959 |
{ $clear_tags = 'N';
|
960 |
update_option('rvg_clear_tags', $clear_tags);
|
961 |
+
}
|
962 |
+
|
963 |
+
$clear_transients = get_option('rvg_clear_transients');
|
964 |
+
if(!$clear_transients)
|
965 |
+
{ $clear_transients = 'N';
|
966 |
+
update_option('rvg_clear_transients', $clear_transients);
|
967 |
+
}
|
968 |
|
969 |
// GET THE SIZE OF THE DATABASE BEFORE OPTIMIZATION
|
970 |
$start_size = rvg_get_db_size();
|
1018 |
$total_deleted = rvg_delete_tags();
|
1019 |
}
|
1020 |
|
1021 |
+
// NUMBER OF DELETE TAGS FOR LOG FILE
|
1022 |
$log_arr["tags"] = $total_deleted;
|
1023 |
+
|
1024 |
+
if($clear_transients == "Y")
|
1025 |
+
{ // DELETE UNUSED TAGS
|
1026 |
+
$total_deleted = rvg_delete_transients();
|
1027 |
+
}
|
1028 |
+
|
1029 |
+
// NUMBER OF DELETED TAGS FOR LOG FILE
|
1030 |
+
$log_arr["transients"] = $total_deleted;
|
1031 |
|
1032 |
// DELETE ORPHANS
|
1033 |
$total_deleted = rvg_delete_orphans(false);
|
1226 |
} // rvg_delete_tags()
|
1227 |
?>
|
1228 |
<?php
|
1229 |
+
/********************************************************************************************
|
1230 |
+
|
1231 |
+
DELETE EXPIRED TRANSIENTS
|
1232 |
+
|
1233 |
+
*********************************************************************************************/
|
1234 |
+
function rvg_delete_transients()
|
1235 |
+
{
|
1236 |
+
global $wpdb;
|
1237 |
+
|
1238 |
+
$delay = time() - 60; // one minute delay
|
1239 |
+
|
1240 |
+
$total_deleted = 0;
|
1241 |
+
|
1242 |
+
$sql = "
|
1243 |
+
SELECT *
|
1244 |
+
FROM $wpdb->options
|
1245 |
+
WHERE (
|
1246 |
+
option_name LIKE '_transient_timeout_%'
|
1247 |
+
OR option_name LIKE '_site_transient_timeout_%'
|
1248 |
+
OR option_name LIKE 'displayed_galleries_%'
|
1249 |
+
)
|
1250 |
+
AND option_value < '$delay'
|
1251 |
+
";
|
1252 |
+
|
1253 |
+
$results = $wpdb -> get_results($sql);
|
1254 |
+
$total_deleted = count($results);
|
1255 |
+
|
1256 |
+
$sql = "
|
1257 |
+
DELETE FROM $wpdb->options
|
1258 |
+
WHERE (
|
1259 |
+
option_name LIKE '_transient_timeout_%'
|
1260 |
+
OR option_name LIKE '_site_transient_timeout_%'
|
1261 |
+
OR option_name LIKE 'displayed_galleries_%'
|
1262 |
+
)
|
1263 |
+
AND option_value < '$delay'
|
1264 |
+
";
|
1265 |
+
|
1266 |
+
$wpdb -> get_results($sql);
|
1267 |
+
|
1268 |
+
$sql = "
|
1269 |
+
SELECT *
|
1270 |
+
FROM $wpdb->options a, $wpdb->options b
|
1271 |
+
WHERE b.option_name = replace(a.option_name,'_timeout', '')
|
1272 |
+
AND (a.option_name like '_transient_timeout_%' or a.option_name like '_site_transient_timeout_%')
|
1273 |
+
AND a.option_value < '$delay'
|
1274 |
+
";
|
1275 |
+
|
1276 |
+
$results = $wpdb -> get_results($sql);
|
1277 |
+
$total_deleted += count($results);
|
1278 |
+
|
1279 |
+
$sql = "
|
1280 |
+
DELETE FROM $wpdb->options a, $wpdb->options b
|
1281 |
+
WHERE b.option_name = replace(a.option_name,'_timeout', '')
|
1282 |
+
AND (a.option_name like '_transient_timeout_%' or a.option_name like '_site_transient_timeout_%')
|
1283 |
+
AND a.option_value < '$delay'
|
1284 |
+
";
|
1285 |
+
|
1286 |
+
$wpdb -> get_results($sql);
|
1287 |
+
|
1288 |
+
return $total_deleted;
|
1289 |
+
} // rvg_delete_transients()
|
1290 |
+
?>
|
1291 |
+
<?php
|
1292 |
/********************************************************************************************
|
1293 |
|
1294 |
DELETE ORPHAN POSTMETA RECORDS
|
1489 |
</div>
|
1490 |
<table width="100%" border="0" cellspacing="6" cellpadding="1">
|
1491 |
<tr>
|
1492 |
+
<th width="9%" align="left" valign="top">time</th>
|
1493 |
+
<th width="9%" align="right" valign="top">deleted<br />
|
1494 |
revisions</th>
|
1495 |
+
<th width="9%" align="right" valign="top">deleted<br />
|
1496 |
trash</th>
|
1497 |
+
<th width="9%" align="right" valign="top">deleted<br />
|
1498 |
spam</th>
|
1499 |
+
<th width="9%" align="right" valign="top">deleted<br />
|
1500 |
+
tags</th>
|
1501 |
+
<th width="9%" align="right" valign="top">deleted<br />
|
1502 |
+
transients</th>
|
1503 |
+
<th width="9%" align="right" valign="top">deleted<br />
|
1504 |
orphans</th>
|
1505 |
+
<th width="9%" align="right" valign="top">nr of optimized tables</th>
|
1506 |
+
<th width="9%" align="right" valign="top">database size BEFORE</th>
|
1507 |
+
<th width="9%" align="right" valign="top">database size AFTER</th>
|
1508 |
+
<th width="9%" align="right" valign="top">SAVINGS</th>
|
1509 |
</tr>
|
1510 |
</table>
|
1511 |
';
|
1517 |
$html = '
|
1518 |
<table width="100%" border="0" cellspacing="6" cellpadding="0">
|
1519 |
<tr>
|
1520 |
+
<td width="9%" valign="top"><strong>'.$log_arr["time"].'</strong></td>
|
1521 |
+
<td width="9%" align="right" valign="top">'.$log_arr["revisions"].'</td>
|
1522 |
+
<td width="9%" align="right" valign="top">'.$log_arr["trash"].'</td>
|
1523 |
+
<td width="9%" align="right" valign="top">'.$log_arr["spam"].'</td>
|
1524 |
+
<td width="9%" align="right" valign="top">'.$log_arr["tags"].'</td>
|
1525 |
+
<td width="9%" align="right" valign="top">'.$log_arr["transients"].'</td>
|
1526 |
+
<td width="9%" align="right" valign="top">'.$log_arr["orphans"].'</td>
|
1527 |
+
<td width="9%" align="right" valign="top">'.$log_arr["tables"].'</td>
|
1528 |
+
<td width="9%" align="right" valign="top">'.$log_arr["before"].'</td>
|
1529 |
+
<td width="9%" align="right" valign="top">'.$log_arr["after"].'</td>
|
1530 |
+
<td width="9%" align="right" valign="top">'.$log_arr["savings"].'</td>
|
1531 |
</tr>
|
1532 |
</table>
|
1533 |
';
|