Version Description
[02/22/2016] = * BUG FIX: Saving settings didn't work well for multi-sites
Download this release
Release Info
Developer | cageehv |
Plugin | Optimize Database after Deleting Revisions |
Version | 4.1.3 |
Comparing to | |
See all releases |
Code changes from version 4.1.2 to 4.1.3
- classes/odb-cleaner.php +6 -5
- classes/odb-displayer.php +1 -1
- classes/odb-multisite.php +7 -4
- includes/settings-page.php +34 -7
- readme.txt +6 -3
- rvg-optimize-database.php +6 -4
classes/odb-cleaner.php
CHANGED
@@ -62,7 +62,8 @@ class ODB_Cleaner
|
|
62 |
/****************************************************************************************
|
63 |
* DELETE REVISIONS
|
64 |
****************************************************************************************/
|
65 |
-
|
|
|
66 |
{
|
67 |
// FIND REVISIONS
|
68 |
$results_older_than = array();
|
@@ -71,7 +72,7 @@ class ODB_Cleaner
|
|
71 |
}
|
72 |
|
73 |
$results_keep_revisions = array();
|
74 |
-
if($odb_class->odb_rvg_options['
|
75 |
{ $results_keep_revisions = $this->odb_get_revisions_keep_revisions();
|
76 |
}
|
77 |
|
@@ -124,7 +125,7 @@ class ODB_Cleaner
|
|
124 |
|
125 |
// NUMBER OF DELETED REVISIONS FOR LOG FILE
|
126 |
$odb_class->log_arr["revisions"] = $total_deleted;
|
127 |
-
} // if($odb_class->odb_rvg_options['delete_older'] == 'Y' || $odb_class->odb_rvg_options['
|
128 |
|
129 |
|
130 |
/****************************************************************************************
|
@@ -662,7 +663,7 @@ class ODB_Cleaner
|
|
662 |
} // for($i=0; $i<count($results); $i++)
|
663 |
} // if($odb_class->odb_rvg_options['delete_older'] == 'Y')
|
664 |
|
665 |
-
if($odb_class->odb_rvg_options['
|
666 |
{ // KEEP MAX NUMBER OF REVISIONS
|
667 |
$results = $this->odb_get_revisions_keep_revisions();
|
668 |
$max_revisions = $odb_class->odb_rvg_options['nr_of_revisions'];
|
@@ -713,7 +714,7 @@ class ODB_Cleaner
|
|
713 |
<?php
|
714 |
} // if(!$scheduler)
|
715 |
} // for($i=0; $i<count($results); $i++)
|
716 |
-
} // if($odb_class->odb_rvg_options['
|
717 |
|
718 |
return $total_deleted;
|
719 |
} // function odb_delete_revisions()
|
62 |
/****************************************************************************************
|
63 |
* DELETE REVISIONS
|
64 |
****************************************************************************************/
|
65 |
+
// var_dump($odb_class->odb_rvg_options['rvg_revisions']);
|
66 |
+
if($odb_class->odb_rvg_options['delete_older'] == 'Y' || $odb_class->odb_rvg_options['rvg_revisions'] == 'Y')
|
67 |
{
|
68 |
// FIND REVISIONS
|
69 |
$results_older_than = array();
|
72 |
}
|
73 |
|
74 |
$results_keep_revisions = array();
|
75 |
+
if($odb_class->odb_rvg_options['rvg_revisions'] == 'Y')
|
76 |
{ $results_keep_revisions = $this->odb_get_revisions_keep_revisions();
|
77 |
}
|
78 |
|
125 |
|
126 |
// NUMBER OF DELETED REVISIONS FOR LOG FILE
|
127 |
$odb_class->log_arr["revisions"] = $total_deleted;
|
128 |
+
} // if($odb_class->odb_rvg_options['delete_older'] == 'Y' || $odb_class->odb_rvg_options['rvg_revisions'] == 'Y')
|
129 |
|
130 |
|
131 |
/****************************************************************************************
|
663 |
} // for($i=0; $i<count($results); $i++)
|
664 |
} // if($odb_class->odb_rvg_options['delete_older'] == 'Y')
|
665 |
|
666 |
+
if($odb_class->odb_rvg_options['rvg_revisions'] == 'Y')
|
667 |
{ // KEEP MAX NUMBER OF REVISIONS
|
668 |
$results = $this->odb_get_revisions_keep_revisions();
|
669 |
$max_revisions = $odb_class->odb_rvg_options['nr_of_revisions'];
|
714 |
<?php
|
715 |
} // if(!$scheduler)
|
716 |
} // for($i=0; $i<count($results); $i++)
|
717 |
+
} // if($odb_class->odb_rvg_options['rvg_revisions'] == 'Y')
|
718 |
|
719 |
return $total_deleted;
|
720 |
} // function odb_delete_revisions()
|
classes/odb-displayer.php
CHANGED
@@ -60,7 +60,7 @@ class ODB_Displayer
|
|
60 |
if($odb_class->odb_rvg_options['delete_older'] == 'Y')
|
61 |
{ echo '<span class="odb-bold">'.__('Delete revisions older than', $odb_class->odb_txt_domain).':</span> <span class="odb-bold odb-blue">'.$odb_class->odb_rvg_options['older_than'].' '.__("days", $odb_class->odb_txt_domain).'</span><br />';
|
62 |
}
|
63 |
-
if($odb_class->odb_rvg_options['
|
64 |
{ echo '<span class="odb-bold">'.__('Maximum number of - most recent - revisions to keep per post / page', $odb_class->odb_txt_domain).':</span> <span class="odb-bold odb-blue">'.$odb_class->odb_rvg_options['nr_of_revisions'].'</span><br />';
|
65 |
}
|
66 |
|
60 |
if($odb_class->odb_rvg_options['delete_older'] == 'Y')
|
61 |
{ echo '<span class="odb-bold">'.__('Delete revisions older than', $odb_class->odb_txt_domain).':</span> <span class="odb-bold odb-blue">'.$odb_class->odb_rvg_options['older_than'].' '.__("days", $odb_class->odb_txt_domain).'</span><br />';
|
62 |
}
|
63 |
+
if($odb_class->odb_rvg_options['rvg_revisions'] == 'Y')
|
64 |
{ echo '<span class="odb-bold">'.__('Maximum number of - most recent - revisions to keep per post / page', $odb_class->odb_txt_domain).':</span> <span class="odb-bold odb-blue">'.$odb_class->odb_rvg_options['nr_of_revisions'].'</span><br />';
|
65 |
}
|
66 |
|
classes/odb-multisite.php
CHANGED
@@ -42,11 +42,12 @@ class ODB_MultiSite
|
|
42 |
{
|
43 |
global $odb_class;
|
44 |
|
|
|
45 |
if(is_multisite() &&
|
46 |
function_exists('is_plugin_active_for_network') &&
|
47 |
is_plugin_active_for_network($odb_class->odb_main_file))
|
48 |
return get_site_option($option, $default);
|
49 |
-
else
|
50 |
return get_option($option, $default);
|
51 |
} // odb_ms_get_option()
|
52 |
|
@@ -58,12 +59,13 @@ class ODB_MultiSite
|
|
58 |
{
|
59 |
// v4.0.2
|
60 |
global $odb_class;
|
61 |
-
|
|
|
62 |
if(is_multisite() &&
|
63 |
function_exists('is_plugin_active_for_network') &&
|
64 |
is_plugin_active_for_network($odb_class->odb_main_file))
|
65 |
return update_site_option($option, $value);
|
66 |
-
else
|
67 |
return update_option($option, $value);
|
68 |
} // odb_ms_update_option()
|
69 |
|
@@ -76,11 +78,12 @@ class ODB_MultiSite
|
|
76 |
// v4.0.2
|
77 |
global $odb_class;
|
78 |
|
|
|
79 |
if(is_multisite() &&
|
80 |
function_exists('is_plugin_active_for_network') &&
|
81 |
is_plugin_active_for_network($odb_class->odb_main_file))
|
82 |
return delete_site_option($option);
|
83 |
-
else
|
84 |
return delete_option($option);
|
85 |
} // odb_ms_delete_option()
|
86 |
|
42 |
{
|
43 |
global $odb_class;
|
44 |
|
45 |
+
/* v4.1.3
|
46 |
if(is_multisite() &&
|
47 |
function_exists('is_plugin_active_for_network') &&
|
48 |
is_plugin_active_for_network($odb_class->odb_main_file))
|
49 |
return get_site_option($option, $default);
|
50 |
+
else*/
|
51 |
return get_option($option, $default);
|
52 |
} // odb_ms_get_option()
|
53 |
|
59 |
{
|
60 |
// v4.0.2
|
61 |
global $odb_class;
|
62 |
+
|
63 |
+
/* v4.1.3
|
64 |
if(is_multisite() &&
|
65 |
function_exists('is_plugin_active_for_network') &&
|
66 |
is_plugin_active_for_network($odb_class->odb_main_file))
|
67 |
return update_site_option($option, $value);
|
68 |
+
else*/
|
69 |
return update_option($option, $value);
|
70 |
} // odb_ms_update_option()
|
71 |
|
78 |
// v4.0.2
|
79 |
global $odb_class;
|
80 |
|
81 |
+
/* v4.1.3
|
82 |
if(is_multisite() &&
|
83 |
function_exists('is_plugin_active_for_network') &&
|
84 |
is_plugin_active_for_network($odb_class->odb_main_file))
|
85 |
return delete_site_option($option);
|
86 |
+
else*/
|
87 |
return delete_option($option);
|
88 |
} // odb_ms_delete_option()
|
89 |
|
includes/settings-page.php
CHANGED
@@ -13,6 +13,8 @@ if (isset($_POST['info_update']))
|
|
13 |
{ // SAVE SETTINGS
|
14 |
check_admin_referer('odb_action', 'odb_nonce');
|
15 |
|
|
|
|
|
16 |
$current_datetime = Date('YmdHis');
|
17 |
$current_date = substr($current_datetime, 0, 8);
|
18 |
$current_hour = substr($current_datetime, 8, 2);
|
@@ -25,8 +27,10 @@ if (isset($_POST['info_update']))
|
|
25 |
if(isset($_POST['rvg_odb_older_than'])) $this->odb_rvg_options['older_than'] = sanitize_text_field($_POST['rvg_odb_older_than']);
|
26 |
else $this->odb_rvg_options['older_than'] = '';
|
27 |
|
28 |
-
if(isset($_POST['rvg_odb_keep_revisions']))
|
29 |
-
|
|
|
|
|
30 |
|
31 |
if(isset($_POST['rvg_odb_number'])) $this->odb_rvg_options['nr_of_revisions'] = sanitize_text_field($_POST['rvg_odb_number']);
|
32 |
else $this->odb_rvg_options['nr_of_revisions'] = '';
|
@@ -168,10 +172,33 @@ function rvg_odb_check_form()
|
|
168 |
$c = ' checked';
|
169 |
$d = ' disabled';
|
170 |
|
171 |
-
|
172 |
-
|
173 |
-
$
|
174 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
175 |
$cb_trash = ($this->odb_rvg_options['clear_trash'] == "Y") ? $c : '';
|
176 |
$cb_spam = ($this->odb_rvg_options['clear_spam'] == "Y") ? $c : '';
|
177 |
$cb_tags = ($this->odb_rvg_options['clear_tags'] == "Y") ? $c : '';
|
@@ -206,7 +233,7 @@ echo '
|
|
206 |
<td><input type="text" size="2" name="rvg_odb_older_than" id="rvg_odb_older_than" value="'.$this->odb_rvg_options['older_than'].'" class="odb-bold odb-blue"'.$cb_disabled1.'> '.__("day(s)", $this->odb_txt_domain).'
|
207 |
<script type="text/javascript">
|
208 |
';
|
209 |
-
if($this->odb_rvg_options['
|
210 |
echo '
|
211 |
jQuery("#rvg_odb_older_than").val("'.$this->odb_rvg_options['older_than'].'");
|
212 |
</script>
|
13 |
{ // SAVE SETTINGS
|
14 |
check_admin_referer('odb_action', 'odb_nonce');
|
15 |
|
16 |
+
// var_dump($_POST);
|
17 |
+
|
18 |
$current_datetime = Date('YmdHis');
|
19 |
$current_date = substr($current_datetime, 0, 8);
|
20 |
$current_hour = substr($current_datetime, 8, 2);
|
27 |
if(isset($_POST['rvg_odb_older_than'])) $this->odb_rvg_options['older_than'] = sanitize_text_field($_POST['rvg_odb_older_than']);
|
28 |
else $this->odb_rvg_options['older_than'] = '';
|
29 |
|
30 |
+
if(isset($_POST['rvg_odb_keep_revisions']))
|
31 |
+
$this->odb_rvg_options['rvg_revisions'] = sanitize_text_field($_POST['rvg_odb_keep_revisions']);
|
32 |
+
else
|
33 |
+
$this->odb_rvg_options['rvg_revisions'] = 'N';
|
34 |
|
35 |
if(isset($_POST['rvg_odb_number'])) $this->odb_rvg_options['nr_of_revisions'] = sanitize_text_field($_POST['rvg_odb_number']);
|
36 |
else $this->odb_rvg_options['nr_of_revisions'] = '';
|
172 |
$c = ' checked';
|
173 |
$d = ' disabled';
|
174 |
|
175 |
+
if($this->odb_rvg_options['delete_older'] == "Y")
|
176 |
+
{ // CHECKED
|
177 |
+
$cb_delete_older = $c;
|
178 |
+
$cb_disabled1 = '';
|
179 |
+
}
|
180 |
+
else
|
181 |
+
{ // UNCHECKED
|
182 |
+
$cb_delete_older = '';
|
183 |
+
$this->odb_rvg_options['older_than'] = '';
|
184 |
+
$cb_disabled1 = $d;
|
185 |
+
}
|
186 |
+
if($this->odb_rvg_options['rvg_revisions'] == "Y")
|
187 |
+
{ // CHECKED
|
188 |
+
$cb_keep_revisions = $c;
|
189 |
+
$cb_disabled2 = '';
|
190 |
+
}
|
191 |
+
else
|
192 |
+
{ // UNCHECED
|
193 |
+
$cb_keep_revisions = '';
|
194 |
+
$this->odb_rvg_options['nr_of_revisions'] = '';
|
195 |
+
$cb_disabled2 = $d;
|
196 |
+
}
|
197 |
+
|
198 |
+
# $cb_delete_older = ($this->odb_rvg_options['delete_older'] == "Y") ? $c : '';
|
199 |
+
# $cb_keep_revisions = ($this->odb_rvg_options['rvg_revisions'] == "Y") ? $c : '';
|
200 |
+
# $cb_disabled1 = ($this->odb_rvg_options['older_than'] != "") ? $d : '';
|
201 |
+
# $cb_disabled2 = ($this->odb_rvg_options['nr_of_revisions'] != "") ? $d : '';
|
202 |
$cb_trash = ($this->odb_rvg_options['clear_trash'] == "Y") ? $c : '';
|
203 |
$cb_spam = ($this->odb_rvg_options['clear_spam'] == "Y") ? $c : '';
|
204 |
$cb_tags = ($this->odb_rvg_options['clear_tags'] == "Y") ? $c : '';
|
233 |
<td><input type="text" size="2" name="rvg_odb_older_than" id="rvg_odb_older_than" value="'.$this->odb_rvg_options['older_than'].'" class="odb-bold odb-blue"'.$cb_disabled1.'> '.__("day(s)", $this->odb_txt_domain).'
|
234 |
<script type="text/javascript">
|
235 |
';
|
236 |
+
if($this->odb_rvg_options['delete_older'] == 'Y') echo 'jQuery("#rvg_odb_older").prop("checked", true)';
|
237 |
echo '
|
238 |
jQuery("#rvg_odb_older_than").val("'.$this->odb_rvg_options['older_than'].'");
|
239 |
</script>
|
readme.txt
CHANGED
@@ -7,9 +7,9 @@ Tags: database, delete, revisions, optimize, post, posts, page, pages, clean, cl
|
|
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.4.
|
11 |
-
Stable tag: 4.1.
|
12 |
-
Version: 4.1.
|
13 |
License: GPLv2 or later
|
14 |
|
15 |
== Description ==
|
@@ -87,6 +87,9 @@ http://cagewebdev.com/index.php/wordpress-plugins/
|
|
87 |
* If you run the plugin from any of the sites, it will cleanup ALL the sites in the network!
|
88 |
|
89 |
== Changelog ==
|
|
|
|
|
|
|
90 |
= 4.1.2 [02/14/2016] =
|
91 |
* NEW: Brasilian Portuguese (po_BR) translation added
|
92 |
* NEW: Network: True added to the plugin header
|
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.4.2
|
11 |
+
Stable tag: 4.1.3
|
12 |
+
Version: 4.1.3
|
13 |
License: GPLv2 or later
|
14 |
|
15 |
== Description ==
|
87 |
* If you run the plugin from any of the sites, it will cleanup ALL the sites in the network!
|
88 |
|
89 |
== Changelog ==
|
90 |
+
= 4.1.3 [02/22/2016] =
|
91 |
+
* BUG FIX: Saving settings didn't work well for multi-sites
|
92 |
+
|
93 |
= 4.1.2 [02/14/2016] =
|
94 |
* NEW: Brasilian Portuguese (po_BR) translation added
|
95 |
* NEW: Network: True added to the plugin header
|
rvg-optimize-database.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* @package Optimize Database after Deleting Revisions
|
4 |
-
* @version 4.1.
|
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: 4.1.
|
14 |
*/
|
15 |
|
16 |
/********************************************************************************************
|
@@ -25,8 +25,8 @@ $odb_class = new OptimizeDatabase();
|
|
25 |
class OptimizeDatabase
|
26 |
{
|
27 |
// VERSION
|
28 |
-
var $odb_version = '4.1.
|
29 |
-
var $odb_release_date = '02/
|
30 |
|
31 |
// PLUGIN OPTIONS
|
32 |
var $odb_rvg_options = array();
|
@@ -183,6 +183,8 @@ class OptimizeDatabase
|
|
183 |
$this->odb_rvg_options['clear_trash'] = 'N';
|
184 |
if(!isset($this->odb_rvg_options['delete_older']))
|
185 |
$this->odb_rvg_options['delete_older'] = 'N';
|
|
|
|
|
186 |
|
187 |
if(!isset($this->odb_rvg_options['last_run']))
|
188 |
$this->odb_rvg_options['last_run'] = '';
|
1 |
<?php
|
2 |
/**
|
3 |
* @package Optimize Database after Deleting Revisions
|
4 |
+
* @version 4.1.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: 4.1.3
|
14 |
*/
|
15 |
|
16 |
/********************************************************************************************
|
25 |
class OptimizeDatabase
|
26 |
{
|
27 |
// VERSION
|
28 |
+
var $odb_version = '4.1.3';
|
29 |
+
var $odb_release_date = '02/22/2016';
|
30 |
|
31 |
// PLUGIN OPTIONS
|
32 |
var $odb_rvg_options = array();
|
183 |
$this->odb_rvg_options['clear_trash'] = 'N';
|
184 |
if(!isset($this->odb_rvg_options['delete_older']))
|
185 |
$this->odb_rvg_options['delete_older'] = 'N';
|
186 |
+
if(!isset($this->odb_rvg_options['rvg_revisions']))
|
187 |
+
$this->odb_rvg_options['rvg_revisions'] = 'N';
|
188 |
|
189 |
if(!isset($this->odb_rvg_options['last_run']))
|
190 |
$this->odb_rvg_options['last_run'] = '';
|