Version Description
- 02/07/2013 =
- Amazon S3 now works for users with non-US buckets
- Further tweak to overlap detection
Download this release
Release Info
Developer | DavidAnderson |
Plugin | UpdraftPlus WordPress Backup Plugin |
Version | 1.4.6 |
Comparing to | |
See all releases |
Code changes from version 1.4.4 to 1.4.6
- methods/s3.php +9 -2
- readme.txt +3 -3
- updraftplus.php +9 -13
methods/s3.php
CHANGED
@@ -57,7 +57,10 @@ class UpdraftPlus_BackupModule_s3 {
|
|
57 |
// We upload in 5Mb chunks to allow more efficient resuming and hence uploading of larger files
|
58 |
// N.B.: 5Mb is Amazon's minimum. So don't go lower or you'll break it.
|
59 |
$fullpath = trailingslashit(UpdraftPlus_Options::get_updraft_option('updraft_dir')).$file;
|
60 |
-
$
|
|
|
|
|
|
|
61 |
$hash = md5($file);
|
62 |
|
63 |
$updraftplus->log("S3 upload ($region): $fullpath (chunks: $chunks) -> s3://$bucket_name/$bucket_path$file");
|
@@ -110,8 +113,12 @@ class UpdraftPlus_BackupModule_s3 {
|
|
110 |
$successes++;
|
111 |
array_push($etags, $etag);
|
112 |
} else {
|
|
|
|
|
|
|
|
|
113 |
$etag = $s3->uploadPart($bucket_name, $filepath, $uploadId, $fullpath, $i);
|
114 |
-
if (is_string($etag)) {
|
115 |
$updraftplus->record_uploaded_chunk(round(100*$i/$chunks,1), "$i, $etag");
|
116 |
array_push($etags, $etag);
|
117 |
set_transient("upd_${hash}_e$i", $etag, UPDRAFT_TRANSTIME);
|
57 |
// We upload in 5Mb chunks to allow more efficient resuming and hence uploading of larger files
|
58 |
// N.B.: 5Mb is Amazon's minimum. So don't go lower or you'll break it.
|
59 |
$fullpath = trailingslashit(UpdraftPlus_Options::get_updraft_option('updraft_dir')).$file;
|
60 |
+
$orig_file_size = filesize($fullpath);
|
61 |
+
$chunks = floor($orig_file_size / 5242880);
|
62 |
+
// There will be a remnant unless the file size was exactly on a 5Mb boundary
|
63 |
+
if ($orig_file_size % 5242880 > 0 ) $chunks++;
|
64 |
$hash = md5($file);
|
65 |
|
66 |
$updraftplus->log("S3 upload ($region): $fullpath (chunks: $chunks) -> s3://$bucket_name/$bucket_path$file");
|
113 |
$successes++;
|
114 |
array_push($etags, $etag);
|
115 |
} else {
|
116 |
+
// Sanity check: we've seen a case where an overlap was truncating the file from underneath us
|
117 |
+
if (filesize($fullpath) < $orig_file_size) {
|
118 |
+
$updraftplus->error("S3 error: $key: chunk $i: file was truncated underneath us (orig_size=$orig_file_size, now_size=".filesize($fullpath).")");
|
119 |
+
}
|
120 |
$etag = $s3->uploadPart($bucket_name, $filepath, $uploadId, $fullpath, $i);
|
121 |
+
if ($etag !== false && is_string($etag)) {
|
122 |
$updraftplus->record_uploaded_chunk(round(100*$i/$chunks,1), "$i, $etag");
|
123 |
array_push($etags, $etag);
|
124 |
set_transient("upd_${hash}_e$i", $etag, UPDRAFT_TRANSTIME);
|
readme.txt
CHANGED
@@ -3,12 +3,12 @@ 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.
|
7 |
Donate link: http://david.dw-perspective.org.uk/donate
|
8 |
License: GPLv3 or later
|
9 |
|
10 |
== Upgrade Notice ==
|
11 |
-
Amazon S3 now working with non-US buckets
|
12 |
|
13 |
== Description ==
|
14 |
|
@@ -145,7 +145,7 @@ Thanks for asking - yes, I have. Check out my profile page - http://profiles.wor
|
|
145 |
|
146 |
== Changelog ==
|
147 |
|
148 |
-
= 1.4.
|
149 |
* Amazon S3 now works for users with non-US buckets
|
150 |
* Further tweak to overlap detection
|
151 |
|
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.6
|
7 |
Donate link: http://david.dw-perspective.org.uk/donate
|
8 |
License: GPLv3 or later
|
9 |
|
10 |
== Upgrade Notice ==
|
11 |
+
Amazon S3 now working with non-US buckets. More overlap detection.
|
12 |
|
13 |
== Description ==
|
14 |
|
145 |
|
146 |
== Changelog ==
|
147 |
|
148 |
+
= 1.4.6 - 02/07/2013 =
|
149 |
* Amazon S3 now works for users with non-US buckets
|
150 |
* Further tweak to overlap detection
|
151 |
|
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.
|
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.
|
100 |
var $plugin_title = 'UpdraftPlus Backup/Restore';
|
101 |
|
102 |
// Choices will be shown in the admin menu in the order used here
|
@@ -129,7 +129,6 @@ class UpdraftPlus {
|
|
129 |
var $zipfiles_existingfiles;
|
130 |
var $zipfiles_dirbatched;
|
131 |
var $zipfiles_batched;
|
132 |
-
var $zipfiles_batched_size;
|
133 |
|
134 |
function __construct() {
|
135 |
// Initialisation actions - takes place on plugin load
|
@@ -2215,7 +2214,6 @@ class UpdraftPlus {
|
|
2215 |
$this->zipfiles_added = 0;
|
2216 |
$this->zipfiles_dirbatched = array();
|
2217 |
$this->zipfiles_batched = array();
|
2218 |
-
$this->zipfiles_batched_size = 0;
|
2219 |
|
2220 |
$last_error = -1;
|
2221 |
if (is_array($source)) {
|
@@ -2271,9 +2269,8 @@ class UpdraftPlus {
|
|
2271 |
$this->zipfiles_added++;
|
2272 |
if ($this->zipfiles_added % 100 == 0) $this->log("Zip: ".basename($zipfile).": ".$this->zipfiles_added." files added (size: ".round(filesize($zipfile)/1024,1)." Kb)");
|
2273 |
}
|
2274 |
-
// Reset the
|
2275 |
$this->zipfiles_batched = array();
|
2276 |
-
$this->zipfiles_batched_size = 0;
|
2277 |
return $zip->close();
|
2278 |
}
|
2279 |
|
@@ -2294,7 +2291,7 @@ class UpdraftPlus {
|
|
2294 |
if (is_readable($fullpath)) {
|
2295 |
$key = $use_path_when_storing.'/'.basename($fullpath);
|
2296 |
$this->zipfiles_batched[$fullpath] = $use_path_when_storing.'/'.basename($fullpath);
|
2297 |
-
|
2298 |
} else {
|
2299 |
$this->log("$fullpath: unreadable file");
|
2300 |
$this->error("$fullpath: unreadable file");
|
@@ -2313,7 +2310,7 @@ class UpdraftPlus {
|
|
2313 |
if (is_file($deref)) {
|
2314 |
if (is_readable($deref)) {
|
2315 |
$this->zipfiles_batched[$deref] = $use_path_when_storing.'/'.$e;
|
2316 |
-
|
2317 |
} else {
|
2318 |
$this->log("$deref: unreadable file");
|
2319 |
$this->error("$deref: unreadable file");
|
@@ -2324,7 +2321,7 @@ class UpdraftPlus {
|
|
2324 |
} elseif (is_file($fullpath.'/'.$e)) {
|
2325 |
if (is_readable($fullpath.'/'.$e)) {
|
2326 |
$this->zipfiles_batched[$fullpath.'/'.$e] = $use_path_when_storing.'/'.$e;
|
2327 |
-
|
2328 |
} else {
|
2329 |
$this->log("$fullpath/$e: unreadable file");
|
2330 |
$this->error("$fullpath/$e: unreadable file");
|
@@ -2339,10 +2336,9 @@ class UpdraftPlus {
|
|
2339 |
}
|
2340 |
|
2341 |
// We don't want to touch the zip file on every single file, so we batch them up
|
2342 |
-
// We go every 25 files, because if you wait too longer, the contents may have changed from under you
|
2343 |
-
// And we try to touch the file after
|
2344 |
-
|
2345 |
-
if (count($this->zipfiles_batched) > 25 || $this->zipfiles_batched_size > 1048576 || (file_exists($zipfile) && ((time()-filemtime($zipfile)) > 15) )) {
|
2346 |
$ret = $this->makezip_addfiles($zipfile);
|
2347 |
} else {
|
2348 |
$ret = true;
|
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.6
|
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.6';
|
100 |
var $plugin_title = 'UpdraftPlus Backup/Restore';
|
101 |
|
102 |
// Choices will be shown in the admin menu in the order used here
|
129 |
var $zipfiles_existingfiles;
|
130 |
var $zipfiles_dirbatched;
|
131 |
var $zipfiles_batched;
|
|
|
132 |
|
133 |
function __construct() {
|
134 |
// Initialisation actions - takes place on plugin load
|
2214 |
$this->zipfiles_added = 0;
|
2215 |
$this->zipfiles_dirbatched = array();
|
2216 |
$this->zipfiles_batched = array();
|
|
|
2217 |
|
2218 |
$last_error = -1;
|
2219 |
if (is_array($source)) {
|
2269 |
$this->zipfiles_added++;
|
2270 |
if ($this->zipfiles_added % 100 == 0) $this->log("Zip: ".basename($zipfile).": ".$this->zipfiles_added." files added (size: ".round(filesize($zipfile)/1024,1)." Kb)");
|
2271 |
}
|
2272 |
+
// Reset the array
|
2273 |
$this->zipfiles_batched = array();
|
|
|
2274 |
return $zip->close();
|
2275 |
}
|
2276 |
|
2291 |
if (is_readable($fullpath)) {
|
2292 |
$key = $use_path_when_storing.'/'.basename($fullpath);
|
2293 |
$this->zipfiles_batched[$fullpath] = $use_path_when_storing.'/'.basename($fullpath);
|
2294 |
+
@touch($zipfile);
|
2295 |
} else {
|
2296 |
$this->log("$fullpath: unreadable file");
|
2297 |
$this->error("$fullpath: unreadable file");
|
2310 |
if (is_file($deref)) {
|
2311 |
if (is_readable($deref)) {
|
2312 |
$this->zipfiles_batched[$deref] = $use_path_when_storing.'/'.$e;
|
2313 |
+
@touch($zipfile);
|
2314 |
} else {
|
2315 |
$this->log("$deref: unreadable file");
|
2316 |
$this->error("$deref: unreadable file");
|
2321 |
} elseif (is_file($fullpath.'/'.$e)) {
|
2322 |
if (is_readable($fullpath.'/'.$e)) {
|
2323 |
$this->zipfiles_batched[$fullpath.'/'.$e] = $use_path_when_storing.'/'.$e;
|
2324 |
+
@touch($zipfile);
|
2325 |
} else {
|
2326 |
$this->log("$fullpath/$e: unreadable file");
|
2327 |
$this->error("$fullpath/$e: unreadable file");
|
2336 |
}
|
2337 |
|
2338 |
// We don't want to touch the zip file on every single file, so we batch them up
|
2339 |
+
// We go every 25 files, because if you wait too much longer, the contents may have changed from under you
|
2340 |
+
// And for some redundancy (redundant because of the touches going on anyway), we try to touch the file after 20 seconds, to help with the "recently modified" check on resumption (we saw a case where the file went for 155 seconds without being touched and so the other runner was not detected)
|
2341 |
+
if (count($this->zipfiles_batched) > 25 || (file_exists($zipfile) && ((time()-filemtime($zipfile)) > 20) )) {
|
|
|
2342 |
$ret = $this->makezip_addfiles($zipfile);
|
2343 |
} else {
|
2344 |
$ret = true;
|