Version Description
- 12/31/2012 =
- Big code re-factoring; cloud access methods now modularised, paving way for easier adding of new methods. Note that Google Drive users may need to re-authenticate - please check that your backups are working.
- Fix bug whereby some resumptions of failed backups were erroneously cancelled
- Database encryption made part of what is resumable
Download this release
Release Info
Developer | DavidAnderson |
Plugin | UpdraftPlus WordPress Backup Plugin |
Version | 1.1.9 |
Comparing to | |
See all releases |
Code changes from version 1.1.8 to 1.1.9
- readme.txt +19 -6
- updraftplus.php +59 -35
readme.txt
CHANGED
@@ -3,12 +3,12 @@ Contributors: David Anderson
|
|
3 |
Tags: backup, restore, database, cloud, amazon, s3, Amazon S3, google drive, google, gdrive, ftp, cloud, updraft, back up
|
4 |
Requires at least: 3.2
|
5 |
Tested up to: 3.5
|
6 |
-
Stable tag: 1.1.
|
7 |
Donate link: http://david.dw-perspective.org.uk/donate
|
8 |
License: GPLv3 or later
|
9 |
|
10 |
== Upgrade Notice ==
|
11 |
-
Big code re-organisation to make programming new cloud methods easier. Note that Google Drive users may need to re-authenticate - please check.
|
12 |
|
13 |
== Description ==
|
14 |
|
@@ -55,9 +55,15 @@ Finally, if you post in the WordPress support forum, then make sure you include
|
|
55 |
|
56 |
From version 0.9.0, UpdraftPlus features a resumption feature - if you wait 5 minutes and visit a page on your site, then it should re-try not-yet-uploaded files. If that fails, then turn on debugging and paste the debug log (log in via FTP, and look in wp-content/updraft) into the support forum.
|
57 |
|
58 |
-
=
|
59 |
|
60 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
|
62 |
= Anything essential to know? =
|
63 |
|
@@ -72,24 +78,31 @@ Unless you disable any of these, it will back up your database (all tables which
|
|
72 |
It does not back up WordPress core (since you can always get another copy of this from wordpress.org), and does not back up any extra files which you have added outside of the WordPress content directory (files which, by their nature, are unknown to WordPress). By default the WordPress content directory is "wp-content" in your WordPress root. It will not back up database tables which do not have the WordPress prefix (i.e. database tables from other applications but sharing a database with WordPress).
|
73 |
|
74 |
= Any known bugs ? =
|
|
|
75 |
Not a bug as such, but one major issue to be aware of is that backups of very large sites (lots of uploaded media) can fail due to timing out. This depends on how many seconds your web host allows a PHP process to run. With such sites, you need to use Amazon S3, which UpdraftPlus supports (since 0.9.20) or Google Drive (since 0.9.21) with chunked, resumable uploads. Other backup methods have code (since 0.9.0) to retry failed uploads of an archive, but the upload cannot be chunked, so if an archive is enormous (i.e. cannot be completely uploaded in the time that PHP is allowed for running on your web host) it cannot work.
|
76 |
|
77 |
= I encrypted my database - how do I decrypt it? =
|
78 |
|
79 |
-
If you have the encryption key entered in your settings and you are restoring from the settings interface, then it will automatically decrypt. Otherwise, use the file example-decrypt.php found in the plugin directory.
|
80 |
|
81 |
= I lost my encryption key - what can I do? =
|
82 |
|
83 |
Nothing, probably. That's the point of an encryption key - people who don't have it can't get the data. Hire an encryption expert to build a super computer to try to break the encryption by brute force, at a price.
|
84 |
|
85 |
= My site was hacked, and I have no backups! I thought UpdraftPlus was working! Can I kill you? =
|
|
|
86 |
No, there's no warranty or guarantee, etc. It's completely up to you to verify that UpdraftPlus is working correctly. If it doesn't then that's unfortunate, but this is a free plugin.
|
87 |
|
|
|
|
|
|
|
|
|
88 |
== Changelog ==
|
89 |
|
90 |
-
= 1.1.
|
91 |
* Big code re-factoring; cloud access methods now modularised, paving way for easier adding of new methods. Note that Google Drive users may need to re-authenticate - please check that your backups are working.
|
92 |
* Fix bug whereby some resumptions of failed backups were erroneously cancelled
|
|
|
93 |
|
94 |
= 1.0.16 - 12/24/2012 =
|
95 |
* Improve race detection and clean up already-created files when detected
|
3 |
Tags: backup, restore, database, cloud, amazon, s3, Amazon S3, google drive, google, gdrive, ftp, cloud, updraft, back up
|
4 |
Requires at least: 3.2
|
5 |
Tested up to: 3.5
|
6 |
+
Stable tag: 1.1.9
|
7 |
Donate link: http://david.dw-perspective.org.uk/donate
|
8 |
License: GPLv3 or later
|
9 |
|
10 |
== Upgrade Notice ==
|
11 |
+
Big code re-organisation to make programming new cloud methods easier. Note that Google Drive users may need to re-authenticate - please check. Also, more operations made resumable.
|
12 |
|
13 |
== Description ==
|
14 |
|
55 |
|
56 |
From version 0.9.0, UpdraftPlus features a resumption feature - if you wait 5 minutes and visit a page on your site, then it should re-try not-yet-uploaded files. If that fails, then turn on debugging and paste the debug log (log in via FTP, and look in wp-content/updraft) into the support forum.
|
57 |
|
58 |
+
= How do I restore my backup (from a site that is still installed/running)? =
|
59 |
|
60 |
+
If your site is still basically intact (in particular, the database), and if you backed up using a cloud method (e.g. Amazon S3, Google Drive, FTP), then on the UpdraftPlus settings page, there is a nice shiny 'Restore' button. Press it, and it will over-write your present files (not database) with those contained in the indicated backup set.
|
61 |
+
|
62 |
+
Again, if you backed up using a cloud method, then on UpdraftPlus's settings page, there should be a clickable link next to "Download Backups". Click on that link, and it will give you a set of further buttons, allowing you to download zip files of the various backed-up components. You can download those to your computer, and then unpack them, and copy them into your web space. (That's a very simple operation - but if you don't know how and don't have a friend to assist, then bung me a donation - http://david.dw-perspective.org.uk/donate - and I can help out).
|
63 |
+
|
64 |
+
= I want to restore, but have either cannot, or have failed to do so from the WP Admin console =
|
65 |
+
|
66 |
+
That's no problem. If you have access to your backed files (i.e. you have the emailed copies, or have obtained the backed up copies directly from Amazon S3, Google Drive, FTP or whatever store you wereusing), then you simply need to unzip them into the right places. UpdraftPlus does not back up the WordPress core - you can just get a fresh copy of that from www.wordpress.org. So, if you are starting from nothing, then first download and unzip a WordPress zip from www.wordpress.org. After doing that, then unzip the zip files for your uploads, themes, plugins and other filesback into the wp-content directory. Then re-install the database (e.g. by running it through PHPMyAdmin - see also the later question on how to decrypt if your database backup was encrypted). These are all basic operations and not difficult for anyone with simple skills; but if you need help and cannot find someone to assist, then send me a meaningful donation - http://david.dw-perspective.org.uk/donate - and I can help.
|
67 |
|
68 |
= Anything essential to know? =
|
69 |
|
78 |
It does not back up WordPress core (since you can always get another copy of this from wordpress.org), and does not back up any extra files which you have added outside of the WordPress content directory (files which, by their nature, are unknown to WordPress). By default the WordPress content directory is "wp-content" in your WordPress root. It will not back up database tables which do not have the WordPress prefix (i.e. database tables from other applications but sharing a database with WordPress).
|
79 |
|
80 |
= Any known bugs ? =
|
81 |
+
|
82 |
Not a bug as such, but one major issue to be aware of is that backups of very large sites (lots of uploaded media) can fail due to timing out. This depends on how many seconds your web host allows a PHP process to run. With such sites, you need to use Amazon S3, which UpdraftPlus supports (since 0.9.20) or Google Drive (since 0.9.21) with chunked, resumable uploads. Other backup methods have code (since 0.9.0) to retry failed uploads of an archive, but the upload cannot be chunked, so if an archive is enormous (i.e. cannot be completely uploaded in the time that PHP is allowed for running on your web host) it cannot work.
|
83 |
|
84 |
= I encrypted my database - how do I decrypt it? =
|
85 |
|
86 |
+
If you have the encryption key entered in your settings and you are restoring from the settings interface, then it will automatically decrypt. Otherwise, use the file example-decrypt.php found in the plugin directory; that will need very (very) minor PHP knowledge to use; find your local PHP guru, or bung me a donation (http://david.dw-perspective.org.uk/donate) and I can do it for you.
|
87 |
|
88 |
= I lost my encryption key - what can I do? =
|
89 |
|
90 |
Nothing, probably. That's the point of an encryption key - people who don't have it can't get the data. Hire an encryption expert to build a super computer to try to break the encryption by brute force, at a price.
|
91 |
|
92 |
= My site was hacked, and I have no backups! I thought UpdraftPlus was working! Can I kill you? =
|
93 |
+
|
94 |
No, there's no warranty or guarantee, etc. It's completely up to you to verify that UpdraftPlus is working correctly. If it doesn't then that's unfortunate, but this is a free plugin.
|
95 |
|
96 |
+
= Have you written any other free plugins? =
|
97 |
+
|
98 |
+
Thanks for asking - yes, I have. Check out my profile page - http://profiles.wordpress.org/DavidAnderson/ . I am also available for hire for bespoke work.
|
99 |
+
|
100 |
== Changelog ==
|
101 |
|
102 |
+
= 1.1.9 - 12/31/2012 =
|
103 |
* Big code re-factoring; cloud access methods now modularised, paving way for easier adding of new methods. Note that Google Drive users may need to re-authenticate - please check that your backups are working.
|
104 |
* Fix bug whereby some resumptions of failed backups were erroneously cancelled
|
105 |
+
* Database encryption made part of what is resumable
|
106 |
|
107 |
= 1.0.16 - 12/24/2012 =
|
108 |
* Improve race detection and clean up already-created files when detected
|
updraftplus.php
CHANGED
@@ -4,7 +4,7 @@ Plugin Name: UpdraftPlus - Backup/Restore
|
|
4 |
Plugin URI: http://wordpress.org/extend/plugins/updraftplus
|
5 |
Description: Uploads, themes, plugins, and your DB can be automatically backed up to Amazon S3, Google Drive, FTP, or emailed, on separate schedules.
|
6 |
Author: David Anderson.
|
7 |
-
Version: 1.1.
|
8 |
Donate link: http://david.dw-perspective.org.uk/donate
|
9 |
License: GPLv3 or later
|
10 |
Author URI: http://wordshell.net
|
@@ -56,7 +56,7 @@ define('UPDRAFT_DEFAULT_OTHERS_EXCLUDE','upgrade,cache,updraft,index.php');
|
|
56 |
|
57 |
class UpdraftPlus {
|
58 |
|
59 |
-
var $version = '1.1.
|
60 |
|
61 |
// Choices will be shown in the admin menu in the order used here
|
62 |
var $backup_methods = array (
|
@@ -168,7 +168,15 @@ class UpdraftPlus {
|
|
168 |
|
169 |
$our_files=$backup_history[$btime];
|
170 |
$undone_files = array();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
171 |
foreach ($our_files as $key => $file) {
|
|
|
172 |
$hash = md5($file);
|
173 |
$fullpath = trailingslashit(get_option('updraft_dir')).$file;
|
174 |
if (get_transient('updraft_'.$hash) === "yes") {
|
@@ -298,8 +306,8 @@ class UpdraftPlus {
|
|
298 |
if ($backup_database) {
|
299 |
$this->log("Beginning backup of database");
|
300 |
$db_backup = $this->backup_db();
|
301 |
-
//add db path to rest of files
|
302 |
-
if(is_array($backup_array))
|
303 |
$backup_contains = ($backup_files) ? "Files and database" : "Database only (no files)";
|
304 |
}
|
305 |
|
@@ -311,6 +319,13 @@ class UpdraftPlus {
|
|
311 |
// This is done before cloud despatch, because we want a record of what *should* be in the backup. Whether it actually makes it there or not is not yet known.
|
312 |
$this->save_backup_history($backup_array);
|
313 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
314 |
//cloud operations (S3,Google Drive,FTP,email,nothing)
|
315 |
//this also calls the retain (prune) feature at the end (done in this method to reuse existing cloud connections)
|
316 |
if(is_array($backup_array) && count($backup_array) >0) {
|
@@ -332,6 +347,40 @@ class UpdraftPlus {
|
|
332 |
|
333 |
}
|
334 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
335 |
function backup_finish($cancel_event, $clear_nonce_transient) {
|
336 |
|
337 |
// In fact, leaving the hook to run (if debug is set) is harmless, as the resume job should only do tasks that were left unfinished, which at this stage is none.
|
@@ -660,7 +709,7 @@ class UpdraftPlus {
|
|
660 |
$backup_history[$this->backup_time] = $backup_array;
|
661 |
update_option('updraft_backup_history',$backup_history);
|
662 |
} else {
|
663 |
-
$this->error('Could not save backup history because we have no backup array.
|
664 |
}
|
665 |
}
|
666 |
|
@@ -756,35 +805,10 @@ class UpdraftPlus {
|
|
756 |
if (count($this->errors)) {
|
757 |
return false;
|
758 |
} else {
|
759 |
-
#
|
760 |
-
$
|
761 |
-
|
762 |
-
$this->log("Database: applying encryption");
|
763 |
-
$encryption_error = 0;
|
764 |
-
require_once(dirname(__FILE__).'/includes/Rijndael.php');
|
765 |
-
$rijndael = new Crypt_Rijndael();
|
766 |
-
$rijndael->setKey($encryption);
|
767 |
-
$in_handle = @fopen($backup_file_base.'-db.gz','r');
|
768 |
-
$buffer = "";
|
769 |
-
while (!feof ($in_handle)) {
|
770 |
-
$buffer .= fread($in_handle, 16384);
|
771 |
-
}
|
772 |
-
fclose ($in_handle);
|
773 |
-
$out_handle = @fopen($backup_file_base.'-db.gz.crypt','w');
|
774 |
-
if (!fwrite($out_handle, $rijndael->encrypt($buffer))) {$encryption_error = 1;}
|
775 |
-
fclose ($out_handle);
|
776 |
-
if (0 == $encryption_error) {
|
777 |
-
# Delete unencrypted file
|
778 |
-
@unlink($backup_file_base.'-db.gz');
|
779 |
-
return basename($backup_file_base.'-db.gz.crypt');
|
780 |
-
} else {
|
781 |
-
$this->error("Encryption error occurred when encrypting database. Aborted.");
|
782 |
-
}
|
783 |
-
} else {
|
784 |
-
return basename($backup_file_base.'-db.gz');
|
785 |
-
}
|
786 |
}
|
787 |
-
$this->log("Total database tables backed up: $total_tables");
|
788 |
|
789 |
} //wp_db_backup
|
790 |
|
@@ -1084,9 +1108,9 @@ class UpdraftPlus {
|
|
1084 |
readfile($fullpath);
|
1085 |
}
|
1086 |
$this->delete_local($file);
|
1087 |
-
exit; //we exit immediately because otherwise admin-ajax appends an additional zero to the end
|
1088 |
} else {
|
1089 |
-
echo 'Download failed.
|
1090 |
}
|
1091 |
}
|
1092 |
|
4 |
Plugin URI: http://wordpress.org/extend/plugins/updraftplus
|
5 |
Description: Uploads, themes, plugins, and your DB can be automatically backed up to Amazon S3, Google Drive, FTP, or emailed, on separate schedules.
|
6 |
Author: David Anderson.
|
7 |
+
Version: 1.1.9
|
8 |
Donate link: http://david.dw-perspective.org.uk/donate
|
9 |
License: GPLv3 or later
|
10 |
Author URI: http://wordshell.net
|
56 |
|
57 |
class UpdraftPlus {
|
58 |
|
59 |
+
var $version = '1.1.9';
|
60 |
|
61 |
// Choices will be shown in the admin menu in the order used here
|
62 |
var $backup_methods = array (
|
168 |
|
169 |
$our_files=$backup_history[$btime];
|
170 |
$undone_files = array();
|
171 |
+
|
172 |
+
// Potentially encrypt the database if it is not already
|
173 |
+
if (isset($our_files['db']) && !preg_match("/\.crypt$/", $our_files['db'])) {
|
174 |
+
$our_files['db'] = $this->encrypt_file($our_files['db']);
|
175 |
+
$this->save_backup_history($our_files);
|
176 |
+
}
|
177 |
+
|
178 |
foreach ($our_files as $key => $file) {
|
179 |
+
|
180 |
$hash = md5($file);
|
181 |
$fullpath = trailingslashit(get_option('updraft_dir')).$file;
|
182 |
if (get_transient('updraft_'.$hash) === "yes") {
|
306 |
if ($backup_database) {
|
307 |
$this->log("Beginning backup of database");
|
308 |
$db_backup = $this->backup_db();
|
309 |
+
// add db path to rest of files
|
310 |
+
if(is_array($backup_array)) $backup_array['db'] = $db_backup;
|
311 |
$backup_contains = ($backup_files) ? "Files and database" : "Database only (no files)";
|
312 |
}
|
313 |
|
319 |
// This is done before cloud despatch, because we want a record of what *should* be in the backup. Whether it actually makes it there or not is not yet known.
|
320 |
$this->save_backup_history($backup_array);
|
321 |
|
322 |
+
// Now encrypt the database, and re-save
|
323 |
+
if ($backup_database && isset($backup_array['db'])) {
|
324 |
+
$backup_array['db'] = $this->encrypt_file($backup_array['db']);
|
325 |
+
// Re-save with the possibly-altered database filename
|
326 |
+
$this->save_backup_history($backup_array);
|
327 |
+
}
|
328 |
+
|
329 |
//cloud operations (S3,Google Drive,FTP,email,nothing)
|
330 |
//this also calls the retain (prune) feature at the end (done in this method to reuse existing cloud connections)
|
331 |
if(is_array($backup_array) && count($backup_array) >0) {
|
347 |
|
348 |
}
|
349 |
|
350 |
+
// Encrypts the file if the option is set; returns the basename of the file (according to whether it was encrypted or nto)
|
351 |
+
function encrypt_file($file) {
|
352 |
+
$encryption = get_option('updraft_encryptionphrase');
|
353 |
+
if (strlen($encryption) > 0) {
|
354 |
+
$this->log("$file: applying encryption");
|
355 |
+
$encryption_error = 0;
|
356 |
+
require_once(UPDRAFTPLUS_DIR.'/includes/Rijndael.php');
|
357 |
+
$rijndael = new Crypt_Rijndael();
|
358 |
+
$rijndael->setKey($encryption);
|
359 |
+
$updraft_dir = $this->backups_dir_location();
|
360 |
+
$in_handle = @fopen($updraft_dir.'/'.$file,'r');
|
361 |
+
$buffer = "";
|
362 |
+
while (!feof ($in_handle)) {
|
363 |
+
$buffer .= fread($in_handle, 16384);
|
364 |
+
}
|
365 |
+
fclose ($in_handle);
|
366 |
+
$out_handle = @fopen($updraft_dir.'/'.$file.'.crypt','w');
|
367 |
+
if (!fwrite($out_handle, $rijndael->encrypt($buffer))) {$encryption_error = 1;}
|
368 |
+
fclose ($out_handle);
|
369 |
+
if (0 == $encryption_error) {
|
370 |
+
$this->log("$file: encryption successful");
|
371 |
+
# Delete unencrypted file
|
372 |
+
@unlink($file);
|
373 |
+
return basename($file.'.crypt');
|
374 |
+
} else {
|
375 |
+
$this->log("Encryption error occurred when encrypting database. Encryption aborted.");
|
376 |
+
$this->error("Encryption error occurred when encrypting database. Encryption aborted.");
|
377 |
+
return basename($file);
|
378 |
+
}
|
379 |
+
} else {
|
380 |
+
return basename($file);
|
381 |
+
}
|
382 |
+
}
|
383 |
+
|
384 |
function backup_finish($cancel_event, $clear_nonce_transient) {
|
385 |
|
386 |
// In fact, leaving the hook to run (if debug is set) is harmless, as the resume job should only do tasks that were left unfinished, which at this stage is none.
|
709 |
$backup_history[$this->backup_time] = $backup_array;
|
710 |
update_option('updraft_backup_history',$backup_history);
|
711 |
} else {
|
712 |
+
$this->error('Could not save backup history because we have no backup array. Backup probably failed.');
|
713 |
}
|
714 |
}
|
715 |
|
805 |
if (count($this->errors)) {
|
806 |
return false;
|
807 |
} else {
|
808 |
+
# We no longer encrypt here - because the operation can take long, we made it resumable and moved it to the upload loop
|
809 |
+
$this->log("Total database tables backed up: $total_tables");
|
810 |
+
return basename($backup_file_base.'-db.gz');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
811 |
}
|
|
|
812 |
|
813 |
} //wp_db_backup
|
814 |
|
1108 |
readfile($fullpath);
|
1109 |
}
|
1110 |
$this->delete_local($file);
|
1111 |
+
exit; //we exit immediately because otherwise admin-ajax appends an additional zero to the end
|
1112 |
} else {
|
1113 |
+
echo 'Download failed. File '.$fullpath.' did not exist or was unreadable. If you delete local backups then remote retrieval may have failed.';
|
1114 |
}
|
1115 |
}
|
1116 |
|