UpdraftPlus WordPress Backup Plugin - Version 1.1.8

Version Description

  • 12/31/2012 =
  • Big code re-factoring; cloud access methods now modularised, paving way for easier adding of new methods. Note that Google Drive users may need to re-authenticate - please check that your backups are working.
  • Fix bug whereby some resumptions of failed backups were erroneously cancelled
Download this release

Release Info

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

Code changes from version 1.1.6 to 1.1.8

Files changed (3) hide show
  1. methods/ftp.php +1 -0
  2. readme.txt +3 -2
  3. updraftplus.php +28 -20
methods/ftp.php CHANGED
@@ -17,6 +17,7 @@ class UpdraftPlus_BackupModule_ftp {
17
  $ftp_remote_path = trailingslashit(get_option('updraft_ftp_remote_path'));
18
  foreach($backup_array as $file) {
19
  $fullpath = trailingslashit(get_option('updraft_dir')).$file;
 
20
  if ($ftp->put($fullpath,$ftp_remote_path.$file,FTP_BINARY)) {
21
  $updraftplus->log("ERROR: $file_name: Successfully uploaded via FTP");
22
  $updraftplus->uploaded_file($file);
17
  $ftp_remote_path = trailingslashit(get_option('updraft_ftp_remote_path'));
18
  foreach($backup_array as $file) {
19
  $fullpath = trailingslashit(get_option('updraft_dir')).$file;
20
+ $updraftplus->log("FTP upload attempt: $file -> $ftp_remote_path/$file");
21
  if ($ftp->put($fullpath,$ftp_remote_path.$file,FTP_BINARY)) {
22
  $updraftplus->log("ERROR: $file_name: Successfully uploaded via FTP");
23
  $updraftplus->uploaded_file($file);
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: David Anderson
3
  Tags: backup, restore, database, cloud, amazon, s3, Amazon S3, google drive, google, gdrive, ftp, cloud, updraft, back up
4
  Requires at least: 3.2
5
  Tested up to: 3.5
6
- Stable tag: 1.1.6
7
  Donate link: http://david.dw-perspective.org.uk/donate
8
  License: GPLv3 or later
9
 
@@ -87,8 +87,9 @@ No, there's no warranty or guarantee, etc. It's completely up to you to verify t
87
 
88
  == Changelog ==
89
 
90
- = 1.1.6 - 12/31/2012 =
91
  * Big code re-factoring; cloud access methods now modularised, paving way for easier adding of new methods. Note that Google Drive users may need to re-authenticate - please check that your backups are working.
 
92
 
93
  = 1.0.16 - 12/24/2012 =
94
  * Improve race detection and clean up already-created files when detected
3
  Tags: backup, restore, database, cloud, amazon, s3, Amazon S3, google drive, google, gdrive, ftp, cloud, updraft, back up
4
  Requires at least: 3.2
5
  Tested up to: 3.5
6
+ Stable tag: 1.1.8
7
  Donate link: http://david.dw-perspective.org.uk/donate
8
  License: GPLv3 or later
9
 
87
 
88
  == Changelog ==
89
 
90
+ = 1.1.8 - 12/31/2012 =
91
  * Big code re-factoring; cloud access methods now modularised, paving way for easier adding of new methods. Note that Google Drive users may need to re-authenticate - please check that your backups are working.
92
+ * Fix bug whereby some resumptions of failed backups were erroneously cancelled
93
 
94
  = 1.0.16 - 12/24/2012 =
95
  * Improve race detection and clean up already-created files when detected
updraftplus.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: UpdraftPlus - Backup/Restore
4
  Plugin URI: http://wordpress.org/extend/plugins/updraftplus
5
  Description: Uploads, themes, plugins, and your DB can be automatically backed up to Amazon S3, Google Drive, FTP, or emailed, on separate schedules.
6
  Author: David Anderson.
7
- Version: 1.1.6
8
  Donate link: http://david.dw-perspective.org.uk/donate
9
  License: GPLv3 or later
10
  Author URI: http://wordshell.net
@@ -56,7 +56,7 @@ define('UPDRAFT_DEFAULT_OTHERS_EXCLUDE','upgrade,cache,updraft,index.php');
56
 
57
  class UpdraftPlus {
58
 
59
- var $version = '1.1.6';
60
 
61
  // Choices will be shown in the admin menu in the order used here
62
  var $backup_methods = array (
@@ -193,7 +193,7 @@ class UpdraftPlus {
193
 
194
  $this->log("Resume backup ($resumption_no): finish run");
195
 
196
- $this->backup_finish($next_resumption);
197
 
198
  }
199
 
@@ -244,17 +244,8 @@ class UpdraftPlus {
244
  @ignore_user_abort(true);
245
  //generate backup information
246
  $this->backup_time_nonce();
247
- // If we don't finish in 3 hours, then we won't finish
248
- // This transient indicates the identity of the current backup job (which can be used to find the files and logfile)
249
- set_transient("updraftplus_backup_job_nonce",$this->nonce,3600*3);
250
- set_transient("updraftplus_backup_job_time",$this->backup_time,3600*3);
251
- $this->logfile_open($this->nonce);
252
 
253
- // Schedule the even to run later, which checks on success and can resume the backup
254
- // We save the time to a variable because it is needed for un-scheduling
255
- $resume_delay = 300;
256
- wp_schedule_single_event(time()+$resume_delay, 'updraft_backup_resume', array(1));
257
- $this->log("In case we run out of time, scheduled a resumption at: $resume_delay seconds from now");
258
 
259
  // Log some information that may be helpful
260
  global $wp_version;
@@ -270,9 +261,24 @@ class UpdraftPlus {
270
 
271
  $this->log("Processed schedules. Tasks now: Backup files: $backup_files Backup DB: $backup_database");
272
 
 
 
273
  # Possibly now nothing is to be done, except to close the log file
274
  if ($backup_files || $backup_database) {
275
 
 
 
 
 
 
 
 
 
 
 
 
 
 
276
  $backup_contains = "";
277
 
278
  $backup_array = array();
@@ -317,23 +323,25 @@ class UpdraftPlus {
317
  $this->save_last_backup($backup_array);
318
 
319
  // Send the email
320
- $this->cloud_backup_finish($backup_array);
321
 
322
  }
323
 
324
  // Close log file; delete and also delete transients if not in debug mode
325
- $this->backup_finish(1);
326
 
327
  }
328
 
329
- function backup_finish($cancel_event) {
330
 
331
  // In fact, leaving the hook to run (if debug is set) is harmless, as the resume job should only do tasks that were left unfinished, which at this stage is none.
332
  if (empty($this->errors)) {
333
- $this->log("There were no errors in the uploads, so the 'resume' event is being unscheduled");
334
- wp_clear_scheduled_hook('updraft_backup_resume', array($cancel_event));
335
- delete_transient("updraftplus_backup_job_nonce");
336
- delete_transient("updraftplus_backup_job_time");
 
 
337
  } else {
338
  $this->log("There were errors in the uploads, so the 'resume' event is remaining scheduled");
339
  }
4
  Plugin URI: http://wordpress.org/extend/plugins/updraftplus
5
  Description: Uploads, themes, plugins, and your DB can be automatically backed up to Amazon S3, Google Drive, FTP, or emailed, on separate schedules.
6
  Author: David Anderson.
7
+ Version: 1.1.8
8
  Donate link: http://david.dw-perspective.org.uk/donate
9
  License: GPLv3 or later
10
  Author URI: http://wordshell.net
56
 
57
  class UpdraftPlus {
58
 
59
+ var $version = '1.1.8';
60
 
61
  // Choices will be shown in the admin menu in the order used here
62
  var $backup_methods = array (
193
 
194
  $this->log("Resume backup ($resumption_no): finish run");
195
 
196
+ $this->backup_finish($next_resumption, true);
197
 
198
  }
199
 
244
  @ignore_user_abort(true);
245
  //generate backup information
246
  $this->backup_time_nonce();
 
 
 
 
 
247
 
248
+ $this->logfile_open($this->nonce);
 
 
 
 
249
 
250
  // Log some information that may be helpful
251
  global $wp_version;
261
 
262
  $this->log("Processed schedules. Tasks now: Backup files: $backup_files Backup DB: $backup_database");
263
 
264
+ $clear_nonce_transient = false;
265
+
266
  # Possibly now nothing is to be done, except to close the log file
267
  if ($backup_files || $backup_database) {
268
 
269
+ $clear_nonce_transient = true;
270
+
271
+ // Do not set the transient or schedule the resume event until now, when we know there is something to do - otherwise 'vacatated' runs (when the database is on the same schedule as the files, and they get combined, leading to an empty run) can over-write the resume event and prevent resumption (because it is 'successful' - there was nothing to do).
272
+ // If we don't finish in 3 hours, then we won't finish
273
+ // This transient indicates the identity of the current backup job (which can be used to find the files and logfile)
274
+ set_transient("updraftplus_backup_job_nonce",$this->nonce,3600*3);
275
+ set_transient("updraftplus_backup_job_time",$this->backup_time,3600*3);
276
+ // Schedule the even to run later, which checks on success and can resume the backup
277
+ // We save the time to a variable because it is needed for un-scheduling
278
+ $resume_delay = 300;
279
+ wp_schedule_single_event(time()+$resume_delay, 'updraft_backup_resume', array(1));
280
+ $this->log("In case we run out of time, scheduled a resumption at: $resume_delay seconds from now");
281
+
282
  $backup_contains = "";
283
 
284
  $backup_array = array();
323
  $this->save_last_backup($backup_array);
324
 
325
  // Send the email
326
+ $this->cloud_backup_finish($backup_array, $clear_nonce_transient);
327
 
328
  }
329
 
330
  // Close log file; delete and also delete transients if not in debug mode
331
+ $this->backup_finish(1, $clear_nonce_transient);
332
 
333
  }
334
 
335
+ function backup_finish($cancel_event, $clear_nonce_transient) {
336
 
337
  // In fact, leaving the hook to run (if debug is set) is harmless, as the resume job should only do tasks that were left unfinished, which at this stage is none.
338
  if (empty($this->errors)) {
339
+ if ($clear_nonce_transient) {
340
+ $this->log("There were no errors in the uploads, so the 'resume' event is being unscheduled");
341
+ wp_clear_scheduled_hook('updraft_backup_resume', array($cancel_event));
342
+ delete_transient("updraftplus_backup_job_nonce");
343
+ delete_transient("updraftplus_backup_job_time");
344
+ }
345
  } else {
346
  $this->log("There were errors in the uploads, so the 'resume' event is remaining scheduled");
347
  }