Version Description
[01/29/2015] = * NEW: deletion of pingbacks and trackbacks (optional) * CHANGE: link to settings page in the main plugins page
Download this release
Release Info
Developer | cageehv |
Plugin | Optimize Database after Deleting Revisions |
Version | 3.1 |
Comparing to | |
See all releases |
Code changes from version 3.0 to 3.1
- readme.txt +22 -22
- rvg-optimize-db.php +202 -45
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, transients, unused tags
|
7 |
Author URI: http://cagewebdev.com
|
8 |
Author: CAGE Web Design | Rolf van Gelder, Eindhoven, The Netherlands
|
9 |
Requires at least: 2.8
|
10 |
-
Tested up to: 4.1
|
11 |
-
Stable tag: 3.
|
12 |
-
Version: 3.
|
13 |
License: GPLv2 or later
|
14 |
|
15 |
== Description ==
|
@@ -21,19 +21,21 @@ This plugin is a 'One Click' WordPress Database Cleaner / Optimizer.
|
|
21 |
* Deletes trashed posts, pages and comments (optional)
|
22 |
* Deletes spammed comments (optional)
|
23 |
* Deletes unused tags (optional)
|
|
|
|
|
24 |
* Deletes 'orphan postmeta items'
|
25 |
-
* Deletes 'expired transients'
|
26 |
* Optimizes the database tables (optionally you can exclude certain tables from optimization)
|
27 |
* Creates a log file of the optimizations (optional)
|
28 |
* Optimization can be scheduled to automatically run once hourly, twice daily, once daily or once weekly at a specific time (optional)
|
29 |
* 'Optimize DB (1 click)' link in the admin bar (optional)
|
30 |
|
31 |
= Settings =
|
32 |
-
You can find the settings page in the WP Admin Panel » Settings » Optimize DB
|
33 |
|
34 |
= Starting the Optimization =
|
35 |
-
You can start the Optimization in the WP Admin Panel » Tools » Optimize Database
|
36 |
-
Note: if you use the Scheduler the Optimization will run automatically
|
|
|
37 |
|
38 |
= Supported languages =
|
39 |
* English [en_US] - translated by Rolf van Gelder, CAGE Web Design - http://cagewebdev.com
|
@@ -52,24 +54,22 @@ http://wordpress.org/plugins/rvg-optimize-database/
|
|
52 |
= Disclaimer =
|
53 |
NO WARRANTY, USE IT AT YOUR OWN RISK!
|
54 |
|
55 |
-
= Plugins by Rolf van Gelder =
|
56 |
-
|
57 |
-
http://
|
58 |
-
<em>Rocket Reader (Speed reader)</em><br />
|
59 |
-
http://wordpress.org/plugins/rocket-reader-speed-reader/<br />
|
60 |
-
<em>Order your Posts Manually</em><br />
|
61 |
-
http://wordpress.org/plugins/order-your-posts-manually/<br />
|
62 |
-
<em>Float to Top Button</em><br />
|
63 |
-
http://wordpress.org/plugins/float-to-top-button/
|
64 |
|
65 |
== Installation ==
|
66 |
|
67 |
* Upload the Plugin to the `/wp-content/plugins/` directory
|
68 |
* Activate the plugin in the WP Admin Panel » Plugins
|
69 |
-
* Change the settings (if needed) in the WP Admin Panel » Settings » Optimize DB
|
70 |
|
71 |
== Changelog ==
|
72 |
|
|
|
|
|
|
|
|
|
73 |
= 3.0 [12/28/2014] =
|
74 |
* BUG FIX: tags only used in scheduled posts won't be deleted anymore (thanks Michael!)
|
75 |
|
@@ -153,7 +153,7 @@ http://wordpress.org/plugins/float-to-top-button/
|
|
153 |
= 2.2.6 [03/05/2013] =
|
154 |
* Text change: 'logging on' changed to 'keep a log' (thanks to: Neil Parks)
|
155 |
* NEW: number of orphans deleted now also shown in the log file
|
156 |
-
* NEW: 'Go To Optimizer' button on
|
157 |
|
158 |
= 2.2.5 [02/20/2013] =
|
159 |
* Bug fix: fixed an (innocent) PHP warning (in error.log)
|
@@ -210,10 +210,10 @@ http://wordpress.org/plugins/float-to-top-button/
|
|
210 |
* Some textual and link fixes
|
211 |
|
212 |
= 1.1.6 [09/01/2012] =
|
213 |
-
* Fixed the link to the
|
214 |
|
215 |
= 1.1.3 [09/01/2012] =
|
216 |
-
* Moved the 'Optimize DB
|
217 |
|
218 |
= 1.1.2 [08/30/2012] =
|
219 |
* Minor bug fix for the new option page
|
@@ -242,7 +242,7 @@ http://wordpress.org/plugins/float-to-top-button/
|
|
242 |
== Frequently Asked Questions ==
|
243 |
|
244 |
= How can I change the settings of this plugin? =
|
245 |
-
* WP Admin Panel » Settings » Optimize DB
|
246 |
|
247 |
= How do I run this plugin? =
|
248 |
* WP Admin Panel » Tools » Optimize Database. Then click the 'Start Optimization'-button.
|
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, unused tags, pingback, trackback
|
7 |
Author URI: http://cagewebdev.com
|
8 |
Author: CAGE Web Design | Rolf van Gelder, Eindhoven, The Netherlands
|
9 |
Requires at least: 2.8
|
10 |
+
Tested up to: 4.1.1
|
11 |
+
Stable tag: 3.1
|
12 |
+
Version: 3.1
|
13 |
License: GPLv2 or later
|
14 |
|
15 |
== Description ==
|
21 |
* Deletes trashed posts, pages and comments (optional)
|
22 |
* Deletes spammed comments (optional)
|
23 |
* Deletes unused tags (optional)
|
24 |
+
* Deletes 'expired transients' (optional)
|
25 |
+
* Deletes 'pingbacks' and 'trackbacks' (optional)
|
26 |
* Deletes 'orphan postmeta items'
|
|
|
27 |
* Optimizes the database tables (optionally you can exclude certain tables from optimization)
|
28 |
* Creates a log file of the optimizations (optional)
|
29 |
* Optimization can be scheduled to automatically run once hourly, twice daily, once daily or once weekly at a specific time (optional)
|
30 |
* 'Optimize DB (1 click)' link in the admin bar (optional)
|
31 |
|
32 |
= Settings =
|
33 |
+
You can find the settings page in the WP Admin Panel » Settings » Optimize DB Settings.
|
34 |
|
35 |
= Starting the Optimization =
|
36 |
+
You can start the Optimization in the WP Admin Panel » Tools » Optimize Database.<br />
|
37 |
+
Note: if you use the Scheduler the Optimization will run automatically!<br />
|
38 |
+
Note: you also can click the 'Optimize DB (1 click)' link in the admin bar (if enabled)
|
39 |
|
40 |
= Supported languages =
|
41 |
* English [en_US] - translated by Rolf van Gelder, CAGE Web Design - http://cagewebdev.com
|
54 |
= Disclaimer =
|
55 |
NO WARRANTY, USE IT AT YOUR OWN RISK!
|
56 |
|
57 |
+
= Plugins by CAGE Web Design | Rolf van Gelder =
|
58 |
+
WordPress plugins created by CAGE Web Design | Rolf van Gelder<br />
|
59 |
+
http://cagewebdev.com/index.php/wordpress-plugins/
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
|
61 |
== Installation ==
|
62 |
|
63 |
* Upload the Plugin to the `/wp-content/plugins/` directory
|
64 |
* Activate the plugin in the WP Admin Panel » Plugins
|
65 |
+
* Change the settings (if needed) in the WP Admin Panel » Settings » Optimize DB Settings.
|
66 |
|
67 |
== Changelog ==
|
68 |
|
69 |
+
= 3.1 [01/29/2015] =
|
70 |
+
* NEW: deletion of pingbacks and trackbacks (optional)
|
71 |
+
* CHANGE: link to settings page in the main plugins page
|
72 |
+
|
73 |
= 3.0 [12/28/2014] =
|
74 |
* BUG FIX: tags only used in scheduled posts won't be deleted anymore (thanks Michael!)
|
75 |
|
153 |
= 2.2.6 [03/05/2013] =
|
154 |
* Text change: 'logging on' changed to 'keep a log' (thanks to: Neil Parks)
|
155 |
* NEW: number of orphans deleted now also shown in the log file
|
156 |
+
* NEW: 'Go To Optimizer' button on settings page (thanks to: RonDsy)
|
157 |
|
158 |
= 2.2.5 [02/20/2013] =
|
159 |
* Bug fix: fixed an (innocent) PHP warning (in error.log)
|
210 |
* Some textual and link fixes
|
211 |
|
212 |
= 1.1.6 [09/01/2012] =
|
213 |
+
* Fixed the link to the settings page
|
214 |
|
215 |
= 1.1.3 [09/01/2012] =
|
216 |
+
* Moved the 'Optimize DB Settings' item to Dashboard 'Settings' Menu and the 'Optimize Database' item to the Dashboard 'Tools' Menu. That makes more sense!
|
217 |
|
218 |
= 1.1.2 [08/30/2012] =
|
219 |
* Minor bug fix for the new option page
|
242 |
== Frequently Asked Questions ==
|
243 |
|
244 |
= How can I change the settings of this plugin? =
|
245 |
+
* WP Admin Panel » Settings » Optimize DB Settings'. There you can define the maximum number of - most recent - revisions you want to keep per post or page and some more settings.
|
246 |
|
247 |
= How do I run this plugin? =
|
248 |
* WP Admin Panel » Tools » Optimize Database. Then click the 'Start Optimization'-button.
|
rvg-optimize-db.php
CHANGED
@@ -1,16 +1,16 @@
|
|
1 |
<?php
|
2 |
-
$odb_version = '3.
|
3 |
-
$odb_release_date = '
|
4 |
/**
|
5 |
* @package Optimize Database after Deleting Revisions
|
6 |
-
* @version 3.
|
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
|
12 |
Author: CAGE Web Design | Rolf van Gelder, Eindhoven, The Netherlands
|
13 |
-
Version: 3.
|
14 |
Author URI: http://cagewebdev.com
|
15 |
*/
|
16 |
|
@@ -47,18 +47,31 @@ add_action('admin_menu', 'optimize_db_main');
|
|
47 |
|
48 |
/********************************************************************************************
|
49 |
|
50 |
-
ADD THE 'OPTIMIZE DB
|
51 |
|
52 |
*********************************************************************************************/
|
53 |
function rvg_odb_admin_menu()
|
54 |
{
|
55 |
if (function_exists('add_options_page'))
|
56 |
-
{ add_options_page(__('Optimize DB
|
57 |
}
|
58 |
}
|
59 |
add_action( 'admin_menu', 'rvg_odb_admin_menu' );
|
60 |
|
61 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
62 |
/********************************************************************************************
|
63 |
|
64 |
ADD THE '1 CLICK OPTIMIZE DATABASE' ITEM TO THE ADMIN BAR (IF ACTIVATED)
|
@@ -74,6 +87,24 @@ $rvg_odb_adminbar = get_option('rvg_odb_adminbar');
|
|
74 |
if($rvg_odb_adminbar == "Y") add_action( 'wp_before_admin_bar_render', 'rvg_odb_admin_bar' );
|
75 |
|
76 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
77 |
/********************************************************************************************
|
78 |
|
79 |
ACTIONS FOR THE SCHEDULER
|
@@ -114,10 +145,10 @@ function rvg_activate_plugin()
|
|
114 |
|
115 |
/********************************************************************************************
|
116 |
|
117 |
-
CREATE THE
|
118 |
|
119 |
*********************************************************************************************/
|
120 |
-
function
|
121 |
{
|
122 |
global $odb_version, $odb_release_date, $wpdb, $table_prefix;
|
123 |
|
@@ -129,7 +160,7 @@ function rvg_odb_options_page()
|
|
129 |
if(isset($_REQUEST['delete_log']))
|
130 |
if($_REQUEST['delete_log'] == "Y") @unlink(dirname(__FILE__).'/rvg-optimize-db-log.html');
|
131 |
|
132 |
-
// SAVE THE
|
133 |
if (isset($_POST['info_update']))
|
134 |
{
|
135 |
// v2.8.3
|
@@ -178,6 +209,12 @@ function rvg_odb_options_page()
|
|
178 |
$rvg_clear_transients = $_POST['rvg_clear_transients'];
|
179 |
update_option('rvg_clear_transients', $rvg_clear_transients);
|
180 |
|
|
|
|
|
|
|
|
|
|
|
|
|
181 |
$rvg_odb_adminbar = 'N';
|
182 |
if(isset($_POST['rvg_odb_adminbar']))
|
183 |
$rvg_odb_adminbar = $_POST['rvg_odb_adminbar'];
|
@@ -226,7 +263,7 @@ function rvg_odb_options_page()
|
|
226 |
|
227 |
// UPDATED MESSAGE
|
228 |
echo "<div class='updated'><p><strong>".
|
229 |
-
__('Optimize Database after Deleting Revisions
|
230 |
"</strong> - ";
|
231 |
echo __('Click <a href="tools.php?page=rvg-optimize-db.php" style="font-weight:bold">HERE</a> to run the optimization','rvg-optimize-database');
|
232 |
echo "</p></div>";
|
@@ -246,6 +283,10 @@ function rvg_odb_options_page()
|
|
246 |
|
247 |
$rvg_clear_transients = get_option('rvg_clear_transients');
|
248 |
if(!$rvg_clear_transients) $rvg_clear_transients = 'N';
|
|
|
|
|
|
|
|
|
249 |
|
250 |
$rvg_odb_logging_on = get_option('rvg_odb_logging_on');
|
251 |
if(!$rvg_odb_logging_on) $rvg_odb_logging_on = 'N';
|
@@ -288,13 +329,15 @@ function schedule_changed()
|
|
288 |
<strong><a href="http://wordpress.org/extend/plugins/rvg-optimize-database/" target="_blank">http://wordpress.org/extend/plugins/rvg-optimize-database/</a></strong></p>
|
289 |
<p> </p>
|
290 |
</blockquote>
|
291 |
-
<h2><?php echo __('Optimize Database after Deleting Revisions -
|
292 |
<?php
|
293 |
if($rvg_odb_adminbar == 'Y') $rvg_odb_adminbar_checked = ' checked="checked"'; else $rvg_odb_adminbar_checked = '';
|
294 |
if($rvg_clear_trash == 'Y') $rvg_clear_trash_checked = ' checked="checked"'; else $rvg_clear_trash_checked = '';
|
295 |
if($rvg_clear_spam == 'Y') $rvg_clear_spam_checked = ' checked="checked"'; else $rvg_clear_spam_checked = '';
|
296 |
if($rvg_clear_tags == 'Y') $rvg_clear_tags_checked = ' checked="checked"'; else $rvg_clear_tags_checked = '';
|
297 |
if($rvg_clear_transients == 'Y') $rvg_clear_transients_checked = ' checked="checked"'; else $rvg_clear_transients_checked = '';
|
|
|
|
|
298 |
if($rvg_odb_logging_on == 'Y') $rvg_odb_logging_on_checked = ' checked="checked"'; else $rvg_odb_logging_on_checked = '';
|
299 |
?>
|
300 |
<blockquote>
|
@@ -323,6 +366,10 @@ if($rvg_odb_logging_on == 'Y') $rvg_odb_logging_on_checked = ' checked="checke
|
|
323 |
<td width="50%" align="right" valign="top"><span style="font-weight:bold;"><?php echo __('Delete expired transients','rvg-optimize-database');?></span></td>
|
324 |
<td width="50%" valign="top"><input name="rvg_clear_transients" type="checkbox" value="Y" <?php echo $rvg_clear_transients_checked?> /></td>
|
325 |
</tr>
|
|
|
|
|
|
|
|
|
326 |
<tr>
|
327 |
<td width="50%" align="right" valign="top"><span style="font-weight:bold;"><?php echo __('Keep a log','rvg-optimize-database');?></span></td>
|
328 |
<td width="50%" valign="top"><input name="rvg_odb_logging_on" type="checkbox" value="Y" <?php echo $rvg_odb_logging_on_checked?> /></td>
|
@@ -411,20 +458,20 @@ if($rvg_odb_logging_on == 'Y') $rvg_odb_logging_on_checked = ' checked="checke
|
|
411 |
</fieldset>
|
412 |
</blockquote>
|
413 |
<p class="submit">
|
414 |
-
<input class="button-primary button-large" type='submit' name='info_update' value='<?php echo __('Save
|
415 |
|
416 |
<input class="button" type="button" name="optimizer" value="<?php echo __('Go To Optimizer','rvg-optimize-database');?>" onclick="self.location='tools.php?page=rvg-optimize-db.php'" style="font-weight:normal;" />
|
417 |
</p>
|
418 |
</div>
|
419 |
</form>
|
420 |
<?php
|
421 |
-
} //
|
422 |
|
423 |
|
424 |
/********************************************************************************************
|
425 |
|
426 |
MAIN FUNCTION
|
427 |
-
FOR DELETING
|
428 |
|
429 |
*********************************************************************************************/
|
430 |
function rvg_optimize_db()
|
@@ -440,11 +487,11 @@ function rvg_optimize_db()
|
|
440 |
|
441 |
/****************************************************************************************
|
442 |
|
443 |
-
DELETE
|
444 |
|
445 |
******************************************************************************************/
|
446 |
|
447 |
-
// GET
|
448 |
$max_revisions = get_option('rvg_odb_number');
|
449 |
if(!$max_revisions)
|
450 |
{ $max_revisions = 0;
|
@@ -479,6 +526,14 @@ function rvg_optimize_db()
|
|
479 |
}
|
480 |
$clear_transients_yn = ($clear_transients == 'N') ? __('NO','rvg-optimize-database') : __('YES','rvg-optimize-database');
|
481 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
482 |
$rvg_odb_logging_on = get_option('rvg_odb_logging_on');
|
483 |
if(!$rvg_odb_logging_on)
|
484 |
{ $rvg_odb_logging_on = 'N';
|
@@ -532,12 +587,13 @@ function rvg_optimize_db()
|
|
532 |
echo '<div class="updated" style="position:relative;left:-15px;"><p><strong>Optimize Database after Deleting Revisions - LOG FILE DELETED</strong></p></div>';
|
533 |
?>
|
534 |
<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 $odb_version?></a> - <?php echo __('A WordPress Plugin by','rvg-optimize-database');?> <a href="http://cagewebdev.com/" target="_blank" style="font-weight:bold;">CAGE Web Design</a> | <a href="http://rvg.cage.nl/" target="_blank" style="font-weight:bold;">Rolf van Gelder</a>, Eindhoven, <?php echo __('The Netherlands','rvg-optimize-database');?></span></p>
|
535 |
-
<p><?php echo __('Current
|
536 |
<strong><?php echo __('Maximum number of - most recent - revisions to keep per post / page','rvg-optimize-database');?>:</strong> <span style="font-weight:bold;color:#00F;"><?php echo $max_revisions?></span><br />
|
537 |
<strong><?php echo __('Delete all trashed items','rvg-optimize-database');?>:</strong> <span style="font-weight:bold;color:#00F;"><?php echo $clear_trash_yn?></span><br />
|
538 |
<strong><?php echo __('Delete all spammed items','rvg-optimize-database');?>:</strong> <span style="font-weight:bold;color:#00F;"><?php echo $clear_spam_yn?></span><br />
|
539 |
<strong><?php echo __('Delete unused tags','rvg-optimize-database');?>:</strong> <span style="font-weight:bold;color:#00F;"><?php echo $clear_tags_yn?></span><br />
|
540 |
<strong><?php echo __('Delete expired transients','rvg-optimize-database');?>:</strong> <span style="font-weight:bold;color:#00F;"><?php echo $clear_transients_yn?></span><br />
|
|
|
541 |
<strong><?php echo __('Keep a log','rvg-optimize-database');?>:</strong> <span style="font-weight:bold;color:#00F;"><?php echo $rvg_odb_logging_on_yn?></span><br />
|
542 |
<strong><?php echo __('Number of excluded tables','rvg-optimize-database');?>:</strong> <span style="font-weight:bold;color:#00F;"><?php echo $number_excluded?></span><br />
|
543 |
<strong><?php echo __('Scheduler','rvg-optimize-database');?>:</strong> <span style="font-weight:bold;color:#00F;"><?php echo $rvg_odb_schedule_txt?></span>
|
@@ -558,13 +614,13 @@ function rvg_optimize_db()
|
|
558 |
}
|
559 |
?>
|
560 |
<p class="submit">
|
561 |
-
<input class="button" type="button" name="change_options" value="<?php echo __('Change
|
562 |
<?php
|
563 |
if(file_exists(dirname(__FILE__).'/rvg-optimize-db-log.html'))
|
564 |
{
|
565 |
?>
|
566 |
|
567 |
-
<input class="button" type="button" name="view_log" value="<?php echo __('View Log File','rvg-optimize-database');?>" onclick="window.open('<?php echo $log_url?>'
|
568 |
|
569 |
<input class="button" type="button" name="delete_log" value="<?php echo __('Delete Log File','rvg-optimize-database');?>" onclick="self.location='tools.php?page=rvg-optimize-db.php&action=delete_log'" style="font-weight:normal;" />
|
570 |
<?php
|
@@ -811,6 +867,45 @@ function rvg_optimize_db()
|
|
811 |
|
812 |
// NUMBER OF transients DELETED FOR LOG FILE
|
813 |
$log_arr["transients"] = $total_deleted;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
814 |
|
815 |
/****************************************************************************************
|
816 |
|
@@ -919,7 +1014,7 @@ function rvg_optimize_db()
|
|
919 |
{
|
920 |
?>
|
921 |
|
922 |
-
<input class="button" type="button" name="view_log" value="<?php echo __('View Log File','rvg-optimize-database');?>" onclick="window.open('<?php echo $log_url?>'
|
923 |
|
924 |
<input class="button" type="button" name="delete_log" value="<?php echo __('Delete Log File','rvg-optimize-database');?>" onclick="self.location='tools.php?page=rvg-optimize-db.php&action=delete_log'" style="font-weight:normal;" />
|
925 |
<?php
|
@@ -936,7 +1031,7 @@ function rvg_optimize_db_cron()
|
|
936 |
{
|
937 |
global $wpdb, $odb_version, $table_prefix;
|
938 |
|
939 |
-
// GET
|
940 |
$max_revisions = get_option('rvg_odb_number');
|
941 |
if(!$max_revisions)
|
942 |
{ $max_revisions = 0;
|
@@ -967,6 +1062,13 @@ function rvg_optimize_db_cron()
|
|
967 |
update_option('rvg_clear_transients', $clear_transients);
|
968 |
}
|
969 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
970 |
// GET THE SIZE OF THE DATABASE BEFORE OPTIMIZATION
|
971 |
$start_size = rvg_get_db_size();
|
972 |
|
@@ -1023,12 +1125,20 @@ function rvg_optimize_db_cron()
|
|
1023 |
$log_arr["tags"] = $total_deleted;
|
1024 |
|
1025 |
if($clear_transients == "Y")
|
1026 |
-
{ // DELETE
|
1027 |
$total_deleted = rvg_delete_transients();
|
1028 |
}
|
1029 |
|
1030 |
// NUMBER OF DELETED TAGS FOR LOG FILE
|
1031 |
$log_arr["transients"] = $total_deleted;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1032 |
|
1033 |
// DELETE ORPHANS
|
1034 |
$total_deleted = rvg_delete_orphans(false);
|
@@ -1323,6 +1433,51 @@ function rvg_delete_transients()
|
|
1323 |
} // rvg_delete_transients ()
|
1324 |
|
1325 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1326 |
/********************************************************************************************
|
1327 |
|
1328 |
DELETE ORPHAN POSTMETA RECORDS
|
@@ -1493,17 +1648,18 @@ td {
|
|
1493 |
</div>
|
1494 |
<table width="100%" border="0" cellspacing="6" cellpadding="1">
|
1495 |
<tr>
|
1496 |
-
<th width="
|
1497 |
-
<th width="
|
1498 |
-
<th width="
|
1499 |
-
<th width="
|
1500 |
-
<th width="
|
1501 |
-
<th width="
|
1502 |
-
<th width="
|
1503 |
-
<th width="
|
1504 |
-
<th width="
|
1505 |
-
<th width="
|
1506 |
-
<th width="
|
|
|
1507 |
</tr>
|
1508 |
</table>
|
1509 |
';
|
@@ -1515,17 +1671,18 @@ td {
|
|
1515 |
$html = '
|
1516 |
<table width="100%" border="0" cellspacing="6" cellpadding="0">
|
1517 |
<tr>
|
1518 |
-
<td width="
|
1519 |
-
<td width="
|
1520 |
-
<td width="
|
1521 |
-
<td width="
|
1522 |
-
<td width="
|
1523 |
-
<td width="
|
1524 |
-
<td width="
|
1525 |
-
<td width="
|
1526 |
-
<td width="
|
1527 |
-
<td width="
|
1528 |
-
<td width="
|
|
|
1529 |
</tr>
|
1530 |
</table>
|
1531 |
';
|
1 |
<?php
|
2 |
+
$odb_version = '3.1';
|
3 |
+
$odb_release_date = '01/29/2015';
|
4 |
/**
|
5 |
* @package Optimize Database after Deleting Revisions
|
6 |
+
* @version 3.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 Cleaning it out
|
12 |
Author: CAGE Web Design | Rolf van Gelder, Eindhoven, The Netherlands
|
13 |
+
Version: 3.1
|
14 |
Author URI: http://cagewebdev.com
|
15 |
*/
|
16 |
|
47 |
|
48 |
/********************************************************************************************
|
49 |
|
50 |
+
ADD THE 'OPTIMIZE DB SETTINGS' ITEM TO THE SETTINGS MENU
|
51 |
|
52 |
*********************************************************************************************/
|
53 |
function rvg_odb_admin_menu()
|
54 |
{
|
55 |
if (function_exists('add_options_page'))
|
56 |
+
{ add_options_page(__('Optimize DB Settings'), __('Optimize DB Settings','rvg-optimize-database'), 'manage_options', 'rvg_odb_admin', 'rvg_odb_settings_page');
|
57 |
}
|
58 |
}
|
59 |
add_action( 'admin_menu', 'rvg_odb_admin_menu' );
|
60 |
|
61 |
|
62 |
+
/********************************************************************************************
|
63 |
+
*
|
64 |
+
* SHOW A LINK TO THE PLUGIN SETTINGS ON THE MAIN PLUGINS PAGE (v3.1)
|
65 |
+
*
|
66 |
+
*********************************************************************************************/
|
67 |
+
function odb_settings_link($links)
|
68 |
+
{
|
69 |
+
array_unshift($links, '<a href="options-general.php?page=rvg_odb_admin">Settings</a>');
|
70 |
+
return $links;
|
71 |
+
} // gae_settings_link()
|
72 |
+
add_filter('plugin_action_links_'.plugin_basename(__FILE__), 'odb_settings_link' );
|
73 |
+
|
74 |
+
|
75 |
/********************************************************************************************
|
76 |
|
77 |
ADD THE '1 CLICK OPTIMIZE DATABASE' ITEM TO THE ADMIN BAR (IF ACTIVATED)
|
87 |
if($rvg_odb_adminbar == "Y") add_action( 'wp_before_admin_bar_render', 'rvg_odb_admin_bar' );
|
88 |
|
89 |
|
90 |
+
/********************************************************************************************
|
91 |
+
*
|
92 |
+
* PUT CREDITS TO THE HEADER
|
93 |
+
*
|
94 |
+
*********************************************************************************************/
|
95 |
+
function rvg_odb_credits()
|
96 |
+
{
|
97 |
+
global $odb_version;
|
98 |
+
|
99 |
+
echo '
|
100 |
+
<!-- Using "Optimize Database after Deleting Revisions" v'.$odb_version.' - http://cagewebdev.com/index.php/optimize-database-after-deleting-revisions-wordpress-plugin -->
|
101 |
+
<!-- Download from: http://wordpress.org/plugins/rvg-optimize-database/ -->
|
102 |
+
|
103 |
+
';
|
104 |
+
}
|
105 |
+
add_action('wp_head', 'rvg_odb_credits');
|
106 |
+
|
107 |
+
|
108 |
/********************************************************************************************
|
109 |
|
110 |
ACTIONS FOR THE SCHEDULER
|
145 |
|
146 |
/********************************************************************************************
|
147 |
|
148 |
+
CREATE THE SETTINGS PAGE
|
149 |
|
150 |
*********************************************************************************************/
|
151 |
+
function rvg_odb_settings_page()
|
152 |
{
|
153 |
global $odb_version, $odb_release_date, $wpdb, $table_prefix;
|
154 |
|
160 |
if(isset($_REQUEST['delete_log']))
|
161 |
if($_REQUEST['delete_log'] == "Y") @unlink(dirname(__FILE__).'/rvg-optimize-db-log.html');
|
162 |
|
163 |
+
// SAVE THE SETTINGS
|
164 |
if (isset($_POST['info_update']))
|
165 |
{
|
166 |
// v2.8.3
|
209 |
$rvg_clear_transients = $_POST['rvg_clear_transients'];
|
210 |
update_option('rvg_clear_transients', $rvg_clear_transients);
|
211 |
|
212 |
+
// v3.1
|
213 |
+
$rvg_clear_pingbacks = 'N';
|
214 |
+
if(isset($_POST['rvg_clear_pingbacks']))
|
215 |
+
$rvg_clear_pingbacks = $_POST['rvg_clear_pingbacks'];
|
216 |
+
update_option('rvg_clear_pingbacks', $rvg_clear_pingbacks);
|
217 |
+
|
218 |
$rvg_odb_adminbar = 'N';
|
219 |
if(isset($_POST['rvg_odb_adminbar']))
|
220 |
$rvg_odb_adminbar = $_POST['rvg_odb_adminbar'];
|
263 |
|
264 |
// UPDATED MESSAGE
|
265 |
echo "<div class='updated'><p><strong>".
|
266 |
+
__('Optimize Database after Deleting Revisions SETTINGS UPDATED','rvg-optimize-database').
|
267 |
"</strong> - ";
|
268 |
echo __('Click <a href="tools.php?page=rvg-optimize-db.php" style="font-weight:bold">HERE</a> to run the optimization','rvg-optimize-database');
|
269 |
echo "</p></div>";
|
283 |
|
284 |
$rvg_clear_transients = get_option('rvg_clear_transients');
|
285 |
if(!$rvg_clear_transients) $rvg_clear_transients = 'N';
|
286 |
+
|
287 |
+
// v3.1
|
288 |
+
$rvg_clear_pingbacks = get_option('rvg_clear_pingbacks');
|
289 |
+
if(!$rvg_clear_pingbacks) $rvg_clear_pingbacks = 'N';
|
290 |
|
291 |
$rvg_odb_logging_on = get_option('rvg_odb_logging_on');
|
292 |
if(!$rvg_odb_logging_on) $rvg_odb_logging_on = 'N';
|
329 |
<strong><a href="http://wordpress.org/extend/plugins/rvg-optimize-database/" target="_blank">http://wordpress.org/extend/plugins/rvg-optimize-database/</a></strong></p>
|
330 |
<p> </p>
|
331 |
</blockquote>
|
332 |
+
<h2><?php echo __('Optimize Database after Deleting Revisions - Settings','rvg-optimize-database');?></h2>
|
333 |
<?php
|
334 |
if($rvg_odb_adminbar == 'Y') $rvg_odb_adminbar_checked = ' checked="checked"'; else $rvg_odb_adminbar_checked = '';
|
335 |
if($rvg_clear_trash == 'Y') $rvg_clear_trash_checked = ' checked="checked"'; else $rvg_clear_trash_checked = '';
|
336 |
if($rvg_clear_spam == 'Y') $rvg_clear_spam_checked = ' checked="checked"'; else $rvg_clear_spam_checked = '';
|
337 |
if($rvg_clear_tags == 'Y') $rvg_clear_tags_checked = ' checked="checked"'; else $rvg_clear_tags_checked = '';
|
338 |
if($rvg_clear_transients == 'Y') $rvg_clear_transients_checked = ' checked="checked"'; else $rvg_clear_transients_checked = '';
|
339 |
+
// v3.1
|
340 |
+
if($rvg_clear_pingbacks == 'Y') $rvg_clear_pingbacks_checked = ' checked="checked"'; else $rvg_clear_pingbacks_checked = '';
|
341 |
if($rvg_odb_logging_on == 'Y') $rvg_odb_logging_on_checked = ' checked="checked"'; else $rvg_odb_logging_on_checked = '';
|
342 |
?>
|
343 |
<blockquote>
|
366 |
<td width="50%" align="right" valign="top"><span style="font-weight:bold;"><?php echo __('Delete expired transients','rvg-optimize-database');?></span></td>
|
367 |
<td width="50%" valign="top"><input name="rvg_clear_transients" type="checkbox" value="Y" <?php echo $rvg_clear_transients_checked?> /></td>
|
368 |
</tr>
|
369 |
+
<tr>
|
370 |
+
<td width="50%" align="right" valign="top"><span style="font-weight:bold;"><?php echo __('Delete pingbacks and trackbacks','rvg-optimize-database');?></span></td>
|
371 |
+
<td width="50%" valign="top"><input name="rvg_clear_pingbacks" type="checkbox" value="Y" <?php echo $rvg_clear_pingbacks_checked?> /></td>
|
372 |
+
</tr>
|
373 |
<tr>
|
374 |
<td width="50%" align="right" valign="top"><span style="font-weight:bold;"><?php echo __('Keep a log','rvg-optimize-database');?></span></td>
|
375 |
<td width="50%" valign="top"><input name="rvg_odb_logging_on" type="checkbox" value="Y" <?php echo $rvg_odb_logging_on_checked?> /></td>
|
458 |
</fieldset>
|
459 |
</blockquote>
|
460 |
<p class="submit">
|
461 |
+
<input class="button-primary button-large" type='submit' name='info_update' value='<?php echo __('Save Settings','rvg-optimize-database');?>' style="font-weight:bold;" />
|
462 |
|
463 |
<input class="button" type="button" name="optimizer" value="<?php echo __('Go To Optimizer','rvg-optimize-database');?>" onclick="self.location='tools.php?page=rvg-optimize-db.php'" style="font-weight:normal;" />
|
464 |
</p>
|
465 |
</div>
|
466 |
</form>
|
467 |
<?php
|
468 |
+
} // rvg_odb_settings_page ()
|
469 |
|
470 |
|
471 |
/********************************************************************************************
|
472 |
|
473 |
MAIN FUNCTION
|
474 |
+
FOR DELETING UNWANTED ITEMS AND OPTIMIZING DATABASE TABLES
|
475 |
|
476 |
*********************************************************************************************/
|
477 |
function rvg_optimize_db()
|
487 |
|
488 |
/****************************************************************************************
|
489 |
|
490 |
+
DELETE UNWANTED ITEMS
|
491 |
|
492 |
******************************************************************************************/
|
493 |
|
494 |
+
// GET SETTINGS AND SET DEFAULT VALUES
|
495 |
$max_revisions = get_option('rvg_odb_number');
|
496 |
if(!$max_revisions)
|
497 |
{ $max_revisions = 0;
|
526 |
}
|
527 |
$clear_transients_yn = ($clear_transients == 'N') ? __('NO','rvg-optimize-database') : __('YES','rvg-optimize-database');
|
528 |
|
529 |
+
// v3.1
|
530 |
+
$clear_pingbacks = get_option('rvg_clear_pingbacks');
|
531 |
+
if(!$clear_pingbacks)
|
532 |
+
{ $clear_pingbacks = 'N';
|
533 |
+
update_option('rvg_clear_pingbacks', $clear_pingbacks);
|
534 |
+
}
|
535 |
+
$clear_pingbacks_yn = ($clear_pingbacks == 'N') ? __('NO','rvg-optimize-database') : __('YES','rvg-optimize-database');
|
536 |
+
|
537 |
$rvg_odb_logging_on = get_option('rvg_odb_logging_on');
|
538 |
if(!$rvg_odb_logging_on)
|
539 |
{ $rvg_odb_logging_on = 'N';
|
587 |
echo '<div class="updated" style="position:relative;left:-15px;"><p><strong>Optimize Database after Deleting Revisions - LOG FILE DELETED</strong></p></div>';
|
588 |
?>
|
589 |
<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 $odb_version?></a> - <?php echo __('A WordPress Plugin by','rvg-optimize-database');?> <a href="http://cagewebdev.com/" target="_blank" style="font-weight:bold;">CAGE Web Design</a> | <a href="http://rvg.cage.nl/" target="_blank" style="font-weight:bold;">Rolf van Gelder</a>, Eindhoven, <?php echo __('The Netherlands','rvg-optimize-database');?></span></p>
|
590 |
+
<p><?php echo __('Current settings','rvg-optimize-database');?>:<br />
|
591 |
<strong><?php echo __('Maximum number of - most recent - revisions to keep per post / page','rvg-optimize-database');?>:</strong> <span style="font-weight:bold;color:#00F;"><?php echo $max_revisions?></span><br />
|
592 |
<strong><?php echo __('Delete all trashed items','rvg-optimize-database');?>:</strong> <span style="font-weight:bold;color:#00F;"><?php echo $clear_trash_yn?></span><br />
|
593 |
<strong><?php echo __('Delete all spammed items','rvg-optimize-database');?>:</strong> <span style="font-weight:bold;color:#00F;"><?php echo $clear_spam_yn?></span><br />
|
594 |
<strong><?php echo __('Delete unused tags','rvg-optimize-database');?>:</strong> <span style="font-weight:bold;color:#00F;"><?php echo $clear_tags_yn?></span><br />
|
595 |
<strong><?php echo __('Delete expired transients','rvg-optimize-database');?>:</strong> <span style="font-weight:bold;color:#00F;"><?php echo $clear_transients_yn?></span><br />
|
596 |
+
<strong><?php echo __('Delete pingbacks and trackbacks','rvg-optimize-database');?>:</strong> <span style="font-weight:bold;color:#00F;"><?php echo $clear_pingbacks_yn?></span><br />
|
597 |
<strong><?php echo __('Keep a log','rvg-optimize-database');?>:</strong> <span style="font-weight:bold;color:#00F;"><?php echo $rvg_odb_logging_on_yn?></span><br />
|
598 |
<strong><?php echo __('Number of excluded tables','rvg-optimize-database');?>:</strong> <span style="font-weight:bold;color:#00F;"><?php echo $number_excluded?></span><br />
|
599 |
<strong><?php echo __('Scheduler','rvg-optimize-database');?>:</strong> <span style="font-weight:bold;color:#00F;"><?php echo $rvg_odb_schedule_txt?></span>
|
614 |
}
|
615 |
?>
|
616 |
<p class="submit">
|
617 |
+
<input class="button" type="button" name="change_options" value="<?php echo __('Change Settings','rvg-optimize-database');?>" onclick="self.location='options-general.php?page=rvg_odb_admin'" style="font-weight:normal;" />
|
618 |
<?php
|
619 |
if(file_exists(dirname(__FILE__).'/rvg-optimize-db-log.html'))
|
620 |
{
|
621 |
?>
|
622 |
|
623 |
+
<input class="button" type="button" name="view_log" value="<?php echo __('View Log File','rvg-optimize-database');?>" onclick="window.open('<?php echo $log_url?>')" style="font-weight:normal;" />
|
624 |
|
625 |
<input class="button" type="button" name="delete_log" value="<?php echo __('Delete Log File','rvg-optimize-database');?>" onclick="self.location='tools.php?page=rvg-optimize-db.php&action=delete_log'" style="font-weight:normal;" />
|
626 |
<?php
|
867 |
|
868 |
// NUMBER OF transients DELETED FOR LOG FILE
|
869 |
$log_arr["transients"] = $total_deleted;
|
870 |
+
|
871 |
+
/****************************************************************************************
|
872 |
+
|
873 |
+
DELETE PINGBACKS AND TRACKBACKS (v3.1)
|
874 |
+
|
875 |
+
******************************************************************************************/
|
876 |
+
if($clear_pingbacks == 'Y')
|
877 |
+
{
|
878 |
+
// DELETE UNUSED TAGS
|
879 |
+
$total_deleted = rvg_delete_pingbacks();
|
880 |
+
|
881 |
+
if($total_deleted>0)
|
882 |
+
{ // PINGBACKS / TRACKBACKS DELETED
|
883 |
+
?>
|
884 |
+
<span style="font-weight:bold;color:#000;padding-left:8px;">~~~~~</span>
|
885 |
+
<table border="0" cellspacing="8" cellpadding="2">
|
886 |
+
<tr>
|
887 |
+
<td><span style="font-weight:bold;color:#00F;"><?php echo __('NUMBER OF PINGBACKS AND TRACKBACKS DELETED','rvg-optimize-database');?>:</span> <span style="font-weight:bold;"><?php echo $total_deleted;?></span></td>
|
888 |
+
</tr>
|
889 |
+
</table>
|
890 |
+
<?php
|
891 |
+
}
|
892 |
+
else
|
893 |
+
{
|
894 |
+
?>
|
895 |
+
<span style="font-weight:bold;color:#000;padding-left:8px;">~~~~~</span>
|
896 |
+
<table border="0" cellspacing="8" cellpadding="2">
|
897 |
+
<tr>
|
898 |
+
<td style="font-weight:bold;color:#21759b;"><?php echo __('No PINGBACKS nor TRACKBACKS found to delete','rvg-optimize-database');?>...</td>
|
899 |
+
</tr>
|
900 |
+
</table>
|
901 |
+
<?php
|
902 |
+
} // if(count($results)>0)
|
903 |
+
|
904 |
+
} // if($clear_pingbacks == 'Y')
|
905 |
+
|
906 |
+
// NUMBER OF pingbacks / trackbacks DELETED (FOR LOG FILE)
|
907 |
+
$log_arr["pingbacks"] = $total_deleted;
|
908 |
+
|
909 |
|
910 |
/****************************************************************************************
|
911 |
|
1014 |
{
|
1015 |
?>
|
1016 |
|
1017 |
+
<input class="button" type="button" name="view_log" value="<?php echo __('View Log File','rvg-optimize-database');?>" onclick="window.open('<?php echo $log_url?>')" style="font-weight:normal;" />
|
1018 |
|
1019 |
<input class="button" type="button" name="delete_log" value="<?php echo __('Delete Log File','rvg-optimize-database');?>" onclick="self.location='tools.php?page=rvg-optimize-db.php&action=delete_log'" style="font-weight:normal;" />
|
1020 |
<?php
|
1031 |
{
|
1032 |
global $wpdb, $odb_version, $table_prefix;
|
1033 |
|
1034 |
+
// GET SETTINGS AND SET DEFAULT VALUES
|
1035 |
$max_revisions = get_option('rvg_odb_number');
|
1036 |
if(!$max_revisions)
|
1037 |
{ $max_revisions = 0;
|
1062 |
update_option('rvg_clear_transients', $clear_transients);
|
1063 |
}
|
1064 |
|
1065 |
+
// v3.1
|
1066 |
+
$clear_pingbacks = get_option('rvg_clear_pingbacks');
|
1067 |
+
if(!$clear_pingbacks)
|
1068 |
+
{ $clear_pingbacks = 'N';
|
1069 |
+
update_option('rvg_clear_pingbacks', $clear_pingbacks);
|
1070 |
+
}
|
1071 |
+
|
1072 |
// GET THE SIZE OF THE DATABASE BEFORE OPTIMIZATION
|
1073 |
$start_size = rvg_get_db_size();
|
1074 |
|
1125 |
$log_arr["tags"] = $total_deleted;
|
1126 |
|
1127 |
if($clear_transients == "Y")
|
1128 |
+
{ // DELETE TRANSIENTS
|
1129 |
$total_deleted = rvg_delete_transients();
|
1130 |
}
|
1131 |
|
1132 |
// NUMBER OF DELETED TAGS FOR LOG FILE
|
1133 |
$log_arr["transients"] = $total_deleted;
|
1134 |
+
|
1135 |
+
// PINGBACKS AND TRACKBACKS (v3.1)
|
1136 |
+
if($clear_pingbacks == "Y")
|
1137 |
+
{ // DELETE PINGBACKS AND TRACKBACKS
|
1138 |
+
$total_deleted = rvg_delete_pingbacks();
|
1139 |
+
}
|
1140 |
+
// NUMBER OF DELETED PINGBACKS AND TRACKBACKS FOR LOG FILE
|
1141 |
+
$log_arr["pingbacks"] = $total_deleted;
|
1142 |
|
1143 |
// DELETE ORPHANS
|
1144 |
$total_deleted = rvg_delete_orphans(false);
|
1433 |
} // rvg_delete_transients ()
|
1434 |
|
1435 |
|
1436 |
+
/********************************************************************************************
|
1437 |
+
|
1438 |
+
DELETE PINGBACKS AND TRACKBACKS (v3.1)
|
1439 |
+
|
1440 |
+
*********************************************************************************************/
|
1441 |
+
function rvg_delete_pingbacks()
|
1442 |
+
{
|
1443 |
+
global $wpdb;
|
1444 |
+
|
1445 |
+
$total_deleted = 0;
|
1446 |
+
|
1447 |
+
$sql = "
|
1448 |
+
SELECT `comment_ID`
|
1449 |
+
FROM $wpdb->comments
|
1450 |
+
WHERE (
|
1451 |
+
`comment_type` = 'pingback'
|
1452 |
+
OR `comment_type` = 'trackback'
|
1453 |
+
)
|
1454 |
+
";
|
1455 |
+
|
1456 |
+
$results = $wpdb -> get_results($sql);
|
1457 |
+
$total_deleted = count($results);
|
1458 |
+
|
1459 |
+
for($i=0; $i<count($results); $i++)
|
1460 |
+
{ // DELETE METADATA FOR THIS COMMENT (IF ANY)
|
1461 |
+
$sql_delete_meta = "
|
1462 |
+
DELETE FROM $wpdb->commentmeta
|
1463 |
+
WHERE `comment_id` = ".$results[$i] -> comment_ID."
|
1464 |
+
";
|
1465 |
+
$wpdb -> get_results($sql_delete_meta);
|
1466 |
+
}
|
1467 |
+
|
1468 |
+
$sql_delete_comments = "
|
1469 |
+
DELETE FROM $wpdb->comments
|
1470 |
+
WHERE (
|
1471 |
+
`comment_type` = 'pingback'
|
1472 |
+
OR `comment_type` = 'trackback'
|
1473 |
+
)
|
1474 |
+
";
|
1475 |
+
$wpdb -> get_results($sql_delete_comments);
|
1476 |
+
|
1477 |
+
return $total_deleted;
|
1478 |
+
} // rvg_delete_pingbacks ()
|
1479 |
+
|
1480 |
+
|
1481 |
/********************************************************************************************
|
1482 |
|
1483 |
DELETE ORPHAN POSTMETA RECORDS
|
1648 |
</div>
|
1649 |
<table width="100%" border="0" cellspacing="6" cellpadding="1">
|
1650 |
<tr>
|
1651 |
+
<th width="8%" align="left" valign="top">'.__('time','rvg-optimize-database').'</th>
|
1652 |
+
<th width="8%" align="right" valign="top">'.__('deleted<br />revisions','rvg-optimize-database').'</th>
|
1653 |
+
<th width="8%" align="right" valign="top">'.__('deleted<br />trash','rvg-optimize-database').'</th>
|
1654 |
+
<th width="8%" align="right" valign="top">'.__('deleted<br />spam','rvg-optimize-database').'</th>
|
1655 |
+
<th width="8%" align="right" valign="top">'.__('deleted<br />tags','rvg-optimize-database').'</th>
|
1656 |
+
<th width="8%" align="right" valign="top">'.__('deleted<br />transients','rvg-optimize-database').'</th>
|
1657 |
+
<th width="8%" align="right" valign="top">'.__('deleted<br />pingbacks<br />trackbacks','rvg-optimize-database').'</th>
|
1658 |
+
<th width="8%" align="right" valign="top">'.__('deleted<br />orphans','rvg-optimize-database').'</th>
|
1659 |
+
<th width="8%" align="right" valign="top">'.__('nr of optimized tables','rvg-optimize-database').'</th>
|
1660 |
+
<th width="8%" align="right" valign="top">'.__('database size BEFORE','rvg-optimize-database').'</th>
|
1661 |
+
<th width="8%" align="right" valign="top">'.__('database size AFTER','rvg-optimize-database').'</th>
|
1662 |
+
<th width="8%" align="right" valign="top">'.__('SAVINGS','rvg-optimize-database').'</th>
|
1663 |
</tr>
|
1664 |
</table>
|
1665 |
';
|
1671 |
$html = '
|
1672 |
<table width="100%" border="0" cellspacing="6" cellpadding="0">
|
1673 |
<tr>
|
1674 |
+
<td width="8%" valign="top"><strong>'.$log_arr["time"].'</strong></td>
|
1675 |
+
<td width="8%" align="right" valign="top">'.$log_arr["revisions"].'</td>
|
1676 |
+
<td width="8%" align="right" valign="top">'.$log_arr["trash"].'</td>
|
1677 |
+
<td width="8%" align="right" valign="top">'.$log_arr["spam"].'</td>
|
1678 |
+
<td width="8%" align="right" valign="top">'.$log_arr["tags"].'</td>
|
1679 |
+
<td width="8%" align="right" valign="top">'.$log_arr["transients"].'</td>
|
1680 |
+
<td width="8%" align="right" valign="top">'.$log_arr["pingbacks"].'</td>
|
1681 |
+
<td width="8%" align="right" valign="top">'.$log_arr["orphans"].'</td>
|
1682 |
+
<td width="8%" align="right" valign="top">'.$log_arr["tables"].'</td>
|
1683 |
+
<td width="8%" align="right" valign="top">'.$log_arr["before"].'</td>
|
1684 |
+
<td width="8%" align="right" valign="top">'.$log_arr["after"].'</td>
|
1685 |
+
<td width="8%" align="right" valign="top">'.$log_arr["savings"].'</td>
|
1686 |
</tr>
|
1687 |
</table>
|
1688 |
';
|