UpdraftPlus WordPress Backup Plugin - Version 1.2.31

Version Description

  • 01/15/2013 =
  • Fixed bug with DropBox deletions
  • Fixed cases where DropBox failed to resume chunked uploading
  • Can now create uncreated zip files on a resumption attempt
  • FTP method now supports SSL (automatically detected)
  • New "Test FTP settings" button
  • Less noise when debugging is turned off
  • Fix bug (in 1.2.30) that prevented some database uploads completing
Download this release

Release Info

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

Code changes from version 1.2.30 to 1.2.31

Files changed (2) hide show
  1. readme.txt +3 -2
  2. updraftplus.php +30 -22
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: David Anderson
3
  Tags: backup, restore, database, cloud, amazon, s3, Amazon S3, DropBox, DropBox backup, 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.2.30
7
  Donate link: http://david.dw-perspective.org.uk/donate
8
  License: GPLv3 or later
9
 
@@ -120,13 +120,14 @@ Thanks for asking - yes, I have. Check out my profile page - http://profiles.wor
120
 
121
  == Changelog ==
122
 
123
- = 1.2.30 - 01/15/2013 =
124
  * Fixed bug with DropBox deletions
125
  * Fixed cases where DropBox failed to resume chunked uploading
126
  * Can now create uncreated zip files on a resumption attempt
127
  * FTP method now supports SSL (automatically detected)
128
  * New "Test FTP settings" button
129
  * Less noise when debugging is turned off
 
130
 
131
  = 1.2.20 - 01/12/2013 =
132
  * DropBox no longer limited to 150Mb uploads
3
  Tags: backup, restore, database, cloud, amazon, s3, Amazon S3, DropBox, DropBox backup, 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.2.31
7
  Donate link: http://david.dw-perspective.org.uk/donate
8
  License: GPLv3 or later
9
 
120
 
121
  == Changelog ==
122
 
123
+ = 1.2.31 - 01/15/2013 =
124
  * Fixed bug with DropBox deletions
125
  * Fixed cases where DropBox failed to resume chunked uploading
126
  * Can now create uncreated zip files on a resumption attempt
127
  * FTP method now supports SSL (automatically detected)
128
  * New "Test FTP settings" button
129
  * Less noise when debugging is turned off
130
+ * Fix bug (in 1.2.30) that prevented some database uploads completing
131
 
132
  = 1.2.20 - 01/12/2013 =
133
  * DropBox no longer limited to 150Mb uploads
updraftplus.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: UpdraftPlus - Backup/Restore
4
  Plugin URI: http://wordpress.org/extend/plugins/updraftplus
5
  Description: Backup and restore: your content and database can be automatically backed up to Amazon S3, DropBox, Google Drive, FTP or emailed, on separate schedules.
6
  Author: David Anderson.
7
- Version: 1.2.30
8
  Donate link: http://david.dw-perspective.org.uk/donate
9
  License: GPLv3 or later
10
  Author URI: http://wordshell.net
@@ -64,7 +64,7 @@ define('UPDRAFT_DEFAULT_OTHERS_EXCLUDE','upgrade,cache,updraft,index.php');
64
 
