UpdraftPlus WordPress Backup Plugin - Version 1.9.45

Version Description

  • 2014-12-20 =

  • FIX: Fix case in which the database imported from a BackWPUp backup could be falsely identified as missing (introduced in 1.9.40)

  • FIX: WordPress installs with ALTERNATE_WP_CRON set could skip some scheduled backups (since 1.9.19, so it appears that the conditions required to cause this bug are rare)

Download this release

Release Info

Developer DavidAnderson
Plugin Icon 128x128 UpdraftPlus WordPress Backup Plugin
Version 1.9.45
Comparing to
See all releases

Code changes from version 1.9.44 to 1.9.45

Files changed (5) hide show
  1. admin.php +2 -4
  2. backup.php +4 -1
  3. includes/Dropbox/Exception.php +3 -0
  4. readme.txt +8 -3
  5. updraftplus.php +24 -2
admin.php CHANGED
@@ -3904,8 +3904,7 @@ ENDHERE;
3904
  // Interpret the time as one from the blog's local timezone, rather than as UTC
3905
  # $matches[1] is YYYY-MM-DD-HHmm, to be interpreted as being the local timezone
3906
  $btime2 = strtotime($matches[1]);
3907
- $btime = (!empty($offset)) ? $btime2 - $gmt_offset*3600 : $btime2;
3908
-
3909
  $nonce = $matches[2];
3910
  $type = $matches[3];
3911
  if ('db' == $type) {
@@ -4021,7 +4020,7 @@ ENDHERE;
4021
  }
4022
  $itext = ($index == 0) ? '' : $index;
4023
  $btime2 = strtotime($matches[1]);
4024
- $btime = (!empty($offset)) ? $btime2 - $gmt_offset*3600 : $btime2;
4025
 
4026
  if (isset($known_nonces[$nonce])) $btime = $known_nonces[$nonce];
4027
  if ($btime <= 100) continue;
@@ -4374,7 +4373,6 @@ ENDHERE;
4374
 
4375
  }
4376
 
4377
-
4378
  if (!validate_current_theme()) {
4379
  global $updraftplus;
4380
  echo '<strong>';
3904
  // Interpret the time as one from the blog's local timezone, rather than as UTC
3905
  # $matches[1] is YYYY-MM-DD-HHmm, to be interpreted as being the local timezone
3906
  $btime2 = strtotime($matches[1]);
3907
+ $btime = (!empty($gmt_offset)) ? $btime2 - $gmt_offset*3600 : $btime2;
 
3908
  $nonce = $matches[2];
3909
  $type = $matches[3];
3910
  if ('db' == $type) {
4020
  }
4021
  $itext = ($index == 0) ? '' : $index;
4022
  $btime2 = strtotime($matches[1]);
4023
+ $btime = (!empty($gmt_offset)) ? $btime2 - $gmt_offset*3600 : $btime2;
4024
 
4025
  if (isset($known_nonces[$nonce])) $btime = $known_nonces[$nonce];
4026
  if ($btime <= 100) continue;
4373
 
4374
  }
