Version Description
[11/17/2020] = * BUG FIX: Creating log table if not exists
Download this release
Release Info
Developer | cageehv |
Plugin | Optimize Database after Deleting Revisions |
Version | 5.0.3 |
Comparing to | |
See all releases |
Code changes from version 5.0.2 to 5.0.3
- classes/odb-cleaner.php +7 -10
- readme.txt +5 -2
- rvg-optimize-database.php +38 -27
classes/odb-cleaner.php
CHANGED
@@ -1904,13 +1904,10 @@ function odb_confirm_delete() {
|
|
1904 |
********************************************************************************************/
|
1905 |
function odb_optimize_tables($scheduler, $action) {
|
1906 |
global $odb_class, $wpdb;
|
1907 |
-
|
1908 |
-
// GET THE DATABASE TABLES
|
1909 |
-
$odb_tables = $odb_class->odb_utilities_obj->odb_get_tables();
|
1910 |
|
1911 |
$cnt = 0;
|
1912 |
-
for ($i = 0; $i < count($odb_tables); $i++) {
|
1913 |
-
if(!isset($odb_class->odb_rvg_excluded_tabs[$odb_tables[$i][0]])) {
|
1914 |
# TABLE NOT EXCLUDED
|
1915 |
$cnt++;
|
1916 |
|
@@ -1919,7 +1916,7 @@ function odb_confirm_delete() {
|
|
1919 |
FROM information_schema.TABLES
|
1920 |
WHERE table_schema = '%s'
|
1921 |
AND table_name = '%s'
|
1922 |
-
", DB_NAME, $odb_tables[$i][0]);
|
1923 |
$table_info = $wpdb->get_results($sql);
|
1924 |
|
1925 |
if($odb_class->odb_rvg_options["optimize_innodb"] == 'N' && strtolower($table_info[0]->engine) == 'innodb') {
|
@@ -1928,7 +1925,7 @@ function odb_confirm_delete() {
|
|
1928 |
} else {
|
1929 |
// v4.6.3
|
1930 |
if (@strtolower($table_info[0]->engine) == 'myisam') {
|
1931 |
-
$result = $this->odb_optimize_myisam($odb_tables[$i][0]);
|
1932 |
$msg = $result[0]->Msg_text;
|
1933 |
if ($msg == 'OK') {
|
1934 |
$msg = __('<span class="odb-optimized">TABLE OPTIMIZED</span>', 'rvg-optimize-database');
|
@@ -1936,7 +1933,7 @@ function odb_confirm_delete() {
|
|
1936 |
$msg = __('Table is already up to date', 'rvg-optimize-database');
|
1937 |
}
|
1938 |
} else {
|
1939 |
-
$result = $this->odb_optimize_innodb($odb_tables[$i][0]);
|
1940 |
$msg = $result[0]->Msg_text;
|
1941 |
if ($msg == 'Table is already up to date') {
|
1942 |
$msg = __('Table is already up to date', 'rvg-optimize-database');
|
@@ -1950,7 +1947,7 @@ function odb_confirm_delete() {
|
|
1950 |
?>
|
1951 |
<tr>
|
1952 |
<td align="right" valign="top"><?php echo $cnt?>.</td>
|
1953 |
-
<td valign="top" class="odb-bold"><?php echo $odb_tables[$i][0] ?></td>
|
1954 |
<td valign="top"><?php echo $msg ?></td>
|
1955 |
<td valign="top"><?php echo $table_info[0]->engine ?></td>
|
1956 |
<td align="right" valign="top"><?php echo $table_info[0]->table_rows ?></td>
|
@@ -1959,7 +1956,7 @@ function odb_confirm_delete() {
|
|
1959 |
<?php
|
1960 |
} // if (!$scheduler && ($action == 'analyze_detail' || $action == 'run_detail'))
|
1961 |
} // if(!$excluded)
|
1962 |
-
} // for ($i = 0; $i < count($odb_tables); $i++)
|
1963 |
return $cnt;
|
1964 |
} // odb_optimize_tables()
|
1965 |
|
1904 |
********************************************************************************************/
|
1905 |
function odb_optimize_tables($scheduler, $action) {
|
1906 |
global $odb_class, $wpdb;
|
|
|
|
|
|
|
1907 |
|
1908 |
$cnt = 0;
|
1909 |
+
for ($i = 0; $i < count($odb_class->odb_tables); $i++) {
|
1910 |
+
if(!isset($odb_class->odb_rvg_excluded_tabs[$odb_class->odb_tables[$i][0]])) {
|
1911 |
# TABLE NOT EXCLUDED
|
1912 |
$cnt++;
|
1913 |
|
1916 |
FROM information_schema.TABLES
|
1917 |
WHERE table_schema = '%s'
|
1918 |
AND table_name = '%s'
|
1919 |
+
", DB_NAME, $odb_class->odb_tables[$i][0]);
|
1920 |
$table_info = $wpdb->get_results($sql);
|
1921 |
|
1922 |
if($odb_class->odb_rvg_options["optimize_innodb"] == 'N' && strtolower($table_info[0]->engine) == 'innodb') {
|
1925 |
} else {
|
1926 |
// v4.6.3
|
1927 |
if (@strtolower($table_info[0]->engine) == 'myisam') {
|
1928 |
+
$result = $this->odb_optimize_myisam($odb_class->odb_tables[$i][0]);
|
1929 |
$msg = $result[0]->Msg_text;
|
1930 |
if ($msg == 'OK') {
|
1931 |
$msg = __('<span class="odb-optimized">TABLE OPTIMIZED</span>', 'rvg-optimize-database');
|
1933 |
$msg = __('Table is already up to date', 'rvg-optimize-database');
|
1934 |
}
|
1935 |
} else {
|
1936 |
+
$result = $this->odb_optimize_innodb($odb_class->odb_tables[$i][0]);
|
1937 |
$msg = $result[0]->Msg_text;
|
1938 |
if ($msg == 'Table is already up to date') {
|
1939 |
$msg = __('Table is already up to date', 'rvg-optimize-database');
|
1947 |
?>
|
1948 |
<tr>
|
1949 |
<td align="right" valign="top"><?php echo $cnt?>.</td>
|
1950 |
+
<td valign="top" class="odb-bold"><?php echo $odb_class->odb_tables[$i][0] ?></td>
|
1951 |
<td valign="top"><?php echo $msg ?></td>
|
1952 |
<td valign="top"><?php echo $table_info[0]->engine ?></td>
|
1953 |
<td align="right" valign="top"><?php echo $table_info[0]->table_rows ?></td>
|
1956 |
<?php
|
1957 |
} // if (!$scheduler && ($action == 'analyze_detail' || $action == 'run_detail'))
|
1958 |
} // if(!$excluded)
|
1959 |
+
} // for ($i = 0; $i < count($odb_class->odb_tables); $i++)
|
1960 |
return $cnt;
|
1961 |
} // odb_optimize_tables()
|
1962 |
|
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.5.4
|
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.2 [11/06/2020] =
|
115 |
* BUG FIX: Deletion of orphaned term relationships deactivated
|
116 |
|
10 |
Requires at least: 2.8
|
11 |
Requires PHP: 5.0
|
12 |
Tested up to: 5.5.4
|
13 |
+
Stable tag: 5.0.3
|
14 |
+
Version: 5.0.3
|
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.3 [11/17/2020] =
|
115 |
+
* BUG FIX: Creating log table if not exists
|
116 |
+
|
117 |
= 5.0.2 [11/06/2020] =
|
118 |
* BUG FIX: Deletion of orphaned term relationships deactivated
|
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 = '11/
|
33 |
|
34 |
// PLUGIN OPTIONS
|
35 |
var $odb_rvg_options = array();
|
@@ -100,32 +100,43 @@ class OptimizeDatabase {
|
|
100 |
// URLS AND DIRECTORIES
|
101 |
$this->odb_urls_dirs();
|
102 |
|
|
|
|
|
103 |
// CREATE LOG TABLE (IF NOT EXISTS) - v4.6
|
104 |
$this->odb_logtable_name = $wpdb->base_prefix . 'odb_logs';
|
105 |
|
106 |
-
|
107 |
-
$
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
129 |
|
130 |
// GET (MULTI-SITE) NETWORK INFORMATION
|
131 |
$this->odb_multisite_obj->odb_ms_network_info();
|
1 |
<?php
|
2 |
/**
|
3 |
* @package Optimize Database after Deleting Revisions
|
4 |
+
* @version 5.0.3
|
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.3
|
14 |
*/
|
15 |
|
16 |
/********************************************************************************************
|
28 |
|
29 |
class OptimizeDatabase {
|
30 |
// VERSION
|
31 |
+
var $odb_version = '5.0.3';
|
32 |
+
var $odb_release_date = '11/17/2020';
|
33 |
|
34 |
// PLUGIN OPTIONS
|
35 |
var $odb_rvg_options = array();
|
100 |
// URLS AND DIRECTORIES
|
101 |
$this->odb_urls_dirs();
|
102 |
|
103 |
+
$this->odb_tables = $this->odb_utilities_obj->odb_get_tables();
|
104 |
+
|
105 |
// CREATE LOG TABLE (IF NOT EXISTS) - v4.6
|
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
|
142 |
$this->odb_multisite_obj->odb_ms_network_info();
|