Optimize Database after Deleting Revisions - Version 4.4.3

Version Description

[01/06/2018] = * BUG FIX: Fixed some scheduler time issues

Download this release

Release Info

Developer cageehv
Plugin Icon 128x128 Optimize Database after Deleting Revisions
Version 4.4.3
Comparing to
See all releases

Code changes from version 4.4.2 to 4.4.3

classes/odb-scheduler.php CHANGED
@@ -7,6 +7,7 @@
7
  ?>
8
  <?php
9
  class ODB_Scheduler {
 
10
  /********************************************************************************************
11
  * CONSTRUCTOR
12
  ********************************************************************************************/
@@ -89,30 +90,44 @@ class ODB_Scheduler {
89
 
90
  /*******************************************************************************
91
  * CALCULATE SCHEDULE TIME
 
92
  *******************************************************************************/
93
  function odb_calculate_time() {
94
  global $odb_class;
 
 
 
 
95
 
96
  if ($odb_class->odb_rvg_options['schedule_type'] == 'daily' ||
97
  $odb_class->odb_rvg_options['schedule_type'] == 'weekly' ||
98
  $odb_class->odb_rvg_options['schedule_type'] == 'monthly'
99
  ) {
100
- // 'daily' OR 'weekly'
101
- $current_datetime = Date('YmdHis');
102
- $current_date = substr($current_datetime, 0, 8);
103
- $current_hour = substr($current_datetime, 8, 2);
104
-
105
- if($odb_class->odb_rvg_options['schedule_hour'] <= $current_hour)
106
  // NEXT RUN WILL BE TOMORROW
107
  $date = date('YmdHis', strtotime($current_date.$odb_class->odb_rvg_options['schedule_hour'].'0000'.' + 1 day'));
108
- else
109
  // NEXT RUN WILL BE TODAY
110
  $date = $current_date.$odb_class->odb_rvg_options['schedule_hour'].'0000';
 
111
  $time = strtotime($date);
112
- }
113
- else
114
  // 'hourly' OR 'twicedaily'
115
- $time = time();
 
 
 
 
 
 
 
 
 
 
 
 
 
116
 
117
  return $time;
118
  } // odb_calculate_time()
7
  ?>
8
  <?php
9
  class ODB_Scheduler {
10
+
11
  /********************************************************************************************
12
  * CONSTRUCTOR
13
  ********************************************************************************************/
90
 
91
  /*******************************************************************************
92
  * CALCULATE SCHEDULE TIME
93
+ * v4.4.3 Fixed timing issues
94
  *******************************************************************************/
95
  function odb_calculate_time() {
96
  global $odb_class;
97
+
98
+ // SERVER TIME, BASED ON TIMEZONE WEBSITE v4.4.3
99
+ $current_date = substr($odb_class->odb_current_date, 0, 8);
100
+ $current_hour = substr($odb_class->odb_current_date, 8, 2);
101
 
102
  if ($odb_class->odb_rvg_options['schedule_type'] == 'daily' ||
103
  $odb_class->odb_rvg_options['schedule_type'] == 'weekly' ||
104
  $odb_class->odb_rvg_options['schedule_type'] == 'monthly'
105
  ) {
106
+ // 'daily' OR 'weekly' OR 'monthly'
107
+ if($odb_class->odb_rvg_options['schedule_hour'] <= $current_hour) {
 
 
 
 
108
  // NEXT RUN WILL BE TOMORROW
109
  $date = date('YmdHis', strtotime($current_date.$odb_class->odb_rvg_options['schedule_hour'].'0000'.' + 1 day'));
110
+ } else {
111
  // NEXT RUN WILL BE TODAY
112
  $date = $current_date.$odb_class->odb_rvg_options['schedule_hour'].'0000';
113
+ } // if($odb_class->odb_rvg_options['schedule_hour'] <= $current_hour)
114
  $time = strtotime($date);
115
+ } else {
 
116
  // 'hourly' OR 'twicedaily'
117
+
118
+ // ADD ONE HOUR
119
+ $t = $odb_class->odb_timestamp + 3600;
120
+ // CONVERT TIMESTAMP TO DATE (yyyymmddhhmmss)
121
+ $d = date('YmdHis', $t);
122
+ // GET THE NEW HOUR
123
+ $h = substr($d, 8, 2);
124
+ // CUT OFF THE TIME
125
+ $d = substr($d, 0, 8);
126
+ // ADD THE HOUR WITH MINS = '00' AND SECS = '00'
127
+ $date = $d.$h.'0000';
128
+ // CONVERT THE NEW DATE TO A TIMESTAMP
129
+ $time = strtotime($d.$h.'0000');
130
+ } // if ($odb_class->odb_rvg_options['schedule_type'] == 'daily' ...
131
 
132
  return $time;
133
  } // odb_calculate_time()
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.9.1
11
- Stable tag: 4.4.2
12
- Version: 4.4.2
13
  License: GPLv2 or later
14
 
15
  == Description ==
@@ -102,6 +102,9 @@ http://cagewebdev.com/wordpress-plugins/
102
  * If you run the plugin from any of the sites, it will cleanup ALL the sites in the network!
103
 
104
  == Changelog ==
 
 
 
105
  = 4.4.2 [12/14/2017] =
106
  * NEW: Skip standard posttype 'oembed_cache'
107
  * BUG FIX: Hide the settings link (plugin page) for multi site sites (except for the main network site)
8
  Author: CAGE Web Design | Rolf van Gelder, Eindhoven, The Netherlands
9
  Requires at least: 2.8
10
  Tested up to: 4.9.1
11
+ Stable tag: 4.4.3
12
+ Version: 4.4.3
13
  License: GPLv2 or later
14
 
15
  == Description ==
102
  * If you run the plugin from any of the sites, it will cleanup ALL the sites in the network!
103
 
104
  == Changelog ==
105
+ = 4.4.3 [01/06/2018] =
106
+ * BUG FIX: Fixed some scheduler time issues
107
+
108
  = 4.4.2 [12/14/2017] =
109
  * NEW: Skip standard posttype 'oembed_cache'
110
  * BUG FIX: Hide the settings link (plugin page) for multi site sites (except for the main network site)
rvg-optimize-database.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /**
3
  * @package Optimize Database after Deleting Revisions
4
- * @version 4.4.2
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.4.2
14
  */
15
 
16
  /********************************************************************************************
@@ -24,8 +24,8 @@ $odb_class = new OptimizeDatabase();
24
 
25
  class OptimizeDatabase {
26
  // VERSION
27
- var $odb_version = '4.4.2';
28
- var $odb_release_date = '12/14/2017';
29
 
30
  // PLUGIN OPTIONS
31
  var $odb_rvg_options = array();
@@ -47,6 +47,11 @@ class OptimizeDatabase {
47
 
48
  // LOCALIZATION
49
  var $odb_txt_domain = 'rvg-optimize-database';
 
 
 
 
 
50
 
51
  // PLUGIN
52
  var $odb_plugin_url;
@@ -74,6 +79,11 @@ class OptimizeDatabase {
74
  function __construct() {
75
  // INITIALIZE PLUGIN
76
  add_action('init', array(&$this, 'odb_init'));
 
 
 
 
 
77
  } // __construct()
78
 
79
 
@@ -555,7 +565,7 @@ class OptimizeDatabase {
555
  echo "<div class='updated odb-bold'><p>".
556
  __('Optimize Database after Deleting Revisions LOG FILE HAS BEEN DELETED', $this->odb_txt_domain);
557
  echo "</p></div>";
558
- }
559
  } // if(isset($_REQUEST['action']))
560
 
561
  if(!$scheduler) {
1
  <?php
2
  /**
3
  * @package Optimize Database after Deleting Revisions
4
+ * @version 4.4.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.4.3
14
  */
15
 
16
  /********************************************************************************************
24
 
25
  class OptimizeDatabase {
26
  // VERSION
27
+ var $odb_version = '4.4.3';
28
+ var $odb_release_date = '01/06/2018';
29
 
30
  // PLUGIN OPTIONS
31
  var $odb_rvg_options = array();
47
 
48
  // LOCALIZATION
49
  var $odb_txt_domain = 'rvg-optimize-database';
50
+
51
+ // CURRENT SITE DATE (yyyymmddHHiiss) AND UNIX TIMESTAMP, BASED ON TIMEZONE OF THE SITE
52
+ // v4.4.3
53
+ var $odb_current_date;
54
+ var $odb_timestamp;
55
 
56
  // PLUGIN
57
  var $odb_plugin_url;
79
  function __construct() {
80
  // INITIALIZE PLUGIN
81
  add_action('init', array(&$this, 'odb_init'));
82
+
83
+ // SERVER TIME, BASED ON THE TIMEZONE OF THE SITE v4.4.3
84
+ date_default_timezone_set(get_option('timezone_string'));
85
+ $this->odb_current_date = date('YmdHis');
86
+ $this->odb_timestamp = strtotime($this->odb_current_date, time());
87
  } // __construct()
88
 
89
 
565
  echo "<div class='updated odb-bold'><p>".
566
  __('Optimize Database after Deleting Revisions LOG FILE HAS BEEN DELETED', $this->odb_txt_domain);
567
  echo "</p></div>";
568
+ } // if($action == "delete_log")
569
  } // if(isset($_REQUEST['action']))
570
 
571
  if(!$scheduler) {