UpdraftPlus WordPress Backup Plugin - Version 1.4.11

Version Description

  • 02/13/2013 =
  • Various branding tweaks - launch of updraftplus.com
  • Important fix for people with non-encrypted database backups
Download this release

Release Info

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

Code changes from version 1.4.10 to 1.4.11

Files changed (2) hide show
  1. readme.txt +4 -3
  2. updraftplus.php +17 -16
readme.txt CHANGED
@@ -3,13 +3,13 @@ Contributors: David Anderson
3
  Tags: backup, restore, database, cloud, amazon, s3, dropbox, google drive, ftp, cloud, back up, multisite
4
  Requires at least: 3.2
5
  Tested up to: 3.5.1
6
- Stable tag: 1.4.10
7
  Author URI: http://updraftplus.com
8
  Donate link: http://david.dw-perspective.org.uk/donate
9
  License: GPLv3 or later
10
 
11
  == Upgrade Notice ==
12
- Various branding tweaks
13
 
14
  == Description ==
15
 
@@ -100,8 +100,9 @@ Thanks for asking - yes, I have. Check out my profile page - http://profiles.wor
100
 
101
  == Changelog ==
102
 
103
- = 1.4.10 - 02/13/2013 =
104
  * Various branding tweaks - <a href="http://updraftplus.com">launch of updraftplus.com</a>
 
105
 
106
  = 1.4.9 - 02/12/2013 =
107
  * Do more when testing Amazon S3 connectivity (catches users with bucket but not file access)
3
  Tags: backup, restore, database, cloud, amazon, s3, dropbox, google drive, ftp, cloud, back up, multisite
4
  Requires at least: 3.2
5
  Tested up to: 3.5.1
6
+ Stable tag: 1.4.11
7
  Author URI: http://updraftplus.com
8
  Donate link: http://david.dw-perspective.org.uk/donate
9
  License: GPLv3 or later
10
 
11
  == Upgrade Notice ==
12
+ Important fix for people backing up databases without encryption
13
 
14
  == Description ==
15
 
100
 
101
  == Changelog ==
102
 
103
+ = 1.4.11 - 02/13/2013 =
104
  * Various branding tweaks - <a href="http://updraftplus.com">launch of updraftplus.com</a>
105
+ * Important fix for people with non-encrypted database backups
106
 
107
  = 1.4.9 - 02/12/2013 =
108
  * Do more when testing Amazon S3 connectivity (catches users with bucket but not file access)
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 email, on separate schedules.
6
  Author: David Anderson
7
- Version: 1.4.10
8
  Donate link: http://david.dw-perspective.org.uk/donate
9
  License: GPLv3 or later
10
  Author URI: http://wordshell.net
@@ -30,6 +30,7 @@ TODO
30
  // Expert setting: force PCLZip
31
  // Don't stop at 10 retries if something useful is still measurably being done (in particular, chunked uploads are proceeding - set a flag to indicate "try it again")
32
  // Change FTP to use SSL by default
 
33
  // When looking for files to delete, is the current encryption setting used? Should not be.
34
  // Create single zip, containing even WordPress itself
35
  // Have something reap any remaining .tmp files, e.g. once a week
