Version Description
[02/20/2015] = * NEW: added plugin banners and icons * NEW: added a new admin menu item with icon ('Optimize Database') * CHANGE: moved the language files to the '/language' directory * CHANGE: moved the styles to the '/css' directory * CHANGE: credit removed from the front-end pages
Download this release
Release Info
Developer | cageehv |
Plugin | Optimize Database after Deleting Revisions |
Version | 3.1.1 |
Comparing to | |
See all releases |
Code changes from version 3.1 to 3.1.1
- css/style.css +52 -0
- images/icon.png +0 -0
- rvg-optimize-database-nl_NL.mo → language/rvg-optimize-database-nl_NL.mo +0 -0
- rvg-optimize-database-nl_NL.po → language/rvg-optimize-database-nl_NL.po +0 -0
- rvg-optimize-database-sr_RS.mo → language/rvg-optimize-database-sr_RS.mo +0 -0
- rvg-optimize-database-sr_RS.po → language/rvg-optimize-database-sr_RS.po +0 -0
- readme.txt +13 -6
- rvg-optimize-db.php +144 -174
css/style.css
ADDED
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
@charset "utf-8";
|
2 |
+
/* CSS Document */
|
3 |
+
|
4 |
+
.odb-bold {
|
5 |
+
font-weight: 900;
|
6 |
+
}
|
7 |
+
.odb-normal {
|
8 |
+
font-weight: normal;
|
9 |
+
}
|
10 |
+
.odb-italic {
|
11 |
+
font-style: italic;
|
12 |
+
}
|
13 |
+
.odb-blue {
|
14 |
+
color: #00F;
|
15 |
+
}
|
16 |
+
.odb-wp-table {
|
17 |
+
font-weight: bold;
|
18 |
+
color: #00F;
|
19 |
+
}
|
20 |
+
.odb-padding-left {
|
21 |
+
padding-left: 8px;
|
22 |
+
}
|
23 |
+
.odb-border-bottom {
|
24 |
+
border-bottom: solid 1px #999;
|
25 |
+
}
|
26 |
+
.odb-border-top {
|
27 |
+
border-top: solid 1px #999;
|
28 |
+
}
|
29 |
+
.odb-separator {
|
30 |
+
width: 100px;
|
31 |
+
height: 1px;
|
32 |
+
border-bottom: solid 1px #999;
|
33 |
+
margin-top: 16px;
|
34 |
+
margin-bottom: 14px;
|
35 |
+
margin-left: 10px;
|
36 |
+
}
|
37 |
+
.odb-underline-red {
|
38 |
+
text-decoration: underline;
|
39 |
+
color: #F00;
|
40 |
+
}
|
41 |
+
.odb-updated {
|
42 |
+
position: relative;
|
43 |
+
left: -15px;
|
44 |
+
}
|
45 |
+
.odb-found {
|
46 |
+
font-weight: bold;
|
47 |
+
color: #633;
|
48 |
+
}
|
49 |
+
.odb-not-found {
|
50 |
+
font-weight: bold;
|
51 |
+
color: #21759B;
|
52 |
+
}
|
images/icon.png
ADDED
Binary file
|
rvg-optimize-database-nl_NL.mo → language/rvg-optimize-database-nl_NL.mo
RENAMED
File without changes
|
rvg-optimize-database-nl_NL.po → language/rvg-optimize-database-nl_NL.po
RENAMED
File without changes
|
rvg-optimize-database-sr_RS.mo → language/rvg-optimize-database-sr_RS.mo
RENAMED
File without changes
|
rvg-optimize-database-sr_RS.po → language/rvg-optimize-database-sr_RS.po
RENAMED
File without changes
|
readme.txt
CHANGED
@@ -8,8 +8,8 @@ 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 ==
|
@@ -30,10 +30,10 @@ This plugin is a 'One Click' WordPress Database Cleaner / Optimizer.
|
|
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 »
|
34 |
|
35 |
= Starting the Optimization =
|
36 |
-
You can start the Optimization in the WP Admin Panel »
|
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 |
|
@@ -66,6 +66,13 @@ http://cagewebdev.com/index.php/wordpress-plugins/
|
|
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
|
@@ -242,10 +249,10 @@ http://cagewebdev.com/index.php/wordpress-plugins/
|
|
242 |
== Frequently Asked Questions ==
|
243 |
|
244 |
= How can I change the settings of this plugin? =
|
245 |
-
* WP Admin Panel »
|
246 |
|
247 |
= How do I run this plugin? =
|
248 |
-
* WP Admin Panel »
|
249 |
* Click the 'Optimize DB (1 click)' link in the Admin Bar (if enabled)
|
250 |
|
251 |
= Why do I see 'Table does not support optimize, doing recreate + analyze instead' while optimizing my database? =
|
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.1
|
12 |
+
Version: 3.1.1
|
13 |
License: GPLv2 or later
|
14 |
|
15 |
== Description ==
|
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 » Optimize Database.
|
34 |
|
35 |
= Starting the Optimization =
|
36 |
+
You can start the Optimization in the WP Admin Panel » 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 |
|
66 |
|
67 |
== Changelog ==
|
68 |
|
69 |
+
= 3.1.1 [02/20/2015] =
|
70 |
+
* NEW: added plugin banners and icons
|
71 |
+
* NEW: added a new admin menu item with icon ('Optimize Database')
|
72 |
+
* CHANGE: moved the language files to the '/language' directory
|
73 |
+
* CHANGE: moved the styles to the '/css' directory
|
74 |
+
* CHANGE: credit removed from the front-end pages
|
75 |
+
|
76 |
= 3.1 [01/29/2015] =
|
77 |
* NEW: deletion of pingbacks and trackbacks (optional)
|
78 |
* CHANGE: link to settings page in the main plugins page
|
249 |
== Frequently Asked Questions ==
|
250 |
|
251 |
= How can I change the settings of this plugin? =
|
252 |
+
* WP Admin Panel » Optimize Database. Then click the 'Change Settings'-button. There you can define the maximum number of - most recent - revisions you want to keep per post or page and some more settings.
|
253 |
|
254 |
= How do I run this plugin? =
|
255 |
+
* WP Admin Panel » Optimize Database. Then click the 'Start Optimization'-button.
|
256 |
* Click the 'Optimize DB (1 click)' link in the Admin Bar (if enabled)
|
257 |
|
258 |
= Why do I see 'Table does not support optimize, doing recreate + analyze instead' while optimizing my database? =
|
rvg-optimize-db.php
CHANGED
@@ -1,17 +1,17 @@
|
|
1 |
<?php
|
2 |
-
$odb_version = '3.1';
|
3 |
-
$odb_release_date = '
|
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 |
|
17 |
/********************************************************************************************
|
@@ -19,44 +19,25 @@ Author URI: http://cagewebdev.com
|
|
19 |
ADD THE LANGUAGE SUPPORT (LOCALIZATION)
|
20 |
|
21 |
*********************************************************************************************/
|
22 |
-
function
|
23 |
{
|
24 |
-
// TEXT DOMAIN
|
25 |
-
load_plugin_textdomain('rvg-optimize-database', false, dirname(plugin_basename(__FILE__)));
|
26 |
}
|
27 |
-
|
28 |
// INIT HOOK
|
29 |
-
add_action('init', '
|
30 |
-
|
31 |
-
|
32 |
-
/********************************************************************************************
|
33 |
-
|
34 |
-
ADD THE 'OPTIMIZE DATABASE' ITEM TO THE TOOLS MENU
|
35 |
-
|
36 |
-
*********************************************************************************************/
|
37 |
-
function optimize_db_main()
|
38 |
-
{ if (function_exists('add_management_page'))
|
39 |
-
{ # v2.8: 'administrator' role changed to 'edit_themes' capability
|
40 |
-
// add_management_page(__('Optimize Database'), __('Optimize Database'), 'edit_themes', 'rvg-optimize-db.php', 'rvg_optimize_db');
|
41 |
-
# v2.8.1: changed capability back to 'administrator'
|
42 |
-
add_management_page(__('Optimize Database','rvg-optimize-database'), __('Optimize Database','rvg-optimize-database'), 'administrator','rvg-optimize-db.php', 'rvg_optimize_db');
|
43 |
-
}
|
44 |
-
}
|
45 |
-
add_action('admin_menu', 'optimize_db_main');
|
46 |
|
47 |
|
48 |
/********************************************************************************************
|
49 |
|
50 |
-
ADD
|
51 |
|
52 |
*********************************************************************************************/
|
53 |
-
function
|
54 |
-
{
|
55 |
-
|
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', '
|
60 |
|
61 |
|
62 |
/********************************************************************************************
|
@@ -69,7 +50,7 @@ function odb_settings_link($links)
|
|
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 |
/********************************************************************************************
|
@@ -88,21 +69,14 @@ if($rvg_odb_adminbar == "Y") add_action( 'wp_before_admin_bar_render', 'rvg_odb_
|
|
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 |
-
|
|
|
|
|
|
|
|
|
106 |
|
107 |
|
108 |
/********************************************************************************************
|
@@ -262,10 +236,10 @@ function rvg_odb_settings_page()
|
|
262 |
}
|
263 |
|
264 |
// UPDATED MESSAGE
|
265 |
-
echo "<div class='updated'><p
|
266 |
__('Optimize Database after Deleting Revisions SETTINGS UPDATED','rvg-optimize-database').
|
267 |
-
"
|
268 |
-
echo __('Click <a href="tools.php?page=rvg-optimize-db.php"
|
269 |
echo "</p></div>";
|
270 |
}
|
271 |
|
@@ -315,18 +289,18 @@ function schedule_changed()
|
|
315 |
<div class="wrap">
|
316 |
<h2><?php echo __('Using Optimize Database after Deleting Revisions', 'rvg-optimize-database'); ?></h2>
|
317 |
<blockquote>
|
318 |
-
<p
|
319 |
<p><?php echo __('To start the optimization:','rvg-optimize-database');?><br />
|
320 |
-
<?php echo __('<
|
321 |
<?php echo __('Note: if you use the Scheduler the Optimization will run automatically!','rvg-optimize-database');?>
|
322 |
<p><?php echo __('Plugin version:','rvg-optimize-database');?><br />
|
323 |
-
<
|
324 |
-
<p><
|
325 |
-
<
|
326 |
-
<
|
327 |
-
<a href="http://cagewebdev.com/index.php/optimize-database-after-deleting-revisions-wordpress-plugin/" target="_blank"><
|
328 |
-
<
|
329 |
-
<
|
330 |
<p> </p>
|
331 |
</blockquote>
|
332 |
<h2><?php echo __('Optimize Database after Deleting Revisions - Settings','rvg-optimize-database');?></h2>
|
@@ -346,36 +320,36 @@ if($rvg_odb_logging_on == 'Y') $rvg_odb_logging_on_checked = ' checked="checke
|
|
346 |
<tr>
|
347 |
<td colspan="3" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="4">
|
348 |
<tr>
|
349 |
-
<td width="50%" align="right" valign="top"><span
|
350 |
<?php echo __('(\'0\' means: delete <u>ALL</u> revisions)','rvg-optimize-database');?></span></td>
|
351 |
-
<td width="50%" valign="top"><input type="text" size="5" name="rvg_odb_number" id="rvg_odb_number" value="<?php echo $rvg_odb_number?>"
|
352 |
</tr>
|
353 |
<tr>
|
354 |
-
<td width="50%" align="right" valign="top"><span
|
355 |
<td width="50%" valign="top"><input name="rvg_clear_trash" type="checkbox" value="Y" <?php echo $rvg_clear_trash_checked?> /></td>
|
356 |
</tr>
|
357 |
<tr>
|
358 |
-
<td width="50%" align="right" valign="top"><span
|
359 |
<td width="50%" valign="top"><input name="rvg_clear_spam" type="checkbox" value="Y" <?php echo $rvg_clear_spam_checked?> /></td>
|
360 |
</tr>
|
361 |
<tr>
|
362 |
-
<td width="50%" align="right" valign="top"><span
|
363 |
<td width="50%" valign="top"><input name="rvg_clear_tags" type="checkbox" value="Y" <?php echo $rvg_clear_tags_checked?> /></td>
|
364 |
</tr>
|
365 |
<tr>
|
366 |
-
<td width="50%" align="right" valign="top"><span
|
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
|
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
|
375 |
<td width="50%" valign="top"><input name="rvg_odb_logging_on" type="checkbox" value="Y" <?php echo $rvg_odb_logging_on_checked?> /></td>
|
376 |
</tr>
|
377 |
<tr>
|
378 |
-
<td width="50%" align="right"><span
|
379 |
<td width="50%"><select name="rvg_odb_schedule" id="rvg_odb_schedule" onchange="schedule_changed();">
|
380 |
<option selected="selected" value=""><?php echo __('NOT SCHEDULED','rvg-optimize-database');?></option>
|
381 |
<option value="hourly"><?php echo __('run optimization HOURLY','rvg-optimize-database');?></option>
|
@@ -387,7 +361,7 @@ if($rvg_odb_logging_on == 'Y') $rvg_odb_logging_on_checked = ' checked="checke
|
|
387 |
<script type="text/javascript">
|
388 |
document.options.rvg_odb_schedule.value = '<?php echo $rvg_odb_schedule; ?>';
|
389 |
</script>
|
390 |
-
<span id="schedulehour" style="display:none;"> <span
|
391 |
<select name="rvg_odb_schedulehour" id="rvg_odb_schedulehour">
|
392 |
<?php
|
393 |
for($i=0; $i<=23; $i++)
|
@@ -405,7 +379,7 @@ if($rvg_odb_logging_on == 'Y') $rvg_odb_logging_on_checked = ' checked="checke
|
|
405 |
<script type="text/javascript">schedule_changed();</script></td>
|
406 |
</tr>
|
407 |
<tr>
|
408 |
-
<td align="right" valign="top"><span
|
409 |
<td valign="top"><input name="rvg_odb_adminbar" type="checkbox" value="Y" <?php echo $rvg_odb_adminbar_checked?> />
|
410 |
<?php echo __('(change will be visible after loading the next page)','rvg-optimize-database');?></td>
|
411 |
</tr>
|
@@ -419,7 +393,7 @@ if($rvg_odb_logging_on == 'Y') $rvg_odb_logging_on_checked = ' checked="checke
|
|
419 |
<tr>
|
420 |
<td colspan="4" valign="top"><table id="table_list" width="100%" border="0" cellspacing="0" cellpadding="4" style="display:block;">
|
421 |
<tr>
|
422 |
-
<td colspan="4" align="center"><span
|
423 |
<a href="javascript:;" onclick="jQuery('[id^=cb_]').attr('checked',true);"><?php echo __('check all tables','rvg-optimize-database');?></a> | <a href="javascript:;" onclick="jQuery('[id^=cb_]').attr('checked',false);"><?php echo __('uncheck all tables','rvg-optimize-database');?></a> | <a href="javascript:;" onclick="jQuery(':not([id^=cb_<?php echo $table_prefix; ?>])').filter('[id^=cb_]').attr('checked',true);"><?php echo __('check all NON-WordPress tables','rvg-optimize-database');?></a></td>
|
424 |
</tr>
|
425 |
<tr>
|
@@ -435,9 +409,9 @@ if($rvg_odb_logging_on == 'Y') $rvg_odb_logging_on_checked = ' checked="checke
|
|
435 |
echo '</tr>';
|
436 |
echo '<tr>';
|
437 |
}
|
438 |
-
$
|
439 |
// WORDPRESS TABLE?
|
440 |
-
if(substr($tables[$i][0], 0, strlen($table_prefix)) == $table_prefix) $
|
441 |
|
442 |
$cb_checked = '';
|
443 |
$sql = "
|
@@ -448,7 +422,7 @@ if($rvg_odb_logging_on == 'Y') $rvg_odb_logging_on_checked = ' checked="checke
|
|
448 |
$results = $wpdb -> get_results($sql);
|
449 |
if(isset($results[0]->option_value))
|
450 |
if($results[0]->option_value == 'excluded') $cb_checked = ' checked';
|
451 |
-
echo '<td width="25%"
|
452 |
} # for ($i=0; $i<count($tables); $i++)
|
453 |
?>
|
454 |
</tr>
|
@@ -458,9 +432,9 @@ if($rvg_odb_logging_on == 'Y') $rvg_odb_logging_on_checked = ' checked="checke
|
|
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');?>'
|
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'"
|
464 |
</p>
|
465 |
</div>
|
466 |
</form>
|
@@ -579,50 +553,50 @@ function rvg_optimize_db()
|
|
579 |
$results = $wpdb -> get_results($sql);
|
580 |
$number_excluded = $results[0] -> cnt;
|
581 |
?>
|
582 |
-
<div
|
583 |
<h2><?php echo __('Optimize your WordPress Database','rvg-optimize-database');?></h2>
|
584 |
<?php
|
585 |
if(isset($_REQUEST['action']))
|
586 |
if($_REQUEST['action'] == "delete_log")
|
587 |
-
echo '<div class="updated"
|
588 |
?>
|
589 |
-
<p><span
|
590 |
<p><?php echo __('Current settings','rvg-optimize-database');?>:<br />
|
591 |
-
|
592 |
-
|
593 |
-
|
594 |
-
|
595 |
-
|
596 |
-
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
-
|
601 |
if($nextrun)
|
602 |
{
|
603 |
?>
|
604 |
-
|
605 |
-
|
606 |
-
|
607 |
}
|
608 |
if($total_savings)
|
609 |
{
|
610 |
?>
|
611 |
-
|
612 |
-
|
613 |
-
|
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'"
|
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?>')"
|
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'"
|
626 |
<?php
|
627 |
}
|
628 |
$action = '';
|
@@ -631,7 +605,7 @@ function rvg_optimize_db()
|
|
631 |
{
|
632 |
?>
|
633 |
|
634 |
-
<input class="button-primary button-large" type="button" name="start_optimization" value="<?php echo __('Start Optimization','rvg-optimize-database');?>" onclick="self.location='tools.php?page=rvg-optimize-db.php&action=run'"
|
635 |
<?php
|
636 |
}
|
637 |
?>
|
@@ -642,7 +616,7 @@ function rvg_optimize_db()
|
|
642 |
if(isset($_REQUEST['action'])) $action = $_REQUEST['action'];
|
643 |
if($action != 'run') return;
|
644 |
?>
|
645 |
-
<h2
|
646 |
<?php
|
647 |
// GET THE SIZE OF THE DATABASE BEFORE OPTIMIZATION
|
648 |
$start_size = rvg_get_db_size();
|
@@ -655,27 +629,27 @@ function rvg_optimize_db()
|
|
655 |
// FIND REVISIONS
|
656 |
$results = rvg_get_revisions($max_revisions);
|
657 |
|
658 |
-
$total_deleted = 0;
|
659 |
if(count($results)>0)
|
660 |
{ // WE HAVE REVISIONS TO DELETE!
|
661 |
?>
|
662 |
<table border="0" cellspacing="8" cellpadding="2">
|
663 |
<tr>
|
664 |
-
<td colspan="4"
|
665 |
</tr>
|
666 |
<tr>
|
667 |
-
<th align="right"
|
668 |
-
<th align="left"
|
669 |
-
<th align="left"
|
670 |
-
<th align="right"
|
671 |
</tr>
|
672 |
<?php
|
673 |
// LOOP THROUGH THE REVISIONS AND DELETE THEM
|
674 |
$total_deleted = rvg_delete_revisions($results, true, $max_revisions);
|
675 |
?>
|
676 |
<tr>
|
677 |
-
<td colspan="3" align="right"
|
678 |
-
<td align="right"
|
679 |
</tr>
|
680 |
</table>
|
681 |
<?php
|
@@ -685,7 +659,7 @@ function rvg_optimize_db()
|
|
685 |
?>
|
686 |
<table border="0" cellspacing="8" cellpadding="2">
|
687 |
<tr>
|
688 |
-
<td
|
689 |
</tr>
|
690 |
</table>
|
691 |
<?php
|
@@ -708,16 +682,16 @@ function rvg_optimize_db()
|
|
708 |
if(count($results)>0)
|
709 |
{ // WE HAVE TRASH TO DELETE!
|
710 |
?>
|
711 |
-
<
|
712 |
<table border="0" cellspacing="8" cellpadding="2">
|
713 |
<tr>
|
714 |
-
<td colspan="4"
|
715 |
</tr>
|
716 |
<tr>
|
717 |
-
<th align="right"
|
718 |
-
<th align="left"
|
719 |
-
<th align="left"
|
720 |
-
<th align="left" nowrap="nowrap"
|
721 |
</tr>
|
722 |
<?php
|
723 |
// LOOP THROUGH THE TRASHED ITEMS AND DELETE THEM
|
@@ -729,10 +703,10 @@ function rvg_optimize_db()
|
|
729 |
else
|
730 |
{
|
731 |
?>
|
732 |
-
<
|
733 |
<table border="0" cellspacing="8" cellpadding="2">
|
734 |
<tr>
|
735 |
-
<td
|
736 |
</tr>
|
737 |
</table>
|
738 |
<?php
|
@@ -757,16 +731,16 @@ function rvg_optimize_db()
|
|
757 |
if(count($results)>0)
|
758 |
{ // WE HAVE SPAM TO DELETE!
|
759 |
?>
|
760 |
-
<
|
761 |
<table border="0" cellspacing="8" cellpadding="2">
|
762 |
<tr>
|
763 |
-
<td colspan="4"
|
764 |
</tr>
|
765 |
<tr>
|
766 |
-
<th align="right"
|
767 |
-
<th align="left"
|
768 |
-
<th align="left"
|
769 |
-
<th align="left" nowrap="nowrap"
|
770 |
</tr>
|
771 |
<?php
|
772 |
// LOOP THROUGH SPAMMED ITEMS AND DELETE THEM
|
@@ -778,10 +752,10 @@ function rvg_optimize_db()
|
|
778 |
else
|
779 |
{
|
780 |
?>
|
781 |
-
<
|
782 |
<table border="0" cellspacing="8" cellpadding="2">
|
783 |
<tr>
|
784 |
-
<td
|
785 |
</tr>
|
786 |
</table>
|
787 |
<?php
|
@@ -805,10 +779,10 @@ function rvg_optimize_db()
|
|
805 |
if($total_deleted>0)
|
806 |
{ // TAGS DELETED
|
807 |
?>
|
808 |
-
<
|
809 |
<table border="0" cellspacing="8" cellpadding="2">
|
810 |
<tr>
|
811 |
-
<td><span
|
812 |
</tr>
|
813 |
</table>
|
814 |
<?php
|
@@ -816,10 +790,10 @@ function rvg_optimize_db()
|
|
816 |
else
|
817 |
{
|
818 |
?>
|
819 |
-
<
|
820 |
<table border="0" cellspacing="8" cellpadding="2">
|
821 |
<tr>
|
822 |
-
<td
|
823 |
</tr>
|
824 |
</table>
|
825 |
<?php
|
@@ -843,10 +817,10 @@ function rvg_optimize_db()
|
|
843 |
if($total_deleted>0)
|
844 |
{ // TRANSIENTS DELETED
|
845 |
?>
|
846 |
-
<
|
847 |
<table border="0" cellspacing="8" cellpadding="2">
|
848 |
<tr>
|
849 |
-
<td><span
|
850 |
</tr>
|
851 |
</table>
|
852 |
<?php
|
@@ -854,10 +828,10 @@ function rvg_optimize_db()
|
|
854 |
else
|
855 |
{
|
856 |
?>
|
857 |
-
<
|
858 |
<table border="0" cellspacing="8" cellpadding="2">
|
859 |
<tr>
|
860 |
-
<td
|
861 |
</tr>
|
862 |
</table>
|
863 |
<?php
|
@@ -881,10 +855,10 @@ function rvg_optimize_db()
|
|
881 |
if($total_deleted>0)
|
882 |
{ // PINGBACKS / TRACKBACKS DELETED
|
883 |
?>
|
884 |
-
<
|
885 |
<table border="0" cellspacing="8" cellpadding="2">
|
886 |
<tr>
|
887 |
-
<td><span
|
888 |
</tr>
|
889 |
</table>
|
890 |
<?php
|
@@ -892,10 +866,10 @@ function rvg_optimize_db()
|
|
892 |
else
|
893 |
{
|
894 |
?>
|
895 |
-
<
|
896 |
<table border="0" cellspacing="8" cellpadding="2">
|
897 |
<tr>
|
898 |
-
<td
|
899 |
</tr>
|
900 |
</table>
|
901 |
<?php
|
@@ -916,10 +890,10 @@ function rvg_optimize_db()
|
|
916 |
if($total_deleted)
|
917 |
{
|
918 |
?>
|
919 |
-
<
|
920 |
<table border="0" cellspacing="8" cellpadding="2">
|
921 |
<tr>
|
922 |
-
<td colspan="4"><span
|
923 |
</tr>
|
924 |
</table>
|
925 |
<?php
|
@@ -927,10 +901,10 @@ function rvg_optimize_db()
|
|
927 |
else
|
928 |
{
|
929 |
?>
|
930 |
-
<
|
931 |
<table border="0" cellspacing="8" cellpadding="2">
|
932 |
<tr>
|
933 |
-
<td
|
934 |
</tr>
|
935 |
</table>
|
936 |
<?php
|
@@ -944,18 +918,18 @@ function rvg_optimize_db()
|
|
944 |
|
945 |
******************************************************************************************/
|
946 |
?>
|
947 |
-
<
|
948 |
<table border="0" cellspacing="8" cellpadding="2">
|
949 |
<tr>
|
950 |
-
<td colspan="4"
|
951 |
</tr>
|
952 |
<tr>
|
953 |
-
<th
|
954 |
-
<th
|
955 |
-
<th
|
956 |
-
<th
|
957 |
-
<th
|
958 |
-
<th
|
959 |
</tr>
|
960 |
<?php
|
961 |
# OPTIMIZE THE DATABASE TABLES
|
@@ -979,44 +953,41 @@ function rvg_optimize_db()
|
|
979 |
$total_savings += ($start_size - $end_size);
|
980 |
update_option('rvg_odb_total_savings',$total_savings);
|
981 |
?>
|
982 |
-
<
|
|
|
983 |
<table border="0" cellspacing="8" cellpadding="2">
|
984 |
-
<tr>
|
985 |
-
<td colspan="2" style="font-weight:bold;color:#00F;"><?php echo __('SAVINGS','rvg-optimize-database');?>:</td>
|
986 |
-
</tr>
|
987 |
<tr>
|
988 |
<th> </th>
|
989 |
-
<th
|
990 |
</tr>
|
991 |
<tr>
|
992 |
<td align="right"><?php echo __('BEFORE optimization','rvg-optimize-database');?></td>
|
993 |
-
<td align="right"
|
994 |
</tr>
|
995 |
<tr>
|
996 |
<td align="right"><?php echo __('AFTER optimization','rvg-optimize-database');?></td>
|
997 |
-
<td align="right"
|
998 |
</tr>
|
999 |
<tr>
|
1000 |
-
<td align="right"
|
1001 |
-
<td align="right"
|
1002 |
</tr>
|
1003 |
<tr>
|
1004 |
-
<td align="right"
|
1005 |
-
<td align="right"
|
1006 |
</tr>
|
1007 |
</table>
|
1008 |
-
<
|
1009 |
-
<br />
|
1010 |
-
<span style="font-weight:bold;color:#00F;padding-left:8px;"><?php echo __('DONE','rvg-optimize-database');?>!</span><br />
|
1011 |
<br />
|
1012 |
<?php
|
1013 |
if(file_exists(dirname(__FILE__).'/rvg-optimize-db-log.html'))
|
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?>')"
|
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'"
|
1020 |
<?php
|
1021 |
}
|
1022 |
} // rvg_optimize_db ()
|
@@ -1187,7 +1158,7 @@ function rvg_delete_revisions($results, $display, $max_revisions)
|
|
1187 |
?>
|
1188 |
<tr>
|
1189 |
<td align="right" valign="top"><?php echo $nr?>.</td>
|
1190 |
-
<td valign="top"
|
1191 |
<td valign="top"><?php
|
1192 |
} // if($display)
|
1193 |
|
@@ -1216,7 +1187,7 @@ function rvg_delete_revisions($results, $display, $max_revisions)
|
|
1216 |
if($display)
|
1217 |
{
|
1218 |
?></td>
|
1219 |
-
<td align="right" valign="top"
|
1220 |
</tr>
|
1221 |
<?php
|
1222 |
} // if($display)
|
@@ -1577,7 +1548,7 @@ function rvg_optimize_tables($display)
|
|
1577 |
?>
|
1578 |
<tr>
|
1579 |
<td align="right" valign="top"><?php echo $cnt?>.</td>
|
1580 |
-
<td valign="top"
|
1581 |
<td valign="top"><?php echo $result[0]->Msg_text ?></td>
|
1582 |
<td valign="top"><?php echo $table_info[0]->engine ?></td>
|
1583 |
<td align="right" valign="top"><?php echo $table_info[0]->table_rows ?></td>
|
@@ -1643,8 +1614,8 @@ td {
|
|
1643 |
</head>
|
1644 |
<body>
|
1645 |
<div id="header">
|
1646 |
-
<h2><a href="
|
1647 |
-
'.__('A WordPress Plugin by','rvg-optimize-database').' <a href="http://cagewebdev.com" target="_blank"><
|
1648 |
</div>
|
1649 |
<table width="100%" border="0" cellspacing="6" cellpadding="1">
|
1650 |
<tr>
|
@@ -1664,14 +1635,13 @@ td {
|
|
1664 |
</table>
|
1665 |
';
|
1666 |
|
1667 |
-
// file_put_contents($file,'<strong><a href="http://cagewebdev.com/index.php/optimize-database-after-deleting-revisions-wordpress-plugin/" target="_blank" style="font-weight:bold;text-decoration:none;">Optimize Database after Deleting Revisions v'.$odb_version.'</a><br />A WordPress Plugin by <a href="http://cagewebdev.com" target="_blank" style="text-decoration:none;">CAGE Web Design | Rolf van Gelder</a>, Eindhoven, The Netherlands</strong><hr noshade="noshade" size="1">');
|
1668 |
file_put_contents($file,$html,FILE_APPEND);
|
1669 |
}
|
1670 |
|
1671 |
$html = '
|
1672 |
<table width="100%" border="0" cellspacing="6" cellpadding="0">
|
1673 |
<tr>
|
1674 |
-
<td width="8%" valign="top"><
|
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>
|
@@ -1801,4 +1771,4 @@ function rvg_format_size($size, $precision=1)
|
|
1801 |
|
1802 |
return $table_size;
|
1803 |
} // rvg_format_size ()
|
1804 |
-
?>
|
1 |
<?php
|
2 |
+
$odb_version = '3.1.1';
|
3 |
+
$odb_release_date = '02/20/2015';
|
4 |
/**
|
5 |
* @package Optimize Database after Deleting Revisions
|
6 |
+
* @version 3.1.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 |
Author URI: http://cagewebdev.com
|
14 |
+
Version: 3.1.1
|
15 |
*/
|
16 |
|
17 |
/********************************************************************************************
|
19 |
ADD THE LANGUAGE SUPPORT (LOCALIZATION)
|
20 |
|
21 |
*********************************************************************************************/
|
22 |
+
function rvg_odb_action_init()
|
23 |
{
|
24 |
+
// TEXT DOMAIN v3.1.1: language files moved to the '/language' directory
|
25 |
+
load_plugin_textdomain('rvg-optimize-database', false, dirname(plugin_basename(__FILE__)).'/language');
|
26 |
}
|
|
|
27 |
// INIT HOOK
|
28 |
+
add_action('init', 'rvg_odb_action_init');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
|
30 |
|
31 |
/********************************************************************************************
|
32 |
|
33 |
+
ADD A LINK TO THE ADMIN MENU (v3.1.1)
|
34 |
|
35 |
*********************************************************************************************/
|
36 |
+
function rvg_add_menu_page()
|
37 |
+
{
|
38 |
+
add_menu_page( __('Optimize Database','rvg-optimize-database'), __('Optimize Database','rvg-optimize-database'), 'administrator', 'rvg-optimize-db.php', 'rvg_optimize_db', plugins_url( 'rvg-optimize-database/images/icon.png' ), 81 );
|
|
|
|
|
39 |
}
|
40 |
+
add_action( 'admin_menu', 'rvg_add_menu_page' );
|
41 |
|
42 |
|
43 |
/********************************************************************************************
|
50 |
array_unshift($links, '<a href="options-general.php?page=rvg_odb_admin">Settings</a>');
|
51 |
return $links;
|
52 |
} // gae_settings_link()
|
53 |
+
add_filter('plugin_action_links_'.plugin_basename(__FILE__), 'odb_settings_link');
|
54 |
|
55 |
|
56 |
/********************************************************************************************
|
69 |
|
70 |
|
71 |
/********************************************************************************************
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
72 |
|
73 |
+
LOAD STYLE SHEETS (v3.1.1)
|
74 |
+
|
75 |
+
*********************************************************************************************/
|
76 |
+
function odb_styles()
|
77 |
+
{ wp_enqueue_style ('odb', plugin_dir_url(__FILE__) . 'css/style.css',false,'1.0','all');
|
78 |
+
} // wsc_styles()
|
79 |
+
add_action( 'admin_init', 'odb_styles' );
|
80 |
|
81 |
|
82 |
/********************************************************************************************
|
236 |
}
|
237 |
|
238 |
// UPDATED MESSAGE
|
239 |
+
echo "<div class='updated odb-bold'><p>".
|
240 |
__('Optimize Database after Deleting Revisions SETTINGS UPDATED','rvg-optimize-database').
|
241 |
+
" - ";
|
242 |
+
echo __('Click <a href="tools.php?page=rvg-optimize-db.php" class="odb-bold">HERE</a> to run the optimization','rvg-optimize-database');
|
243 |
echo "</p></div>";
|
244 |
}
|
245 |
|
289 |
<div class="wrap">
|
290 |
<h2><?php echo __('Using Optimize Database after Deleting Revisions', 'rvg-optimize-database'); ?></h2>
|
291 |
<blockquote>
|
292 |
+
<p class="odb-bold">'<span class="odb-italic">Optimize Database after Deleting Revisions</span> ' <?php echo __('is an one-click plugin to clean and optimize your WordPress database','rvg-optimize-database');?></p>
|
293 |
<p><?php echo __('To start the optimization:','rvg-optimize-database');?><br />
|
294 |
+
<?php echo __('<span class="odb-bold">WP Admin Panel</span> » <span class="odb-bold">Tools</span> » <span class="odb-bold">Optimize Database</span>. Then click the \'<span class="odb-bold">Start Optimization</span>\'-button. Et voila!','rvg-optimize-database');?><br />
|
295 |
<?php echo __('Note: if you use the Scheduler the Optimization will run automatically!','rvg-optimize-database');?>
|
296 |
<p><?php echo __('Plugin version:','rvg-optimize-database');?><br />
|
297 |
+
<span class="odb-bold">v<?php echo $odb_version ?> (<?php echo $odb_release_date?>)</span> </p>
|
298 |
+
<p><span class="odb-bold"><?php echo __('Author','rvg-optimize-database');?>:</span><br />
|
299 |
+
<span class="odb-bold"><a href="http://cagewebdev.com/" target="_blank">CAGE Web Design</a> | <a href="http://rvg.cage.nl/" target="_blank">Rolf van Gelder</a></span>, Eindhoven, <?php echo __('The Netherlands','rvg-optimize-database');?><br />
|
300 |
+
<span class="odb-bold"><?php echo __('Plugin URL:','rvg-optimize-database');?></class><br />
|
301 |
+
<a href="http://cagewebdev.com/index.php/optimize-database-after-deleting-revisions-wordpress-plugin/" target="_blank"><span class="odb-bold">http://cagewebdev.com/index.php/optimize-database-after-deleting-revisions-wordpress-plugin/</class></a><br />
|
302 |
+
<span class="odb-bold"><?php echo __('Download URL:','rvg-optimize-database');?></class><br />
|
303 |
+
<span class="odb-bold"><a href="https://wordpress.org/plugins/rvg-optimize-database/" target="_blank">https://wordpress.org/plugins/rvg-optimize-database/</a></class></p>
|
304 |
<p> </p>
|
305 |
</blockquote>
|
306 |
<h2><?php echo __('Optimize Database after Deleting Revisions - Settings','rvg-optimize-database');?></h2>
|
320 |
<tr>
|
321 |
<td colspan="3" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="4">
|
322 |
<tr>
|
323 |
+
<td width="50%" align="right" valign="top"><span class="odb-bold"><?php echo __('Maximum number of - most recent - revisions to keep per post / page','rvg-optimize-database');?><br />
|
324 |
<?php echo __('(\'0\' means: delete <u>ALL</u> revisions)','rvg-optimize-database');?></span></td>
|
325 |
+
<td width="50%" valign="top"><input type="text" size="5" name="rvg_odb_number" id="rvg_odb_number" value="<?php echo $rvg_odb_number?>" class="odb-bold odb-blue" /></td>
|
326 |
</tr>
|
327 |
<tr>
|
328 |
+
<td width="50%" align="right" valign="top"><span class="odb-bold"><?php echo __('Delete all trashed items','rvg-optimize-database');?></span></td>
|
329 |
<td width="50%" valign="top"><input name="rvg_clear_trash" type="checkbox" value="Y" <?php echo $rvg_clear_trash_checked?> /></td>
|
330 |
</tr>
|
331 |
<tr>
|
332 |
+
<td width="50%" align="right" valign="top"><span class="odb-bold"><?php echo __('Delete all spammed items','rvg-optimize-database');?></span></td>
|
333 |
<td width="50%" valign="top"><input name="rvg_clear_spam" type="checkbox" value="Y" <?php echo $rvg_clear_spam_checked?> /></td>
|
334 |
</tr>
|
335 |
<tr>
|
336 |
+
<td width="50%" align="right" valign="top"><span class="odb-bold"><?php echo __('Delete unused tags','rvg-optimize-database');?></span></td>
|
337 |
<td width="50%" valign="top"><input name="rvg_clear_tags" type="checkbox" value="Y" <?php echo $rvg_clear_tags_checked?> /></td>
|
338 |
</tr>
|
339 |
<tr>
|
340 |
+
<td width="50%" align="right" valign="top"><span class="odb-bold"><?php echo __('Delete expired transients','rvg-optimize-database');?></span></td>
|
341 |
<td width="50%" valign="top"><input name="rvg_clear_transients" type="checkbox" value="Y" <?php echo $rvg_clear_transients_checked?> /></td>
|
342 |
</tr>
|
343 |
<tr>
|
344 |
+
<td width="50%" align="right" valign="top"><span class="odb-bold"><?php echo __('Delete pingbacks and trackbacks','rvg-optimize-database');?></span></td>
|
345 |
<td width="50%" valign="top"><input name="rvg_clear_pingbacks" type="checkbox" value="Y" <?php echo $rvg_clear_pingbacks_checked?> /></td>
|
346 |
+
</tr>
|
347 |
<tr>
|
348 |
+
<td width="50%" align="right" valign="top"><span class="odb-bold"><?php echo __('Keep a log','rvg-optimize-database');?></span></td>
|
349 |
<td width="50%" valign="top"><input name="rvg_odb_logging_on" type="checkbox" value="Y" <?php echo $rvg_odb_logging_on_checked?> /></td>
|
350 |
</tr>
|
351 |
<tr>
|
352 |
+
<td width="50%" align="right"><span class="odb-bold"><?php echo __('Scheduler','rvg-optimize-database');?></span></td>
|
353 |
<td width="50%"><select name="rvg_odb_schedule" id="rvg_odb_schedule" onchange="schedule_changed();">
|
354 |
<option selected="selected" value=""><?php echo __('NOT SCHEDULED','rvg-optimize-database');?></option>
|
355 |
<option value="hourly"><?php echo __('run optimization HOURLY','rvg-optimize-database');?></option>
|
361 |
<script type="text/javascript">
|
362 |
document.options.rvg_odb_schedule.value = '<?php echo $rvg_odb_schedule; ?>';
|
363 |
</script>
|
364 |
+
<span id="schedulehour" style="display:none;"> <span class="odb-bold"><?php echo __('Time','rvg-optimize-database');?></span>
|
365 |
<select name="rvg_odb_schedulehour" id="rvg_odb_schedulehour">
|
366 |
<?php
|
367 |
for($i=0; $i<=23; $i++)
|
379 |
<script type="text/javascript">schedule_changed();</script></td>
|
380 |
</tr>
|
381 |
<tr>
|
382 |
+
<td align="right" valign="top"><span class="odb-bold"><?php echo __('Show \'1-click\' link in Admin Bar','rvg-optimize-database');?></span></td>
|
383 |
<td valign="top"><input name="rvg_odb_adminbar" type="checkbox" value="Y" <?php echo $rvg_odb_adminbar_checked?> />
|
384 |
<?php echo __('(change will be visible after loading the next page)','rvg-optimize-database');?></td>
|
385 |
</tr>
|
393 |
<tr>
|
394 |
<td colspan="4" valign="top"><table id="table_list" width="100%" border="0" cellspacing="0" cellpadding="4" style="display:block;">
|
395 |
<tr>
|
396 |
+
<td colspan="4" align="center"><span class="odb-bold"><?php echo __('EXCLUDE DATABASE TABLES FROM OPTIMIZATION: <span class="odb-underline-red">CHECKED</span> TABLES <span class="odb-underline-red">WON\'T</span> BE OPTIMIZED!</span>','rvg-optimize-database');?><br />
|
397 |
<a href="javascript:;" onclick="jQuery('[id^=cb_]').attr('checked',true);"><?php echo __('check all tables','rvg-optimize-database');?></a> | <a href="javascript:;" onclick="jQuery('[id^=cb_]').attr('checked',false);"><?php echo __('uncheck all tables','rvg-optimize-database');?></a> | <a href="javascript:;" onclick="jQuery(':not([id^=cb_<?php echo $table_prefix; ?>])').filter('[id^=cb_]').attr('checked',true);"><?php echo __('check all NON-WordPress tables','rvg-optimize-database');?></a></td>
|
398 |
</tr>
|
399 |
<tr>
|
409 |
echo '</tr>';
|
410 |
echo '<tr>';
|
411 |
}
|
412 |
+
$class = '';
|
413 |
// WORDPRESS TABLE?
|
414 |
+
if(substr($tables[$i][0], 0, strlen($table_prefix)) == $table_prefix) $class = 'class="odb-wp-table"';
|
415 |
|
416 |
$cb_checked = '';
|
417 |
$sql = "
|
422 |
$results = $wpdb -> get_results($sql);
|
423 |
if(isset($results[0]->option_value))
|
424 |
if($results[0]->option_value == 'excluded') $cb_checked = ' checked';
|
425 |
+
echo '<td width="25%" '.$class.'><input id="cb_'.$tables[$i][0].'" name="cb_'.$tables[$i][0].'" type="checkbox" value="1" '.$cb_checked.' /> '.$tables[$i][0].'</td>'."\n";
|
426 |
} # for ($i=0; $i<count($tables); $i++)
|
427 |
?>
|
428 |
</tr>
|
432 |
</fieldset>
|
433 |
</blockquote>
|
434 |
<p class="submit">
|
435 |
+
<input class="button-primary button-large" type='submit' name='info_update' value='<?php echo __('Save Settings','rvg-optimize-database');?>' class="odb-bold" />
|
436 |
|
437 |
+
<input class="button odb-normal" type="button" name="optimizer" value="<?php echo __('Go To Optimizer','rvg-optimize-database');?>" onclick="self.location='tools.php?page=rvg-optimize-db.php'" />
|
438 |
</p>
|
439 |
</div>
|
440 |
</form>
|
553 |
$results = $wpdb -> get_results($sql);
|
554 |
$number_excluded = $results[0] -> cnt;
|
555 |
?>
|
556 |
+
<div class="odb-padding-left">
|
557 |
<h2><?php echo __('Optimize your WordPress Database','rvg-optimize-database');?></h2>
|
558 |
<?php
|
559 |
if(isset($_REQUEST['action']))
|
560 |
if($_REQUEST['action'] == "delete_log")
|
561 |
+
echo '<div class="updated odb-updated"><p><span class="odb-bold">Optimize Database after Deleting Revisions - LOG FILE DELETED</class></p></div>';
|
562 |
?>
|
563 |
+
<p><span class="odb-italic"><a href="http://cagewebdev.com/index.php/optimize-database-after-deleting-revisions-wordpress-plugin/" target="_blank" class="odb-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" class="odb-bold">CAGE Web Design</a> | <a href="http://rvg.cage.nl/" target="_blank" class="odb-bold">Rolf van Gelder</a>, Eindhoven, <?php echo __('The Netherlands','rvg-optimize-database');?></span></p>
|
564 |
<p><?php echo __('Current settings','rvg-optimize-database');?>:<br />
|
565 |
+
<span class="odb-bold"><?php echo __('Maximum number of - most recent - revisions to keep per post / page','rvg-optimize-database');?>:</class> <span class="odb-bold odb-blue"><?php echo $max_revisions?></span><br />
|
566 |
+
<span class="odb-bold"><?php echo __('Delete all trashed items','rvg-optimize-database');?>:</class> <span class="odb-bold odb-blue"><?php echo $clear_trash_yn?></span><br />
|
567 |
+
<span class="odb-bold"><?php echo __('Delete all spammed items','rvg-optimize-database');?>:</class> <span class="odb-bold odb-blue"><?php echo $clear_spam_yn?></span><br />
|
568 |
+
<span class="odb-bold"><?php echo __('Delete unused tags','rvg-optimize-database');?>:</class> <span class="odb-bold odb-blue"><?php echo $clear_tags_yn?></span><br />
|
569 |
+
<span class="odb-bold"><?php echo __('Delete expired transients','rvg-optimize-database');?>:</class> <span class="odb-bold odb-blue"><?php echo $clear_transients_yn?></span><br />
|
570 |
+
<span class="odb-bold"><?php echo __('Delete pingbacks and trackbacks','rvg-optimize-database');?>:</class> <span class="odb-bold odb-blue"><?php echo $clear_pingbacks_yn?></span><br />
|
571 |
+
<span class="odb-bold"><?php echo __('Keep a log','rvg-optimize-database');?>:</class> <span class="odb-bold odb-blue"><?php echo $rvg_odb_logging_on_yn?></span><br />
|
572 |
+
<span class="odb-bold"><?php echo __('Number of excluded tables','rvg-optimize-database');?>:</class> <span class="odb-bold odb-blue"><?php echo $number_excluded?></span><br />
|
573 |
+
<span class="odb-bold"><?php echo __('Scheduler','rvg-optimize-database');?>:</class> <span class="odb-bold odb-blue"><?php echo $rvg_odb_schedule_txt?></span>
|
574 |
+
<?php
|
575 |
if($nextrun)
|
576 |
{
|
577 |
?>
|
578 |
+
<br />
|
579 |
+
<span class="odb-bold"><?php echo __('Next scheduled run','rvg-optimize-database');?>:</class> <span class="odb-bold odb-blue"><?php echo $nextrun?> hrs (current server time: <?php echo $current_hour?>)</span>
|
580 |
+
<?php
|
581 |
}
|
582 |
if($total_savings)
|
583 |
{
|
584 |
?>
|
585 |
+
<br />
|
586 |
+
<span class="odb-bold"><?php echo __('Total savings since the first run','rvg-optimize-database');?>:</class> <span class="odb-bold odb-blue"><?php echo rvg_format_size($total_savings); ?></span>
|
587 |
+
<?php
|
588 |
}
|
589 |
?>
|
590 |
<p class="submit">
|
591 |
+
<input class="button odb-normal" type="button" name="change_options" value="<?php echo __('Change Settings','rvg-optimize-database');?>" onclick="self.location='options-general.php?page=rvg_odb_admin'" />
|
592 |
<?php
|
593 |
if(file_exists(dirname(__FILE__).'/rvg-optimize-db-log.html'))
|
594 |
{
|
595 |
?>
|
596 |
|
597 |
+
<input class="button odb-normal" type="button" name="view_log" value="<?php echo __('View Log File','rvg-optimize-database');?>" onclick="window.open('<?php echo $log_url?>')" />
|
598 |
|
599 |
+
<input class="button odb-normal" 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'" />
|
600 |
<?php
|
601 |
}
|
602 |
$action = '';
|
605 |
{
|
606 |
?>
|
607 |
|
608 |
+
<input class="button-primary button-large" type="button" name="start_optimization" value="<?php echo __('Start Optimization','rvg-optimize-database');?>" onclick="self.location='tools.php?page=rvg-optimize-db.php&action=run'" class="odb-bold" />
|
609 |
<?php
|
610 |
}
|
611 |
?>
|
616 |
if(isset($_REQUEST['action'])) $action = $_REQUEST['action'];
|
617 |
if($action != 'run') return;
|
618 |
?>
|
619 |
+
<h2 class="odb-padding-left"><?php echo __('Starting Optimization','rvg-optimize-database');?>...</h2>
|
620 |
<?php
|
621 |
// GET THE SIZE OF THE DATABASE BEFORE OPTIMIZATION
|
622 |
$start_size = rvg_get_db_size();
|
629 |
// FIND REVISIONS
|
630 |
$results = rvg_get_revisions($max_revisions);
|
631 |
|
632 |
+
$total_deleted = 0;
|
633 |
if(count($results)>0)
|
634 |
{ // WE HAVE REVISIONS TO DELETE!
|
635 |
?>
|
636 |
<table border="0" cellspacing="8" cellpadding="2">
|
637 |
<tr>
|
638 |
+
<td colspan="4" class="odb-bold odb-blue"><?php echo __('DELETING REVISIONS','rvg-optimize-database');?>:</td>
|
639 |
</tr>
|
640 |
<tr>
|
641 |
+
<th align="right" class="odb-border-bottom">#</th>
|
642 |
+
<th align="left" class="odb-border-bottom"><?php echo __('post / page','rvg-optimize-database');?></th>
|
643 |
+
<th align="left" class="odb-border-bottom"><?php echo __('revision date','rvg-optimize-database');?></th>
|
644 |
+
<th align="right" class="odb-border-bottom"><?php echo __('revisions deleted','rvg-optimize-database');?></th>
|
645 |
</tr>
|
646 |
<?php
|
647 |
// LOOP THROUGH THE REVISIONS AND DELETE THEM
|
648 |
$total_deleted = rvg_delete_revisions($results, true, $max_revisions);
|
649 |
?>
|
650 |
<tr>
|
651 |
+
<td colspan="3" align="right" class="odb-border-top odb-bold"><?php echo __('total number of revisions deleted','rvg-optimize-database');?></td>
|
652 |
+
<td align="right" class="odb-border-top odb-bold"><?php echo $total_deleted?></td>
|
653 |
</tr>
|
654 |
</table>
|
655 |
<?php
|
659 |
?>
|
660 |
<table border="0" cellspacing="8" cellpadding="2">
|
661 |
<tr>
|
662 |
+
<td class="odb-not-found"><?php echo __('No REVISIONS found to delete','rvg-optimize-database');?>...</td>
|
663 |
</tr>
|
664 |
</table>
|
665 |
<?php
|
682 |
if(count($results)>0)
|
683 |
{ // WE HAVE TRASH TO DELETE!
|
684 |
?>
|
685 |
+
<div class="odb-separator"></div>
|
686 |
<table border="0" cellspacing="8" cellpadding="2">
|
687 |
<tr>
|
688 |
+
<td colspan="4" class="odb-found"><?php echo __('DELETING TRASHED ITEMS','rvg-optimize-database');?>:</td>
|
689 |
</tr>
|
690 |
<tr>
|
691 |
+
<th align="right" class="odb-border-bottom">#</th>
|
692 |
+
<th align="left" class="odb-border-bottom"><?php echo __('type','rvg-optimize-database');?></th>
|
693 |
+
<th align="left" class="odb-border-bottom"><?php echo __('IP address / title','rvg-optimize-database');?></th>
|
694 |
+
<th align="left" nowrap="nowrap" class="odb-border-bottom"><?php echo __('date','rvg-optimize-database');?></th>
|
695 |
</tr>
|
696 |
<?php
|
697 |
// LOOP THROUGH THE TRASHED ITEMS AND DELETE THEM
|
703 |
else
|
704 |
{
|
705 |
?>
|
706 |
+
<div class="odb-separator"></div>
|
707 |
<table border="0" cellspacing="8" cellpadding="2">
|
708 |
<tr>
|
709 |
+
<td class="odb-not-found"><?php echo __('No TRASHED ITEMS found to delete','rvg-optimize-database');?>...</td>
|
710 |
</tr>
|
711 |
</table>
|
712 |
<?php
|
731 |
if(count($results)>0)
|
732 |
{ // WE HAVE SPAM TO DELETE!
|
733 |
?>
|
734 |
+
<div class="odb-separator"></div>
|
735 |
<table border="0" cellspacing="8" cellpadding="2">
|
736 |
<tr>
|
737 |
+
<td colspan="4" class="odb-found"><?php echo __('DELETING SPAMMED ITEMS','rvg-optimize-database');?>:</td>
|
738 |
</tr>
|
739 |
<tr>
|
740 |
+
<th align="right" class="odb-border-bottom">#</th>
|
741 |
+
<th align="left" class="odb-border-bottom"><?php echo __('comment author','rvg-optimize-database');?></th>
|
742 |
+
<th align="left" class="odb-border-bottom"><?php echo __('comment author email','rvg-optimize-database');?></th>
|
743 |
+
<th align="left" nowrap="nowrap" class="odb-border-bottom"><?php echo __('comment date','rvg-optimize-database');?></th>
|
744 |
</tr>
|
745 |
<?php
|
746 |
// LOOP THROUGH SPAMMED ITEMS AND DELETE THEM
|
752 |
else
|
753 |
{
|
754 |
?>
|
755 |
+
<div class="odb-separator"></div>
|
756 |
<table border="0" cellspacing="8" cellpadding="2">
|
757 |
<tr>
|
758 |
+
<td class="odb-not-found"><?php echo __('No SPAMMED ITEMS found to delete','rvg-optimize-database');?>...</td>
|
759 |
</tr>
|
760 |
</table>
|
761 |
<?php
|
779 |
if($total_deleted>0)
|
780 |
{ // TAGS DELETED
|
781 |
?>
|
782 |
+
<div class="odb-separator"></div>
|
783 |
<table border="0" cellspacing="8" cellpadding="2">
|
784 |
<tr>
|
785 |
+
<td><span class="odb-found"><?php echo __('NUMBER OF UNUSED TAGS DELETED','rvg-optimize-database');?>:</span> <span class="odb-bold"><?php echo $total_deleted;?></span></td>
|
786 |
</tr>
|
787 |
</table>
|
788 |
<?php
|
790 |
else
|
791 |
{
|
792 |
?>
|
793 |
+
<div class="odb-separator"></div>
|
794 |
<table border="0" cellspacing="8" cellpadding="2">
|
795 |
<tr>
|
796 |
+
<td class="odb-not-found"><?php echo __('No UNUSED TAGS found to delete','rvg-optimize-database');?>...</td>
|
797 |
</tr>
|
798 |
</table>
|
799 |
<?php
|
817 |
if($total_deleted>0)
|
818 |
{ // TRANSIENTS DELETED
|
819 |
?>
|
820 |
+
<div class="odb-separator"></div>
|
821 |
<table border="0" cellspacing="8" cellpadding="2">
|
822 |
<tr>
|
823 |
+
<td><span class="odb-found"><?php echo __('NUMBER OF EXPIRED TRANSIENTS DELETED','rvg-optimize-database');?>:</span> <span class="odb-bold"><?php echo $total_deleted;?></span></td>
|
824 |
</tr>
|
825 |
</table>
|
826 |
<?php
|
828 |
else
|
829 |
{
|
830 |
?>
|
831 |
+
<div class="odb-separator"></div>
|
832 |
<table border="0" cellspacing="8" cellpadding="2">
|
833 |
<tr>
|
834 |
+
<td class="odb-not-found"><?php echo __('No EXPIRED TRANSIENTS found to delete','rvg-optimize-database');?>...</td>
|
835 |
</tr>
|
836 |
</table>
|
837 |
<?php
|
855 |
if($total_deleted>0)
|
856 |
{ // PINGBACKS / TRACKBACKS DELETED
|
857 |
?>
|
858 |
+
<div class="odb-separator"></div>
|
859 |
<table border="0" cellspacing="8" cellpadding="2">
|
860 |
<tr>
|
861 |
+
<td><span class="odb-found"><?php echo __('NUMBER OF PINGBACKS AND TRACKBACKS DELETED','rvg-optimize-database');?>:</span> <span class="odb-bold"><?php echo $total_deleted;?></span></td>
|
862 |
</tr>
|
863 |
</table>
|
864 |
<?php
|
866 |
else
|
867 |
{
|
868 |
?>
|
869 |
+
<div class="odb-separator"></div>
|
870 |
<table border="0" cellspacing="8" cellpadding="2">
|
871 |
<tr>
|
872 |
+
<td class="odb-not-found"><?php echo __('No PINGBACKS nor TRACKBACKS found to delete','rvg-optimize-database');?>...</td>
|
873 |
</tr>
|
874 |
</table>
|
875 |
<?php
|
890 |
if($total_deleted)
|
891 |
{
|
892 |
?>
|
893 |
+
<div class="odb-separator"></div>
|
894 |
<table border="0" cellspacing="8" cellpadding="2">
|
895 |
<tr>
|
896 |
+
<td colspan="4"><span class="odb-found"><?php echo __('NUMBER OF POSTMETA ORPHANS DELETED','rvg-optimize-database');?>:</span> <span class="odb-bold"><?php echo $total_deleted;?></span></td>
|
897 |
</tr>
|
898 |
</table>
|
899 |
<?php
|
901 |
else
|
902 |
{
|
903 |
?>
|
904 |
+
<div class="odb-separator"></div>
|
905 |
<table border="0" cellspacing="8" cellpadding="2">
|
906 |
<tr>
|
907 |
+
<td class="odb-not-found"><?php echo __('No POSTMETA ORPHANS found to delete','rvg-optimize-database');?>...</td>
|
908 |
</tr>
|
909 |
</table>
|
910 |
<?php
|
918 |
|
919 |
******************************************************************************************/
|
920 |
?>
|
921 |
+
<div class="odb-separator"></div>
|
922 |
<table border="0" cellspacing="8" cellpadding="2">
|
923 |
<tr>
|
924 |
+
<td colspan="4" class="odb-bold odb-blue"><?php echo __('OPTIMIZING DATABASE TABLES','rvg-optimize-database');?>:</td>
|
925 |
</tr>
|
926 |
<tr>
|
927 |
+
<th class="odb-border-bottom" align="right">#</th>
|
928 |
+
<th class="odb-border-bottom" align="left"><?php echo __('table name','rvg-optimize-database');?></th>
|
929 |
+
<th class="odb-border-bottom" align="left"><?php echo __('optimization result','rvg-optimize-database');?></th>
|
930 |
+
<th class="odb-border-bottom" align="left"><?php echo __('engine','rvg-optimize-database');?></th>
|
931 |
+
<th class="odb-border-bottom" align="right"><?php echo __('table rows','rvg-optimize-database');?></th>
|
932 |
+
<th class="odb-border-bottom" align="right"><?php echo __('table size','rvg-optimize-database');?></th>
|
933 |
</tr>
|
934 |
<?php
|
935 |
# OPTIMIZE THE DATABASE TABLES
|
953 |
$total_savings += ($start_size - $end_size);
|
954 |
update_option('rvg_odb_total_savings',$total_savings);
|
955 |
?>
|
956 |
+
<div class="odb-separator"></div>
|
957 |
+
<span class="odb-bold odb-blue odb-padding-left"><?php echo __('SAVINGS','rvg-optimize-database');?>!</span><br />
|
958 |
<table border="0" cellspacing="8" cellpadding="2">
|
|
|
|
|
|
|
959 |
<tr>
|
960 |
<th> </th>
|
961 |
+
<th class="odb-border-bottom"><?php echo __('size of the database','rvg-optimize-database');?></th>
|
962 |
</tr>
|
963 |
<tr>
|
964 |
<td align="right"><?php echo __('BEFORE optimization','rvg-optimize-database');?></td>
|
965 |
+
<td align="right" class="odb-bold"><?php echo rvg_format_size($start_size,3); ?></td>
|
966 |
</tr>
|
967 |
<tr>
|
968 |
<td align="right"><?php echo __('AFTER optimization','rvg-optimize-database');?></td>
|
969 |
+
<td align="right" class="odb-bold"><?php echo rvg_format_size($end_size,3); ?></td>
|
970 |
</tr>
|
971 |
<tr>
|
972 |
+
<td align="right" class="odb-bold"><?php echo __('SAVINGS THIS TIME','rvg-optimize-database');?></td>
|
973 |
+
<td align="right" class="odb-border-top odb-bold"><?php echo rvg_format_size(($start_size - $end_size),3); ?></td>
|
974 |
</tr>
|
975 |
<tr>
|
976 |
+
<td align="right" class="odb-bold"><?php echo __('TOTAL SAVINGS SINCE THE FIRST RUN','rvg-optimize-database');?></td>
|
977 |
+
<td align="right" class="odb-border-top odb-bold"><?php echo rvg_format_size($total_savings,3); ?></td>
|
978 |
</tr>
|
979 |
</table>
|
980 |
+
<div class="odb-separator"></div>
|
981 |
+
<span class="odb-bold odb-blue odb-padding-left"><?php echo __('DONE','rvg-optimize-database');?>!</span><br />
|
|
|
982 |
<br />
|
983 |
<?php
|
984 |
if(file_exists(dirname(__FILE__).'/rvg-optimize-db-log.html'))
|
985 |
{
|
986 |
?>
|
987 |
|
988 |
+
<input class="button odb-normal" type="button" name="view_log" value="<?php echo __('View Log File','rvg-optimize-database');?>" onclick="window.open('<?php echo $log_url?>')" />
|
989 |
|
990 |
+
<input class="button odb-normal" 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'" />
|
991 |
<?php
|
992 |
}
|
993 |
} // rvg_optimize_db ()
|
1158 |
?>
|
1159 |
<tr>
|
1160 |
<td align="right" valign="top"><?php echo $nr?>.</td>
|
1161 |
+
<td valign="top" class="odb-bold"><?php echo $results[$i]->post_title?></td>
|
1162 |
<td valign="top"><?php
|
1163 |
} // if($display)
|
1164 |
|
1187 |
if($display)
|
1188 |
{
|
1189 |
?></td>
|
1190 |
+
<td align="right" valign="top" class="odb-bold"><?php echo $nr_to_delete?></td>
|
1191 |
</tr>
|
1192 |
<?php
|
1193 |
} // if($display)
|
1548 |
?>
|
1549 |
<tr>
|
1550 |
<td align="right" valign="top"><?php echo $cnt?>.</td>
|
1551 |
+
<td valign="top" class="odb-bold"><?php echo $tables[$i][0] ?></td>
|
1552 |
<td valign="top"><?php echo $result[0]->Msg_text ?></td>
|
1553 |
<td valign="top"><?php echo $table_info[0]->engine ?></td>
|
1554 |
<td align="right" valign="top"><?php echo $table_info[0]->table_rows ?></td>
|
1614 |
</head>
|
1615 |
<body>
|
1616 |
<div id="header">
|
1617 |
+
<h2><a href="https://wordpress.org/plugins/rvg-optimize-database/" target="_blank">Optimize Database after Deleting Revisions v'.$odb_version.'</a></h2>
|
1618 |
+
'.__('A WordPress Plugin by','rvg-optimize-database').' <a href="http://cagewebdev.com" target="_blank"><span class="odb-bold">CAGE Web Design</class></a> | <a href="http://rvg.cage.nl" target="_blank"><span class="odb-bold">Rolf van Gelder</class></a>, Eindhoven, '.__('The Netherlands','rvg-optimize-database').'</class>
|
1619 |
</div>
|
1620 |
<table width="100%" border="0" cellspacing="6" cellpadding="1">
|
1621 |
<tr>
|
1635 |
</table>
|
1636 |
';
|
1637 |
|
|
|
1638 |
file_put_contents($file,$html,FILE_APPEND);
|
1639 |
}
|
1640 |
|
1641 |
$html = '
|
1642 |
<table width="100%" border="0" cellspacing="6" cellpadding="0">
|
1643 |
<tr>
|
1644 |
+
<td width="8%" valign="top"><span class="odb-bold">'.$log_arr["time"].'</class></td>
|
1645 |
<td width="8%" align="right" valign="top">'.$log_arr["revisions"].'</td>
|
1646 |
<td width="8%" align="right" valign="top">'.$log_arr["trash"].'</td>
|
1647 |
<td width="8%" align="right" valign="top">'.$log_arr["spam"].'</td>
|
1771 |
|
1772 |
return $table_size;
|
1773 |
} // rvg_format_size ()
|
1774 |
+
?>
|