UpdraftPlus WordPress Backup Plugin - Version 1.4.8

Version Description

Tweak for some Amazon S3 EU West 1 bucket users

Download this release

Release Info

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

Code changes from version 1.4.7 to 1.4.8

Files changed (1) hide show
  1. updraftplus.php +13 -5
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.7
8
  Donate link: http://david.dw-perspective.org.uk/donate
9
  License: GPLv3 or later
10
  Author URI: http://wordshell.net
@@ -96,7 +96,7 @@ if (!class_exists('UpdraftPlus_Options')) require_once(UPDRAFTPLUS_DIR.'/options
96
 
97
  class UpdraftPlus {
98
 
99
- var $version = '1.4.7';
100
  var $plugin_title = 'UpdraftPlus Backup/Restore';
101
 
102
  // Choices will be shown in the admin menu in the order used here
@@ -130,6 +130,8 @@ class UpdraftPlus {
130
  var $zipfiles_dirbatched;
131
  var $zipfiles_batched;
132
 
 
 
133
  function __construct() {
134
  // Initialisation actions - takes place on plugin load
135
  # Create admin page
@@ -1043,7 +1045,7 @@ class UpdraftPlus {
1043
  $this->stow("/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;\n");
1044
  }
1045
 
1046
- $this->log($file_base.'-db.gz: finished writing out complete database file');
1047
  $this->close($this->dbhandle);
1048
 
1049
  foreach ($unlink_files as $unlink_files) {
@@ -2180,7 +2182,7 @@ class UpdraftPlus {
2180
  function make_zipfile($source, $destination) {
2181
 
2182
  // Fallback to PclZip - which my tests show is 25% slower
2183
- if (!method_exists('ZipArchive', 'addFile')) {
2184
  if(!class_exists('PclZip')) require_once(ABSPATH.'/wp-admin/includes/class-pclzip.php');
2185
  $zip_object = new PclZip($destination);
2186
  $zipcode = $zip_object->create($source, PCLZIP_OPT_REMOVE_PATH, WP_CONTENT_DIR);
@@ -2194,7 +2196,6 @@ class UpdraftPlus {
2194
 
2195
  $this->existing_files = array();
2196
 
2197
- // TODO: Resuming! :-)
2198
  // If the file exists, then we should grab its index of files inside, and sizes
2199
  // Then, when we come to write a file, we should check if it's already there, and only add if it is not
2200
  if (file_exists($destination) && is_readable($destination)) {
@@ -2239,6 +2240,13 @@ class UpdraftPlus {
2239
  }
2240
 
2241
  if ($this->zipfiles_added >= 0) {
 
 
 
 
 
 
 
2242
  return true;
2243
  } else {
2244
  return $last_error;
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.8
8
  Donate link: http://david.dw-perspective.org.uk/donate
9
  License: GPLv3 or later
10
  Author URI: http://wordshell.net
96
 
97
  class UpdraftPlus {
98
 
99
+ var $version = '1.4.8';
100
  var $plugin_title = 'UpdraftPlus Backup/Restore';
101
 
102
  // Choices will be shown in the admin menu in the order used here
130
  var $zipfiles_dirbatched;
131
  var $zipfiles_batched;
132
 
133
+ var $zip_preferpcl = false;
134
+
135
  function __construct() {
136
  // Initialisation actions - takes place on plugin load
137
  # Create admin page
1045
  $this->stow("/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;\n");
1046
  }
1047
 
1048
+ $this->log($file_base.'-db.gz: finished writing out complete database file ('.round(filesize($backup_final_file_name/1024),1).' Kb)');
1049
  $this->close($this->dbhandle);
1050
 
1051
  foreach ($unlink_files as $unlink_files) {
2182
  function make_zipfile($source, $destination) {
2183
 
2184
  // Fallback to PclZip - which my tests show is 25% slower
2185
+ if ($this->zip_preferpcl || !method_exists('ZipArchive', 'addFile')) {
2186
  if(!class_exists('PclZip')) require_once(ABSPATH.'/wp-admin/includes/class-pclzip.php');
2187
  $zip_object = new PclZip($destination);
2188
  $zipcode = $zip_object->create($source, PCLZIP_OPT_REMOVE_PATH, WP_CONTENT_DIR);
2196
 
2197
  $this->existing_files = array();
2198
 
 
2199
  // If the file exists, then we should grab its index of files inside, and sizes
2200
  // Then, when we come to write a file, we should check if it's already there, and only add if it is not
2201
  if (file_exists($destination) && is_readable($destination)) {
2240
  }
2241
 
2242
  if ($this->zipfiles_added >= 0) {
2243
+ // ZipArchive::addFile sometimes fails
2244
+ if (filesize($destination) < 100) {
2245
+ // Retry with PclZip
2246
+ $this->log("Zip::addFile apparently failed - retrying with PclZip");
2247
+ $this->zip_preferpcl = true;
2248
+ return $this->make_zipfile($source, $destination);
2249
+ }
2250
  return true;
2251
  } else {
2252
  return $last_error;