UpdraftPlus WordPress Backup Plugin - Version 1.9.32

Version Description

Download this release

Release Info

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

Code changes from version 1.9.30 to 1.9.32

Files changed (5) hide show
  1. backup.php +2 -2
  2. class-zip.php +1 -1
  3. readme.txt +8 -0
  4. restorer.php +45 -41
  5. updraftplus.php +1 -1
backup.php CHANGED
@@ -575,7 +575,7 @@ class UpdraftPlus_Backup {
575
  }
576
 
577
  $body = apply_filters('updraft_report_body',
578
- __('Backup of:').' '.site_url()."\r\n".
579
  "UpdraftPlus ".__('WordPress backup is complete','updraftplus').".\r\n".
580
  __('Backup contains:','updraftplus')." $backup_contains\r\n".
581
  __('Latest status:', 'updraftplus').' '.$final_message."\r\n".
@@ -1844,7 +1844,7 @@ class UpdraftPlus_Backup {
1844
  $original_size = filesize($zipfile);
1845
  clearstatcache();
1846
  } else {
1847
- $create_code = (defined('ZIPARCHIVE::CREATE')) ? ZIPARCHIVE::CREATE : 1;
1848
  $opencode = $zip->open($zipfile, $create_code);
1849
  $original_size = 0;
1850
  }
575
  }
576
 
577
  $body = apply_filters('updraft_report_body',
578
+ __('Backup of:', 'updraftplus').' '.site_url()."\r\n".
579
  "UpdraftPlus ".__('WordPress backup is complete','updraftplus').".\r\n".
580
  __('Backup contains:','updraftplus')." $backup_contains\r\n".
581
  __('Latest status:', 'updraftplus').' '.$final_message."\r\n".
1844
  $original_size = filesize($zipfile);
1845
  clearstatcache();
1846
  } else {
1847
+ $create_code = (version_compare(PHP_VERSION, '5.2.12', '>') && defined('ZIPARCHIVE::CREATE')) ? ZIPARCHIVE::CREATE : 1;
1848
  $opencode = $zip->open($zipfile, $create_code);
1849
  $original_size = 0;
1850
  }
class-zip.php CHANGED
@@ -234,7 +234,7 @@ class UpdraftPlus_PclZip {
234
  }
235
 
236
  # Route around PHP bug (exact version with the problem not known)
237
- $ziparchive_create_match = (version_compare(PHP_VERSION, '5.2.6', '>') && defined('ZIPARCHIVE::CREATE')) ? ZIPARCHIVE::CREATE : 1;
238
 
239
  if ($flags == $ziparchive_create_match && file_exists($path)) @unlink($path);
240
 
234
  }
235
 
236
  # Route around PHP bug (exact version with the problem not known)
237
+ $ziparchive_create_match = (version_compare(PHP_VERSION, '5.2.12', '>') && defined('ZIPARCHIVE::CREATE')) ? ZIPARCHIVE::CREATE : 1;
238
 
239
  if ($flags == $ziparchive_create_match && file_exists($path)) @unlink($path);
240
 
readme.txt CHANGED
@@ -146,6 +146,13 @@ Thanks for asking - yes, I have. Check out my profile page - http://profiles.wor
146
 
147
  The <a href="http://updraftplus.com/news/">UpdraftPlus backup blog</a> is the best place to learn in more detail about any important changes.
148
 
 
 
 
 
 
 
 
149
  = 1.9.30 - 2014-10-21 =
150
 