4375
 
 
4376
  if (!validate_current_theme()) {
4377
  global $updraftplus;
4378
  echo '<strong>';
backup.php CHANGED
@@ -269,6 +269,8 @@ class UpdraftPlus_Backup {
269
  if (count($services) >1 && !empty($updraftplus->no_checkin_last_time)) {
270
  $updraftplus->log('No check-in last time: will try a different remote service first');
271
  array_push($services, array_shift($services));
 
 
272
  if (1 == ($updraftplus->current_resumption % 2) && count($services)>2) array_push($services, array_shift($services));
273
  }
274
 
@@ -395,7 +397,8 @@ class UpdraftPlus_Backup {
395
  foreach ($backup_to_examine as $key => $data) {
396
  if ('db' != strtolower(substr($key, 0, 2)) || '-size' == substr($key, -5, 5)) continue;
397
 
398
- if ($is_autobackup && $database_backups_found[$key] < $updraft_retain_db) {
 
399
  $updraftplus->log("This backup set ($backup_datestamp) was an automatic backup, and we have not yet reached the retain limit, so it will not be counted or pruned. Skipping.");
400
  continue;
401
  }
269
  if (count($services) >1 && !empty($updraftplus->no_checkin_last_time)) {
270
  $updraftplus->log('No check-in last time: will try a different remote service first');
271
  array_push($services, array_shift($services));
272
+ // Make sure that the 'no worthwhile activity' detector isn't flumoxed by the starting of a new upload at 0%
273
+ if ($updraftplus->current_resumption > 9) $updraftplus->jobdata_set('uploaded_lastreset', $updraftplus->current_resumption);
274
  if (1 == ($updraftplus->current_resumption % 2) && count($services)>2) array_push($services, array_shift($services));
275
  }
276
 
397
  foreach ($backup_to_examine as $key => $data) {
398
  if ('db' != strtolower(substr($key, 0, 2)) || '-size' == substr($key, -5, 5)) continue;
399
 
400
+ $how_many_found = (empty($database_backups_found[$key])) ? 0 : $database_backups_found[$key];
401
+ if ($is_autobackup && $how_many_found < $updraft_retain_db) {
402
  $updraftplus->log("This backup set ($backup_datestamp) was an automatic backup, and we have not yet reached the retain limit, so it will not be counted or pruned. Skipping.");
403
  continue;
404
  }
includes/Dropbox/Exception.php CHANGED
@@ -6,8 +6,11 @@
6
  * @link https://github.com/benthedesigner/dropbox
7
  * @package Dropbox
8
  */
 
9
  class Dropbox_Exception extends Exception {
10
  }
 
 
11
  class Dropbox_BadRequestException extends Exception {
12
  }
13
 
6
  * @link https://github.com/benthedesigner/dropbox
7
  * @package Dropbox
8
  */
9
+ if (!class_exists('Dropbox_Exception')):
10
  class Dropbox_Exception extends Exception {
11
  }
12
+ endif;
13
+
14
  class Dropbox_BadRequestException extends Exception {
15
  }
16
 
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: Backup with UpdraftPlus, DavidAnderson
3
  Tags: backup, backups, restore, amazon backup, s3 backup, dropbox backup, google drive backup, rackspace cloud files, rackspace backup, cloud files, dreamhost, dreamobjects backup, ftp backup, webdav backup, google cloud storage, cloudian, cloudn, connectria, constant cloud, eucalyptus, nifty, nimbula, back up, multisite, restoration, sftp backup, ftps, scp, migrate, duplicate, copy, mysql backup, database backup, db backup, website backup, wordpress backup, full backup, openstack, swift
4
  Requires at least: 3.2
5
  Tested up to: 4.1
6
- Stable tag: 1.9.44
7
  Author URI: http://updraftplus.com
8
  Donate link: http://david.dw-perspective.org.uk/donate
9
  License: GPLv3 or later
@@ -153,9 +153,14 @@ Thanks for asking - yes, I have. Check out my profile page - http://profiles.wor
153
 
154
  The <a href="http://updraftplus.com/news/">UpdraftPlus backup blog</a> is the best place to learn in more detail about any important changes.
155
 
 
 
 
 
 
156
  = 1.9.44 - 2014-12-13 =
157
 
158
- * Add new incomplete translations (ready for the wordpress.org change to take translation availability into account when searching for plugins): Norwegian Bokmål, Norwegian Nynorsk, Finnish, Hebrew, Catalan, Vietnamese, Bengali
159
  * FIX: Fix a failure to detect the progress properly for large backup sets, introduced in 1.9.40
160
 
161
  = 1.9.43 - 2014-12-11 =
@@ -1008,4 +1013,4 @@ Furthermore, reliance upon any non-English translation is at your own risk. Updr
1008
 
1009
 
1010
  == Upgrade Notice ==
1011
- * 1.9.44 : New translations + fix a bug that could affect large backups on slow webservers.
3
  Tags: backup, backups, restore, amazon backup, s3 backup, dropbox backup, google drive backup, rackspace cloud files, rackspace backup, cloud files, dreamhost, dreamobjects backup, ftp backup, webdav backup, google cloud storage, cloudian, cloudn, connectria, constant cloud, eucalyptus, nifty, nimbula, back up, multisite, restoration, sftp backup, ftps, scp, migrate, duplicate, copy, mysql backup, database backup, db backup, website backup, wordpress backup, full backup, openstack, swift
4
  Requires at least: 3.2
5
  Tested up to: 4.1
6
+ Stable tag: 1.9.45
7
  Author URI: http://updraftplus.com
8
  Donate link: http://david.dw-perspective.org.uk/donate
9
  License: GPLv3 or later
153
 
154
  The <a href="http://updraftplus.com/news/">UpdraftPlus backup blog</a> is the best place to learn in more detail about any important changes.
155
 
156
+ = 1.9.45 - 2014-12-20 =
157
+
158
+ * FIX: Fix case in which the database imported from a BackWPUp backup could be falsely identified as missing (introduced in 1.9.40)
159
+ * FIX: WordPress installs with ALTERNATE_WP_CRON set could skip some scheduled backups (since 1.9.19, so it appears that the conditions required to cause this bug are rare)
160
+
161
  = 1.9.44 - 2014-12-13 =
162
 
163
+ * TRANSLATIONS: Add new incomplete translations (ready for the wordpress.org change to take translation availability into account when searching for plugins): Norwegian Bokmål, Norwegian Nynorsk, Finnish, Hebrew, Catalan, Vietnamese, Bengali
164
  * FIX: Fix a failure to detect the progress properly for large backup sets, introduced in 1.9.40
165
 
166
  = 1.9.43 - 2014-12-11 =
1013
 
1014
 
1015
  == Upgrade Notice ==
1016
+ * 1.9.45 : Fix bug (since 1.9.19) that could cause scheduled backups to be skipped if using ALTERNATE_WP_CRON in wp-config.php
updraftplus.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: UpdraftPlus - Backup/Restore
4
  Plugin URI: http://updraftplus.com
5
  Description: Backup and restore: take backups locally, or backup to Amazon S3, Dropbox, Google Drive, Rackspace, (S)FTP, WebDAV & email, on automatic schedules.
6
  Author: UpdraftPlus.Com, DavidAnderson
7
- Version: 1.9.44
8
  Donate link: http://david.dw-perspective.org.uk/donate
9
  License: GPLv3 or later
10
  Text Domain: updraftplus
@@ -71,7 +71,29 @@ function updraftplus_modify_cron_schedules($schedules) {
71
  add_filter('cron_schedules', 'updraftplus_modify_cron_schedules', 30);
72
 
73
  // The checks here before loading are for performance only - unless one of those conditions is met, then none of the hooks will ever be used
74
- if (!is_admin() && (!defined('DOING_CRON') || !DOING_CRON) && (!defined('XMLRPC_REQUEST') || !XMLRPC_REQUEST) && empty($_SERVER['SHELL']) && empty($_SERVER['USER'])) return;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
75
 
76
  $updraftplus_have_addons = 0;
77
  if (is_dir(UPDRAFTPLUS_DIR.'/addons') && $dir_handle = opendir(UPDRAFTPLUS_DIR.'/addons')) {
4
  Plugin URI: http://updraftplus.com
5
  Description: Backup and restore: take backups locally, or backup to Amazon S3, Dropbox, Google Drive, Rackspace, (S)FTP, WebDAV & email, on automatic schedules.
6
  Author: UpdraftPlus.Com, DavidAnderson
7
+ Version: 1.9.45
8
  Donate link: http://david.dw-perspective.org.uk/donate
9
  License: GPLv3 or later
10
  Text Domain: updraftplus
71
  add_filter('cron_schedules', 'updraftplus_modify_cron_schedules', 30);
72
 
73
  // The checks here before loading are for performance only - unless one of those conditions is met, then none of the hooks will ever be used
74
+
75
+ if (!is_admin() && (!defined('DOING_CRON') || !DOING_CRON) && (!defined('XMLRPC_REQUEST') || !XMLRPC_REQUEST) && empty($_SERVER['SHELL']) && empty($_SERVER['USER'])) {
76
+ // There is no good way to work out if the cron event is likely to be called under the ALTERNATE_WP_CRON system, other than re-running the calculation
77
+
78
+ // If ALTERNATE_WP_CRON is not active, then we are done
79
+ if ( !defined('ALTERNATE_WP_CRON') || !ALTERNATE_WP_CRON || !empty($_POST) || defined('DOING_AJAX') || isset($_GET['doing_wp_cron'])) return;
80
+
81
+ // The check below is the one used by spawn_cron() to decide whether cron events should be run
82
+ $lock = get_transient('doing_cron');
83
+ if ( $lock > $gmt_time + 10 * 60 ) $lock = 0;
84
+ if ( $lock + WP_CRON_LOCK_TIMEOUT > $gmt_time ) return;
85
+ if (function_exists('_get_cron_array')) {
86
+ $crons = _get_cron_array();
87
+ } else {
88
+ $crons = get_option('cron');
89
+ }
90
+ if (!is_array($crons)) return;
91
+
92
+ $keys = array_keys( $crons );
93
+ $gmt_time = microtime( true );
94
+ if ( isset($keys[0]) && $keys[0] > $gmt_time ) return;
95
+ // If we got this far, then cron is going to be fired, so we do want to load all our hooks
96
+ }
97
 
98
  $updraftplus_have_addons = 0;
99
  if (is_dir(UPDRAFTPLUS_DIR.'/addons') && $dir_handle = opendir(UPDRAFTPLUS_DIR.'/addons')) {