Version Description
[08/03/2021] = * BUG FIX: Some performance inprovements (2nd try)
Download this release
Release Info
Developer | cageehv |
Plugin | Optimize Database after Deleting Revisions |
Version | 5.0.8 |
Comparing to | |
See all releases |
Code changes from version 5.0.7 to 5.0.8
- includes/settings-page.php +2 -4
- readme.txt +5 -2
- rvg-optimize-database.php +59 -48
includes/settings-page.php
CHANGED
@@ -388,11 +388,9 @@ echo '
|
|
388 |
<option value="monthly">
|
389 |
'.__('run optimization MONTHLY',$this->odb_txt_domain).'
|
390 |
</option>
|
391 |
-
|
392 |
-
<option value="fiveminutes">
|
393 |
'.__('run optimization EVERY FIVE MINUTES',$this->odb_txt_domain).'
|
394 |
-
</option
|
395 |
-
-->
|
396 |
</select>
|
397 |
<script type="text/javascript">
|
398 |
jQuery("#rvg_odb_schedule").val("'.$this->odb_rvg_options['schedule_type'].'");
|
388 |
<option value="monthly">
|
389 |
'.__('run optimization MONTHLY',$this->odb_txt_domain).'
|
390 |
</option>
|
391 |
+
<!-- <option value="fiveminutes">
|
|
|
392 |
'.__('run optimization EVERY FIVE MINUTES',$this->odb_txt_domain).'
|
393 |
+
</option>-->
|
|
|
394 |
</select>
|
395 |
<script type="text/javascript">
|
396 |
jQuery("#rvg_odb_schedule").val("'.$this->odb_rvg_options['schedule_type'].'");
|
readme.txt
CHANGED
@@ -10,8 +10,8 @@ Contributors: cageehv
|
|
10 |
Requires at least: 2.8
|
11 |
Requires PHP: 5.0
|
12 |
Tested up to: 5.8
|
13 |
-
Stable tag: 5.0.
|
14 |
-
Version: 5.0.
|
15 |
License: GPLv2 or later
|
16 |
|
17 |
== Description ==
|
@@ -111,6 +111,9 @@ http://cagewebdev.com/category/news-tech-art/wordpress/
|
|
111 |
* If you run the plugin from any of the sites, it will cleanup ALL the sites in the network!
|
112 |
|
113 |
== Changelog ==
|
|
|
|
|
|
|
114 |
= 5.0.7 [07/24/2021] =
|
115 |
* BUG FIX: Changed back to v5.0.4
|
116 |
|
10 |
Requires at least: 2.8
|
11 |
Requires PHP: 5.0
|
12 |
Tested up to: 5.8
|
13 |
+
Stable tag: 5.0.8
|
14 |
+
Version: 5.0.8
|
15 |
License: GPLv2 or later
|
16 |
|
17 |
== Description ==
|
111 |
* If you run the plugin from any of the sites, it will cleanup ALL the sites in the network!
|
112 |
|
113 |
== Changelog ==
|
114 |
+
= 5.0.8 [08/03/2021] =
|
115 |
+
* BUG FIX: Some performance inprovements (2nd try)
|
116 |
+
|
117 |
= 5.0.7 [07/24/2021] =
|
118 |
* BUG FIX: Changed back to v5.0.4
|
119 |
|
rvg-optimize-database.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* @package Optimize Database after Deleting Revisions
|
4 |
-
* @version 5.0.
|
5 |
*/
|
6 |
/*
|
7 |
Plugin Name: Optimize Database after Deleting Revisions
|
@@ -10,7 +10,7 @@ Description: Optimizes the Wordpress Database after Cleaning it out
|
|
10 |
Author: CAGE Web Design | Rolf van Gelder, Eindhoven, The Netherlands
|
11 |
Author URI: http://cagewebdev.com
|
12 |
Network: True
|
13 |
-
Version: 5.0.
|
14 |
*/
|
15 |
|
16 |
/********************************************************************************************
|
@@ -28,8 +28,8 @@ $odb_class = new OptimizeDatabase();
|
|
28 |
|
29 |
class OptimizeDatabase {
|
30 |
// VERSION
|
31 |
-
var $odb_version = '5.0.
|
32 |
-
var $odb_release_date = '
|
33 |
|
34 |
// PLUGIN OPTIONS
|
35 |
var $odb_rvg_options = array();
|
@@ -92,50 +92,15 @@ class OptimizeDatabase {
|
|
92 |
* INITIALIZE PLUGIN
|
93 |
*******************************************************************************/
|
94 |
function odb_init() {
|
95 |
-
global $wpdb;
|
96 |
-
|
97 |
// LOAD CLASSES
|
98 |
$this->odb_classes();
|
99 |
|
100 |
// URLS AND DIRECTORIES
|
101 |
$this->odb_urls_dirs();
|
102 |
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
$this->odb_logtable_name = $wpdb->base_prefix . 'odb_logs';
|
107 |
-
|
108 |
-
$found = false;
|
109 |
-
for($i = 0; $i < count($this->odb_tables); $i++) {
|
110 |
-
if ($this->odb_tables[$i][0] == $this->odb_logtable_name) {
|
111 |
-
$found = true;
|
112 |
-
}
|
113 |
-
} // for($i = 0; $i < count($this->odb_tables); $i++)
|
114 |
-
|
115 |
-
// v5.0.3
|
116 |
-
if (!$found) {
|
117 |
-
$sql = '
|
118 |
-
CREATE TABLE IF NOT EXISTS `' . $this->odb_logtable_name . '` (
|
119 |
-
`odb_id` int(11) NOT NULL AUTO_INCREMENT,
|
120 |
-
`odb_timestamp` varchar(20) NOT NULL,
|
121 |
-
`odb_revisions` int(11) NOT NULL,
|
122 |
-
`odb_trash` int(11) NOT NULL,
|
123 |
-
`odb_spam` int(11) NOT NULL,
|
124 |
-
`odb_tags` int(11) NOT NULL,
|
125 |
-
`odb_transients` int(11) NOT NULL,
|
126 |
-
`odb_pingbacks` int(11) NOT NULL,
|
127 |
-
`odb_oembeds` int(11) NOT NULL,
|
128 |
-
`odb_orphans` int(11) NOT NULL,
|
129 |
-
`odb_tables` int(11) NOT NULL,
|
130 |
-
`odb_before` varchar(20) NOT NULL,
|
131 |
-
`odb_after` varchar(20) NOT NULL,
|
132 |
-
`odb_savings` varchar(20) NOT NULL,
|
133 |
-
PRIMARY KEY (`odb_id`)
|
134 |
-
) DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;
|
135 |
-
';
|
136 |
-
|
137 |
-
// CREATE TABLE
|
138 |
-
$wpdb->get_results($sql);
|
139 |
}
|
140 |
|
141 |
// GET (MULTI-SITE) NETWORK INFORMATION
|
@@ -154,8 +119,6 @@ class OptimizeDatabase {
|
|
154 |
$this->odb_minify = (defined('WP_DEBUG') && WP_DEBUG) ? '' : '.min';
|
155 |
|
156 |
// LOAD STYLE SHEET (ONLY ON RELEVANT PAGES)
|
157 |
-
$this_page = '';
|
158 |
-
if(isset($_GET['page'])) $this_page = $_GET['page'];
|
159 |
// v4.0.3
|
160 |
if($this->odb_is_relevant_page()) {
|
161 |
wp_register_style('odb-style'.$this->odb_version, plugins_url('css/style'.$this->odb_minify.'.css', __FILE__));
|
@@ -575,7 +538,7 @@ class OptimizeDatabase {
|
|
575 |
function odb_is_relevant_page() {
|
576 |
$this_page = '';
|
577 |
if(isset($_GET['page'])) $this_page = $_GET['page'];
|
578 |
-
return ($this_page
|
579 |
} // odb_is_relevant_page()
|
580 |
|
581 |
|
@@ -644,14 +607,63 @@ class OptimizeDatabase {
|
|
644 |
} // odb_start_scheduler()
|
645 |
|
646 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
647 |
/*******************************************************************************
|
648 |
*
|
649 |
* MAIN METHOD FOR CLEANING / OPTIMIZING
|
650 |
*
|
651 |
*******************************************************************************/
|
652 |
function odb_start($scheduler) {
|
653 |
-
|
654 |
-
|
655 |
// PAGE LOAD TIMER
|
656 |
$time = microtime();
|
657 |
$time = explode(' ', $time);
|
@@ -669,7 +681,6 @@ class OptimizeDatabase {
|
|
669 |
// v4.6.1
|
670 |
return;
|
671 |
} else if($action == "clear_log") {
|
672 |
-
|
673 |
// CLEAR THE LOG TABLE
|
674 |
$this->odb_logger_obj->odb_clear_log();
|
675 |
|
1 |
<?php
|
2 |
/**
|
3 |
* @package Optimize Database after Deleting Revisions
|
4 |
+
* @version 5.0.8
|
5 |
*/
|
6 |
/*
|
7 |
Plugin Name: Optimize Database after Deleting Revisions
|
10 |
Author: CAGE Web Design | Rolf van Gelder, Eindhoven, The Netherlands
|
11 |
Author URI: http://cagewebdev.com
|
12 |
Network: True
|
13 |
+
Version: 5.0.8
|
14 |
*/
|
15 |
|
16 |
/********************************************************************************************
|
28 |
|
29 |
class OptimizeDatabase {
|
30 |
// VERSION
|
31 |
+
var $odb_version = '5.0.8';
|
32 |
+
var $odb_release_date = '08/03/2021';
|
33 |
|
34 |
// PLUGIN OPTIONS
|
35 |
var $odb_rvg_options = array();
|
92 |
* INITIALIZE PLUGIN
|
93 |
*******************************************************************************/
|
94 |
function odb_init() {
|
|
|
|
|
95 |
// LOAD CLASSES
|
96 |
$this->odb_classes();
|
97 |
|
98 |
// URLS AND DIRECTORIES
|
99 |
$this->odb_urls_dirs();
|
100 |
|
101 |
+
// 5.0.8 THIS MAY NOT THIS MAY NOT EVEN BE NECESSARY ANYMORE
|
102 |
+
if ($this->odb_is_relevant_page()) {
|
103 |
+
$this->odb_create_log_table();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
104 |
}
|
105 |
|
106 |
// GET (MULTI-SITE) NETWORK INFORMATION
|
119 |
$this->odb_minify = (defined('WP_DEBUG') && WP_DEBUG) ? '' : '.min';
|
120 |
|
121 |
// LOAD STYLE SHEET (ONLY ON RELEVANT PAGES)
|
|
|
|
|
122 |
// v4.0.3
|
123 |
if($this->odb_is_relevant_page()) {
|
124 |
wp_register_style('odb-style'.$this->odb_version, plugins_url('css/style'.$this->odb_minify.'.css', __FILE__));
|
538 |
function odb_is_relevant_page() {
|
539 |
$this_page = '';
|
540 |
if(isset($_GET['page'])) $this_page = $_GET['page'];
|
541 |
+
return (in_array($this_page, ['odb_settings_page', 'rvg-optimize-database']));
|
542 |
} // odb_is_relevant_page()
|
543 |
|
544 |
|
607 |
} // odb_start_scheduler()
|
608 |
|
609 |
|
610 |
+
/*******************************************************************************
|
611 |
+
*
|
612 |
+
* CREATE THE LOG TABLE (IF NOT EXISTS)
|
613 |
+
*
|
614 |
+
*******************************************************************************/
|
615 |
+
function odb_create_log_table() {
|
616 |
+
global $wpdb;
|
617 |
+
|
618 |
+
// PLUGIN RUNNING (v5.0.5)
|
619 |
+
$this->odb_tables = $this->odb_utilities_obj->odb_get_tables();
|
620 |
+
|
621 |
+
// CREATE LOG TABLE (IF NOT EXISTS) - v4.6
|
622 |
+
$this->odb_logtable_name = $wpdb->base_prefix . 'odb_logs';
|
623 |
+
|
624 |
+
$found = false;
|
625 |
+
for($i = 0; $i < count($this->odb_tables); $i++) {
|
626 |
+
if ($this->odb_tables[$i][0] == $this->odb_logtable_name) {
|
627 |
+
$found = true;
|
628 |
+
}
|
629 |
+
} // for($i = 0; $i < count($this->odb_tables); $i++)
|
630 |
+
|
631 |
+
// v5.0.3
|
632 |
+
if (!$found) {
|
633 |
+
$sql = '
|
634 |
+
CREATE TABLE IF NOT EXISTS `' . $this->odb_logtable_name . '` (
|
635 |
+
`odb_id` int(11) NOT NULL AUTO_INCREMENT,
|
636 |
+
`odb_timestamp` varchar(20) NOT NULL,
|
637 |
+
`odb_revisions` int(11) NOT NULL,
|
638 |
+
`odb_trash` int(11) NOT NULL,
|
639 |
+
`odb_spam` int(11) NOT NULL,
|
640 |
+
`odb_tags` int(11) NOT NULL,
|
641 |
+
`odb_transients` int(11) NOT NULL,
|
642 |
+
`odb_pingbacks` int(11) NOT NULL,
|
643 |
+
`odb_oembeds` int(11) NOT NULL,
|
644 |
+
`odb_orphans` int(11) NOT NULL,
|
645 |
+
`odb_tables` int(11) NOT NULL,
|
646 |
+
`odb_before` varchar(20) NOT NULL,
|
647 |
+
`odb_after` varchar(20) NOT NULL,
|
648 |
+
`odb_savings` varchar(20) NOT NULL,
|
649 |
+
PRIMARY KEY (`odb_id`)
|
650 |
+
) DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;
|
651 |
+
';
|
652 |
+
|
653 |
+
// CREATE TABLE
|
654 |
+
$wpdb->query($sql);
|
655 |
+
} // if (!$found)
|
656 |
+
} // odb_create_log_table()
|
657 |
+
|
658 |
+
|
659 |
/*******************************************************************************
|
660 |
*
|
661 |
* MAIN METHOD FOR CLEANING / OPTIMIZING
|
662 |
*
|
663 |
*******************************************************************************/
|
664 |
function odb_start($scheduler) {
|
665 |
+
$this->odb_create_log_table();
|
666 |
+
|
667 |
// PAGE LOAD TIMER
|
668 |
$time = microtime();
|
669 |
$time = explode(' ', $time);
|
681 |
// v4.6.1
|
682 |
return;
|
683 |
} else if($action == "clear_log") {
|
|
|
684 |
// CLEAR THE LOG TABLE
|
685 |
$this->odb_logger_obj->odb_clear_log();
|
686 |
|