65
  class UpdraftPlus {
66
 
67
- var $version = '1.2.30';
68
 
69
  // Choices will be shown in the admin menu in the order used here
70
  var $backup_methods = array (
@@ -199,20 +199,24 @@ class UpdraftPlus {
199
  if (!isset($backup_history[$btime])) $this->log("Could not find a record in the database of a backup with this timestamp");
200
 
201
  $our_files=$backup_history[$btime];
 
 
202
  $undone_files = array();
203
 
204
  $backup_database = get_transient("updraft_backdb_".$bnonce);
205
 
206
  // The transient is read and written below (instead of using the existing variable) so that we can copy-and-paste this part as needed.
207
- if ($backup_database == "begun") {
208
- $this->log("Resuming creation of database dump");
209
- $db_backup = $this->backup_db();
210
- if(is_array($our_files)) $our_files['db'] = $db_backup;
 
 
 
 
211
  $backup_contains = get_transient("updraft_backupcontains_".$this->nonce);
212
  $backup_contains = (substr($backup_contains,0,10) == "Files only") ? "Files and database" : "Database only (no files)";
213
  set_transient("updraft_backupcontains_".$this->nonce, $backup_contains, 3600*3);
214
- } elseif ($backup_database == "finished") {
215
- $this->log("Database dump: Creation was completed already");
216
  } else {
217
  $this->log("Unrecognised data when trying to ascertain if the database was backed up ($backup_database)");
218
  }
@@ -316,7 +320,7 @@ class UpdraftPlus {
316
  } else {
317
  # This is not necessarily a backup run which is meant to contain files at all
318
  $this->log("This backup run is not intended for files - skipping");
319
- return null;
320
  }
321
  // We want this array, even if already finished
322
  $backup_array = $this->backup_dirs($transient_status);
@@ -337,7 +341,8 @@ class UpdraftPlus {
337
 
338
  // Log some information that may be helpful
339
  global $wp_version;
340
- $this->log("PHP version: ".phpversion()." (".@php_uname().") WordPress version: ".$wp_version." Updraft version: ".$this->version." PHP Max Execution Time: ".@ini_get("max_execution_time")." Backup files: $backup_files (schedule: ".get_option('updraft_interval','unset').") Backup DB: $backup_database (schedule: ".get_option('updraft_interval_database','unset').")");
 
341
 
342
  # If the files and database schedules are the same, and if this the file one, then we rope in database too.
343
  # On the other hand, if the schedules were the same and this was the database run, then there is nothing to do.
@@ -393,7 +398,7 @@ class UpdraftPlus {
393
  if ($backup_database) {
394
  $this->log("Beginning backup of database");
395
  $db_backup = $this->backup_db();
396
- if(is_array($backup_array)) $backup_array['db'] = $db_backup;
397
  $backup_contains = get_transient("updraft_backupcontains_".$this->nonce);
398
  $backup_contains = (substr($backup_contains,0,10) == "Files only") ? "Files and database" : "Database only (no files)";
399
  set_transient("updraft_backupcontains_".$this->nonce, $backup_contains, 3600*3);
@@ -846,7 +851,18 @@ class UpdraftPlus {
846
  - When the writing finishes, it is renamed to ($final_filename).table
847
  - When all tables are finished, they are concatenated into the final file
848
  */
849
- function backup_db() {
 
 
 
 
 
 
 
 
 
 
 
850
 
851
  $total_tables = 0;
852
 
@@ -856,8 +872,7 @@ class UpdraftPlus {
856
  $all_tables = $wpdb->get_results("SHOW TABLES", ARRAY_N);
857
  $all_tables = array_map(create_function('$a', 'return $a[0];'), $all_tables);
858
 
859
- // Get the file prefix
860
- $updraft_dir = $this->backups_dir_location();
861
 
862
  if (!is_writable($updraft_dir)) {
863
  $this->log('The backup directory is not writable.');
@@ -865,13 +880,6 @@ class UpdraftPlus {
865
  return false;
866
  }
867
 
868
- // Get the blog name and rip out all non-alphanumeric chars other than _
869
- $blog_name = str_replace(' ','_',get_bloginfo());
870
- $blog_name = preg_replace('/[^A-Za-z0-9_]/','', $blog_name);
871
- if (!$blog_name) $blog_name = 'non_alpha_name';
872
- $file_base = 'backup_'.date('Y-m-d-Hi',$this->backup_time).'_'.$blog_name.'_'.$this->nonce;
873
- $backup_file_base = $updraft_dir.'/'.$file_base;
874
-
875
  $stitch_files = array();
876
 
877
  foreach ($all_tables as $table) {
@@ -933,7 +941,7 @@ class UpdraftPlus {
933
  $this->log("Total database tables backed up: $total_tables");
934
  return basename($backup_file_base.'-db.gz');
935
  }
936
-
937
  } //wp_db_backup
938
 
939
  /**
4
  Plugin URI: http://wordpress.org/extend/plugins/updraftplus
5
  Description: Backup and restore: your content and database can be automatically backed up to Amazon S3, DropBox, Google Drive, FTP or emailed, on separate schedules.
6
  Author: David Anderson.
7
+ Version: 1.2.31
8
  Donate link: http://david.dw-perspective.org.uk/donate
9
  License: GPLv3 or later
10
  Author URI: http://wordshell.net
64
 
65
  class UpdraftPlus {
66
 
67
+ var $version = '1.2.31';
68
 
69
  // Choices will be shown in the admin menu in the order used here
70
  var $backup_methods = array (
199
  if (!isset($backup_history[$btime])) $this->log("Could not find a record in the database of a backup with this timestamp");
200
 
201
  $our_files=$backup_history[$btime];
202
+ if (!is_array($our_files)) $our_files = array();
203
+
204
  $undone_files = array();
205
 
206
  $backup_database = get_transient("updraft_backdb_".$bnonce);
207
 
208
  // The transient is read and written below (instead of using the existing variable) so that we can copy-and-paste this part as needed.
209
+ if ($backup_database == "begun" || $backup_database == "finished") {
210
+ if ($backup_database == "begun") {
211
+ $this->log("Resuming creation of database dump");
212
+ } else {
213
+ $this->log("Database dump: Creation was completed already");
214
+ }
215
+ $db_backup = $this->backup_db($backup_database);
216
+ if(is_array($our_files) && is_string($db_backup)) $our_files['db'] = $db_backup;
217
  $backup_contains = get_transient("updraft_backupcontains_".$this->nonce);
218
  $backup_contains = (substr($backup_contains,0,10) == "Files only") ? "Files and database" : "Database only (no files)";
219
  set_transient("updraft_backupcontains_".$this->nonce, $backup_contains, 3600*3);
 
 
220
  } else {
221
  $this->log("Unrecognised data when trying to ascertain if the database was backed up ($backup_database)");
222
  }
320
  } else {
321
  # This is not necessarily a backup run which is meant to contain files at all
322
  $this->log("This backup run is not intended for files - skipping");
323
+ return array();
324
  }
325
  // We want this array, even if already finished
326
  $backup_array = $this->backup_dirs($transient_status);
341
 
342
  // Log some information that may be helpful
343
  global $wp_version;
344
+ $this->log("UpdraftPlus: ".$this->version." WordPress: ".$wp_version." PHP: ".phpversion()." (".@php_uname().") PHP Max Execution Time: ".@ini_get("max_execution_time"));
345
+ $this->log("Tasks: Backup files: $backup_files (schedule: ".get_option('updraft_interval','unset').") Backup DB: $backup_database (schedule: ".get_option('updraft_interval_database','unset').")");
346
 
347
  # If the files and database schedules are the same, and if this the file one, then we rope in database too.
348
  # On the other hand, if the schedules were the same and this was the database run, then there is nothing to do.
398
  if ($backup_database) {
399
  $this->log("Beginning backup of database");
400
  $db_backup = $this->backup_db();
401
+ if ($db_backup) $backup_array['db'] = $db_backup;
402
  $backup_contains = get_transient("updraft_backupcontains_".$this->nonce);
403
  $backup_contains = (substr($backup_contains,0,10) == "Files only") ? "Files and database" : "Database only (no files)";
404
  set_transient("updraft_backupcontains_".$this->nonce, $backup_contains, 3600*3);
851
  - When the writing finishes, it is renamed to ($final_filename).table
852
  - When all tables are finished, they are concatenated into the final file
853
  */
854
+ function backup_db($already_done = "begun") {
855
+
856
+ // Get the file prefix
857
+ $updraft_dir = $this->backups_dir_location();
858
+
859
+ // Get the blog name and rip out all non-alphanumeric chars other than _
860
+ $blog_name = preg_replace('/[^A-Za-z0-9_]/','', str_replace(' ','_', get_bloginfo()));
861
+ if (!$blog_name) $blog_name = 'non_alpha_name';
862
+ $file_base = 'backup_'.date('Y-m-d-Hi',$this->backup_time).'_'.$blog_name.'_'.$this->nonce;
863
+ $backup_file_base = $updraft_dir.'/'.$file_base;
864
+
865
+ if ("finished" == $already_done) return basename($backup_file_base.'-db.gz');
866
 
867
  $total_tables = 0;
868
 
872
  $all_tables = $wpdb->get_results("SHOW TABLES", ARRAY_N);
873
  $all_tables = array_map(create_function('$a', 'return $a[0];'), $all_tables);
874
 
875
+
 
876
 
877
  if (!is_writable($updraft_dir)) {
878
  $this->log('The backup directory is not writable.');
880
  return false;
881
  }
882
 
 
 
 
 
 
 
 
883
  $stitch_files = array();
884
 
885
  foreach ($all_tables as $table) {
941
  $this->log("Total database tables backed up: $total_tables");
942
  return basename($backup_file_base.'-db.gz');
943
  }
944
+
945
  } //wp_db_backup
946
 
947
  /**