UpdraftPlus WordPress Backup Plugin - Version 1.9.31

Version Description

  • 2014-10-24 =

  • TWEAK: Bitcasa now gives a deprecation warning (Bitcasa are closing down their API on November 15th 2014)

  • TWEAK: Fix bug causing PHP notices in Migrator add-on search/replace

  • TWEAK: Add support for Amazon S3's new Frankfurt region

  • TWEAK: Add work-around for bug in the ancient PHP 5.2.6 (May 2008!) if binary zip not available

Download this release

Release Info

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

Code changes from version 1.9.32 to 1.9.31

Files changed (4) hide show
  1. backup.php +1 -1
  2. class-zip.php +1 -1
  3. restorer.php +41 -45
  4. updraftplus.php +1 -1
backup.php CHANGED
@@ -1844,7 +1844,7 @@ class UpdraftPlus_Backup {
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
  }
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
  }
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.12', '>') && 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.6', '>') && defined('ZIPARCHIVE::CREATE')) ? ZIPARCHIVE::CREATE : 1;
238
 
239
  if ($flags == $ziparchive_create_match && file_exists($path)) @unlink($path);
240
 
restorer.php CHANGED
@@ -116,50 +116,51 @@ 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
- 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,9 +270,7 @@ class Updraft_Restorer extends WP_Upgrader {
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,10 +998,7 @@ class Updraft_Restorer extends WP_Upgrader {
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
  }
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
  // 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
  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
  }
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.32
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.31
8
  Donate link: http://david.dw-perspective.org.uk/donate
9
  License: GPLv3 or later
10
  Text Domain: updraftplus