@@ -299,7 +300,7 @@ class UpdraftPlus {
299
  $backup_database = $this->jobdata_get('backup_database');
300
 
301
  // The transient is read and written below (instead of using the existing variable) so that we can copy-and-paste this part as needed.
302
- if ($backup_database == "begun" || $backup_database == "finished" || $backup_database == "encrypted") {
303
  if ($backup_database == "begun") {
304
  if ($resumption_no > 0) {
305
  $this->log("Resuming creation of database dump");
@@ -327,7 +328,7 @@ class UpdraftPlus {
327
  if (isset($our_files['db']) && !preg_match("/\.crypt$/", $our_files['db'])) {
328
  $our_files['db'] = $this->encrypt_file($our_files['db']);
329
  $this->save_backup_history($our_files);
330
- $this->jobdata_set("backup_database", "encrypted");
331
  }
332
 
333
  foreach ($our_files as $key => $file) {
@@ -560,11 +561,11 @@ class UpdraftPlus {
560
  $backup_files = $this->jobdata_get("backup_files");
561
  $backup_db = $this->jobdata_get("backup_database");
562
 
563
- if ($backup_files == "finished" && ( $backup_db == "finished" || $backup_db == "encrypted" ) ) {
564
  $backup_contains = "Files and database";
565
  } elseif ($backup_files == "finished") {
566
  $backup_contains = ($backup_db == "begun") ? "Files (database backup has not completed)" : "Files only (database was not part of this particular schedule)";
567
- } elseif ($backup_db == "finished" || $backup_db == "encrypted") {
568
  $backup_contains = ($backup_files == "begun") ? "Database (files backup has not completed)" : "Database only (files were not part of this particular schedule)";
569
  } else {
570
  $backup_contains = "Unknown/unexpected error - please raise a support request";
@@ -802,13 +803,13 @@ class UpdraftPlus {
802
 
803
  $updraft_dir = $this->backups_dir_location();
804
  if(!is_writable($updraft_dir)) {
805
- $this->log('Backup directory is not writable, or does not exist');
806
- $this->error('Backup directory is not writable, or does not exist.');
807
  return array();
808
  }
809
 
810
  //get the blog name and rip out all non-alphanumeric chars other than _
811
- $blog_name = str_replace(' ','_',get_bloginfo());
812
  $blog_name = preg_replace('/[^A-Za-z0-9_]/','', $blog_name);
813
  if(!$blog_name) $blog_name = 'non_alpha_name';
814
 
@@ -966,13 +967,13 @@ class UpdraftPlus {
966
  if (!$this->opened_log_time) $this->logfile_open($this->nonce);
967
 
968
  // Get the blog name and rip out all non-alphanumeric chars other than _
969
- $blog_name = preg_replace('/[^A-Za-z0-9_]/','', str_replace(' ','_', get_bloginfo()));
970
  if (!$blog_name) $blog_name = 'non_alpha_name';
971
  $file_base = 'backup_'.date('Y-m-d-Hi',$this->backup_time).'_'.$blog_name.'_'.$this->nonce;
972
  $backup_file_base = $updraft_dir.'/'.$file_base;
973
 
974
  if ("finished" == $already_done) return basename($backup_file_base.'-db.gz');
975
- if ("encrypted" == $already_done) return basename($backup_file_base.'-db.gz.crypt');
976
 
977
  $total_tables = 0;
978
 
@@ -982,8 +983,8 @@ class UpdraftPlus {
982
  $all_tables = array_map(create_function('$a', 'return $a[0];'), $all_tables);
983
 
984
  if (!is_writable($updraft_dir)) {
985
- $this->log('The backup directory is not writable.');
986
- $this->error('The backup directory is not writable.');
987
  return false;
988
  }
989
 
@@ -1058,7 +1059,7 @@ class UpdraftPlus {
1058
  $this->stow("/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;\n");
1059
  }
1060
 
1061
- $this->log($file_base.'-db.gz: finished writing out complete database file ('.round(filesize($backup_final_file_name/1024),1).' Kb)');
1062
  $this->close($this->dbhandle);
1063
 
1064
  foreach ($unlink_files as $unlink_file) {
@@ -1302,7 +1303,7 @@ class UpdraftPlus {
1302
  }
1303
 
1304
  function backups_dir_location() {
1305
- if (isset($this->backup_dir)) return $this->backup_dir;
1306
  $updraft_dir = untrailingslashit(UpdraftPlus_Options::get_updraft_option('updraft_dir'));
1307
  $default_backup_dir = WP_CONTENT_DIR.'/updraft';
1308
  //if the option isn't set, default it to /backups inside the upload dir
@@ -1608,7 +1609,7 @@ class UpdraftPlus {
1608
  return $this->url_start($urls,'www.updraftplus.com')."Check out UpdraftPlus.Com for help, add-ons and support".$this->url_end($urls,'www.updraftplus.com');
1609
  break;
1610
  case 8:
1611
- return "Want to say thank-you for UpdraftPlus? ".$this->url_start($urls,'updraftplus.com/shop')." Please buy our very cheap 'no adverts' add-on.".$this->url_end($urls,'updraftplus.com/shop');
1612
  break;
1613
  }
1614
  }
@@ -2253,7 +2254,7 @@ class UpdraftPlus {
2253
  }
2254
  }
2255
 
2256
- if ($this->zipfiles_added >= 0) {
2257
  // ZipArchive::addFile sometimes fails
2258
  if (filesize($destination) < 100) {
2259
  // Retry with PclZip
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 email, on separate schedules.
6
  Author: David Anderson
7
+ Version: 1.4.11
8
  Donate link: http://david.dw-perspective.org.uk/donate
9
  License: GPLv3 or later
10
  Author URI: http://wordshell.net
30
  // Expert setting: force PCLZip
31
  // Don't stop at 10 retries if something useful is still measurably being done (in particular, chunked uploads are proceeding - set a flag to indicate "try it again")
32
  // Change FTP to use SSL by default
33
+ // Tweak random_advert to not show the same one twice
34
  // When looking for files to delete, is the current encryption setting used? Should not be.
35
  // Create single zip, containing even WordPress itself
36
  // Have something reap any remaining .tmp files, e.g. once a week
300
  $backup_database = $this->jobdata_get('backup_database');
301
 
302
  // The transient is read and written below (instead of using the existing variable) so that we can copy-and-paste this part as needed.
303
+ if ($backup_database == "begun" || $backup_database == "finished" || $backup_database == 'encrypted') {
304
  if ($backup_database == "begun") {
305
  if ($resumption_no > 0) {
306
  $this->log("Resuming creation of database dump");
328
  if (isset($our_files['db']) && !preg_match("/\.crypt$/", $our_files['db'])) {
329
  $our_files['db'] = $this->encrypt_file($our_files['db']);
330
  $this->save_backup_history($our_files);
331
+ if (preg_match("/\.crypt$/", $our_files['db'])) $this->jobdata_set("backup_database", 'encrypted');
332
  }
333
 
334
  foreach ($our_files as $key => $file) {
561
  $backup_files = $this->jobdata_get("backup_files");
562
  $backup_db = $this->jobdata_get("backup_database");
563
 
564
+ if ($backup_files == "finished" && ( $backup_db == "finished" || $backup_db == 'encrypted' ) ) {
565
  $backup_contains = "Files and database";
566
  } elseif ($backup_files == "finished") {
567
  $backup_contains = ($backup_db == "begun") ? "Files (database backup has not completed)" : "Files only (database was not part of this particular schedule)";
568
+ } elseif ($backup_db == "finished" || $backup_db == 'encrypted') {
569
  $backup_contains = ($backup_files == "begun") ? "Database (files backup has not completed)" : "Database only (files were not part of this particular schedule)";
570
  } else {
571
  $backup_contains = "Unknown/unexpected error - please raise a support request";
803
 
804
  $updraft_dir = $this->backups_dir_location();
805
  if(!is_writable($updraft_dir)) {
806
+ $this->log("Backup directory ($updraft_dir) is not writable, or does not exist");
807
+ $this->error("Backup directory ($updraft_dir) is not writable, or does not exist.");
808
  return array();
809
  }
810
 
811
  //get the blog name and rip out all non-alphanumeric chars other than _
812
+ $blog_name = str_replace(' ','_',substr(get_bloginfo(), 0, 96));
813
  $blog_name = preg_replace('/[^A-Za-z0-9_]/','', $blog_name);
814
  if(!$blog_name) $blog_name = 'non_alpha_name';
815
 
967
  if (!$this->opened_log_time) $this->logfile_open($this->nonce);
968
 
969
  // Get the blog name and rip out all non-alphanumeric chars other than _
970
+ $blog_name = preg_replace('/[^A-Za-z0-9_]/','', str_replace(' ','_', substr(get_bloginfo(), 0, 96)));
971
  if (!$blog_name) $blog_name = 'non_alpha_name';
972
  $file_base = 'backup_'.date('Y-m-d-Hi',$this->backup_time).'_'.$blog_name.'_'.$this->nonce;
973
  $backup_file_base = $updraft_dir.'/'.$file_base;
974
 
975
  if ("finished" == $already_done) return basename($backup_file_base.'-db.gz');
976
+ if ('encrypted' == $already_done) return basename($backup_file_base.'-db.gz.crypt');
977
 
978
  $total_tables = 0;
979
 
983
  $all_tables = array_map(create_function('$a', 'return $a[0];'), $all_tables);
984
 
985
  if (!is_writable($updraft_dir)) {
986
+ $this->log("The backup directory ($updraft_dir) is not writable.");
987
+ $this->error("The backup directory ($updraft_dir) is not writable.");
988
  return false;
989
  }
990
 
1059
  $this->stow("/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;\n");
1060
  }
1061
 
1062
+ $this->log($file_base.'-db.gz: finished writing out complete database file ('.round(filesize($backup_final_file_name)/1024,1).' Kb)');
1063
  $this->close($this->dbhandle);
1064
 
1065
  foreach ($unlink_files as $unlink_file) {
1303
  }
1304
 
1305
  function backups_dir_location() {
1306
+ if (!empty($this->backup_dir)) return $this->backup_dir;
1307
  $updraft_dir = untrailingslashit(UpdraftPlus_Options::get_updraft_option('updraft_dir'));
1308
  $default_backup_dir = WP_CONTENT_DIR.'/updraft';
1309
  //if the option isn't set, default it to /backups inside the upload dir
1609
  return $this->url_start($urls,'www.updraftplus.com')."Check out UpdraftPlus.Com for help, add-ons and support".$this->url_end($urls,'www.updraftplus.com');
1610
  break;
1611
  case 8:
1612
+ return "Want to say thank-you for UpdraftPlus? ".$this->url_start($urls,'updraftplus.com/shop/')." Please buy our very cheap 'no adverts' add-on.".$this->url_end($urls,'updraftplus.com/shop/');
1613
  break;
1614
  }
1615
  }
2254
  }
2255
  }
2256
 
2257
+ if ($this->zipfiles_added > 0) {
2258
  // ZipArchive::addFile sometimes fails
2259
  if (filesize($destination) < 100) {
2260
  // Retry with PclZip