151
  * FEATURE: Add the capability to handle BackupWordPress database zip backups (https://updraftplus.com/shop/importer/)
@@ -164,6 +171,7 @@ The <a href="http://updraftplus.com/news/">UpdraftPlus backup blog</a> is the be
164
  * TWEAK: Alert user if they are trying to use Google Drive with a direct-IP address site URL forbidden by Google's policy
165
  * TWEAK: Prevent a corner-case where excessive logging could occur upon restoration
166
  * TWEAK: Be less strict with case when looking for supported patterns in the Importer add-on (https://updraftplus.com/shop/importer/)
 
167
  * DEPRECATED: Bitcasa support has been deprecated, and the links removed from the free version. (Existing Premium users using Bitcasa will continue to be able to do so). See: http://updraftplus.com/bitcasas-current-direction-unclear/
168
  * FIX: Fix corner-case in URL search/replace when migrating a site that had WP in a different directory to the site home, and migration to a sub-directory of the original site.
169
  * FIX: Autobackup setting (https://updraftplus.com/shop/autobackup/) failed to save properly if turned off on first usage
146
 
147
  The <a href="http://updraftplus.com/news/">UpdraftPlus backup blog</a> is the best place to learn in more detail about any important changes.
148
 
149
+ = 1.9.31 - 2014-10-24 =
150
+
151
+ * TWEAK: Bitcasa now gives a deprecation warning (Bitcasa are closing down their API on November 15th 2014)
152
+ * TWEAK: Fix bug causing PHP notices in Migrator add-on search/replace
153
+ * TWEAK: Add support for Amazon S3's new Frankfurt region
154
+ * TWEAK: Add work-around for bug in the ancient PHP 5.2.6 (May 2008!) if binary zip not available
155
+
156
  = 1.9.30 - 2014-10-21 =
157
 
158
  * FEATURE: Add the capability to handle BackupWordPress database zip backups (https://updraftplus.com/shop/importer/)
171
  * TWEAK: Alert user if they are trying to use Google Drive with a direct-IP address site URL forbidden by Google's policy
172
  * TWEAK: Prevent a corner-case where excessive logging could occur upon restoration
173
  * TWEAK: Be less strict with case when looking for supported patterns in the Importer add-on (https://updraftplus.com/shop/importer/)
174
+ * TWEAK: Search/replace the postmeta table faster
175
  * DEPRECATED: Bitcasa support has been deprecated, and the links removed from the free version. (Existing Premium users using Bitcasa will continue to be able to do so). See: http://updraftplus.com/bitcasas-current-direction-unclear/
176
  * FIX: Fix corner-case in URL search/replace when migrating a site that had WP in a different directory to the site home, and migration to a sub-directory of the original site.
177
  * FIX: Autobackup setting (https://updraftplus.com/shop/autobackup/) failed to save properly if turned off on first usage
restorer.php CHANGED
@@ -116,51 +116,50 @@ class Updraft_Restorer extends WP_Upgrader {
116
  } elseif ('.tar' == strtolower(substr($package, -4, 4)) || '.tar.gz' == strtolower(substr($package, -7, 7)) || '.tar.bz2' == strtolower(substr($package, -8, 8))) {
117
  if (!class_exists('UpdraftPlus_Archive_Tar')) {
118
  if (false === strpos(get_include_path(), UPDRAFTPLUS_DIR.'/includes/PEAR')) set_include_path(UPDRAFTPLUS_DIR.'/includes/PEAR'.PATH_SEPARATOR.get_include_path());
119
-
120
  require_once(UPDRAFTPLUS_DIR.'/includes/PEAR/Archive/Tar.php');
121
- $p_compress = null;
122
- if ('.tar.gz' == strtolower(substr($package, -7, 7))) {
123
- $p_compress = 'gz';
124
- } elseif ('.tar.bz2' == strtolower(substr($package, -8, 8))) {
125
- $p_compress = 'bz2';
126
- }
 
 
127
 
128
- # It's not pretty. But it works.
129
- if (is_a($wp_filesystem, 'WP_Filesystem_Direct')) {
130
- $extract_dir = $working_dir;
 
 
 
 
 
131
  } else {
132
- $updraft_dir = $updraftplus->backups_dir_location();
133
- if (!$updraftplus->really_is_writable($updraft_dir)) {
134
- $updraftplus->log_e("Backup directory (%s) is not writable, or does not exist.", $updraft_dir);
135
- $result = new WP_Error('unpack_failed', $this->strings['unpack_failed'], $tar->extract);
136
- } else {
137
- $extract_dir = $updraft_dir.'/'.basename($working_dir).'-old';
138
- if (file_exists($extract_dir)) $updraftplus->remove_local_directory($extract_dir);
139
- $updraftplus->log("Using a temporary folder to extract before moving over WPFS: $extract_dir");
140
- }
141
  }
142
- # Slightly hackish - rather than re-write Archive_Tar to use wp_filesystem, we instead unpack into the location that we already require to be directly writable for other reasons, and then move from there.
143
-
144
- if (empty($result)) {
145
-
146
- $this->ud_extract_count = 0;
147
- $this->ud_working_dir = trailingslashit($working_dir);
148
- $this->ud_extract_dir = untrailingslashit($extract_dir);
149
- $this->ud_made_dirs = array();
150
- add_filter('updraftplus_tar_wrote', array($this, 'tar_wrote'), 10, 2);
151
- $tar = new UpdraftPlus_Archive_Tar($package, $p_compress);
152
- $result = $tar->extract($extract_dir, false);
153
- if (!is_a($wp_filesystem, 'WP_Filesystem_Direct')) $updraftplus->remove_local_directory($extract_dir);
154
- if (true != $result) {
155
- $result = new WP_Error('unpack_failed', $this->strings['unpack_failed'], $result);
156
- } else {
157
- if (!is_a($wp_filesystem, 'WP_Filesystem_Direct')) {
158
- $updraftplus->log('Moved unpacked tarball contents');
159
- }
160
  }
161
- remove_filter('updraftplus_tar_wrote', array($this, 'tar_wrote'), 10, 2);
162
  }
163
-
164
  }
165
  }
166
 
@@ -270,7 +269,9 @@ class Updraft_Restorer extends WP_Upgrader {
270
  // Unpack package to working directory
271
  if ($updraftplus->is_db_encrypted($package)) {
272
  $this->skin->feedback('decrypt_database');
273
- $encryption = UpdraftPlus_Options::get_updraft_option('updraft_encryptionphrase');
 
 
274
  if (!$encryption) return new WP_Error('no_encryption_key', __('Decryption failed. The database file is encrypted, but you have no encryption key entered.', 'updraftplus'));
275
 
276
  $plaintext = $updraftplus->decrypt(false, $encryption, $wp_filesystem->get_contents($backup_dir.$package));
@@ -998,7 +999,10 @@ class Updraft_Restorer extends WP_Upgrader {
998
  if (isset($fdirnames[$name])) {
999
  $move_from = $working_dir . "/".$name;
1000
  } elseif (preg_match('/^([^\.].*)$/', $name, $fmatch)) {
1001
- $first_entry = $working_dir."/".$fmatch[1];
 
 
 
1002
  }
1003
  }
1004
  }
116
  } elseif ('.tar' == strtolower(substr($package, -4, 4)) || '.tar.gz' == strtolower(substr($package, -7, 7)) || '.tar.bz2' == strtolower(substr($package, -8, 8))) {
117
  if (!class_exists('UpdraftPlus_Archive_Tar')) {
118
  if (false === strpos(get_include_path(), UPDRAFTPLUS_DIR.'/includes/PEAR')) set_include_path(UPDRAFTPLUS_DIR.'/includes/PEAR'.PATH_SEPARATOR.get_include_path());
 
119
  require_once(UPDRAFTPLUS_DIR.'/includes/PEAR/Archive/Tar.php');
120
+ }
121
+
122
+ $p_compress = null;
123
+ if ('.tar.gz' == strtolower(substr($package, -7, 7))) {
124
+ $p_compress = 'gz';
125
+ } elseif ('.tar.bz2' == strtolower(substr($package, -8, 8))) {
126
+ $p_compress = 'bz2';
127
+ }
128
 
129
+ # It's not pretty. But it works.
130
+ if (is_a($wp_filesystem, 'WP_Filesystem_Direct')) {
131
+ $extract_dir = $working_dir;
132
+ } else {
133
+ $updraft_dir = $updraftplus->backups_dir_location();
134
+ if (!$updraftplus->really_is_writable($updraft_dir)) {
135
+ $updraftplus->log_e("Backup directory (%s) is not writable, or does not exist.", $updraft_dir);
136
+ $result = new WP_Error('unpack_failed', $this->strings['unpack_failed'], $tar->extract);
137
  } else {
138
+ $extract_dir = $updraft_dir.'/'.basename($working_dir).'-old';
139
+ if (file_exists($extract_dir)) $updraftplus->remove_local_directory($extract_dir);
140
+ $updraftplus->log("Using a temporary folder to extract before moving over WPFS: $extract_dir");
 
 
 
 
 
 
141
  }
142
+ }
143
+ # Slightly hackish - rather than re-write Archive_Tar to use wp_filesystem, we instead unpack into the location that we already require to be directly writable for other reasons, and then move from there.
144
+
145
+ if (empty($result)) {
146
+
147
+ $this->ud_extract_count = 0;
148
+ $this->ud_working_dir = trailingslashit($working_dir);
149
+ $this->ud_extract_dir = untrailingslashit($extract_dir);
150
+ $this->ud_made_dirs = array();
151
+ add_filter('updraftplus_tar_wrote', array($this, 'tar_wrote'), 10, 2);
152
+ $tar = new UpdraftPlus_Archive_Tar($package, $p_compress);
153
+ $result = $tar->extract($extract_dir, false);
154
+ if (!is_a($wp_filesystem, 'WP_Filesystem_Direct')) $updraftplus->remove_local_directory($extract_dir);
155
+ if (true != $result) {
156
+ $result = new WP_Error('unpack_failed', $this->strings['unpack_failed'], $result);
157
+ } else {
158
+ if (!is_a($wp_filesystem, 'WP_Filesystem_Direct')) {
159
+ $updraftplus->log('Moved unpacked tarball contents');
160
  }
 
161
  }
162
+ remove_filter('updraftplus_tar_wrote', array($this, 'tar_wrote'), 10, 2);
163
  }
164
  }
165
 
269
  // Unpack package to working directory
270
  if ($updraftplus->is_db_encrypted($package)) {
271
  $this->skin->feedback('decrypt_database');
272
+
273
+ $encryption = empty($_POST['updraft_encryptionphrase']) ? UpdraftPlus_Options::get_updraft_option('updraft_encryptionphrase') : $_POST['updraft_encryptionphrase'];
274
+
275
  if (!$encryption) return new WP_Error('no_encryption_key', __('Decryption failed. The database file is encrypted, but you have no encryption key entered.', 'updraftplus'));
276
 
277
  $plaintext = $updraftplus->decrypt(false, $encryption, $wp_filesystem->get_contents($backup_dir.$package));
999
  if (isset($fdirnames[$name])) {
1000
  $move_from = $working_dir . "/".$name;
1001
  } elseif (preg_match('/^([^\.].*)$/', $name, $fmatch)) {
1002
+ // In the case of a third-party backup, the first entry may be the wrong entity. We could try a more sophisticated algorithm, but a third party backup requiring one has never been seen (and it is not easy to envisage what the algorithm might be).
1003
+ if (empty($this->ud_foreign)) {
1004
+ $first_entry = $working_dir."/".$fmatch[1];
1005
+ }
1006
  }
1007
  }
1008
  }
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.30
8
  Donate link: http://david.dw-perspective.org.uk/donate
9
  License: GPLv3 or later
10
  Text Domain: updraftplus
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.32
8
  Donate link: http://david.dw-perspective.org.uk/donate
9
  License: GPLv3 or later
10
  Text Domain: updraftplus