Version Description
- 01/07/2013 =
- Requested feature: more frequent scheduling options requested
- Fixed bug which mangled default suggestion for backup working directory on Windows
- Provide a 'Test S3 Settings' button for Amazon S3 users
Download this release
Release Info
Developer | DavidAnderson |
Plugin | UpdraftPlus WordPress Backup Plugin |
Version | 1.1.14 |
Comparing to | |
See all releases |
Code changes from version 1.1.13 to 1.1.14
- methods/googledrive.php +12 -5
- methods/s3.php +43 -5
- readme.txt +6 -4
- updraftplus.php +28 -2
methods/googledrive.php
CHANGED
@@ -186,8 +186,13 @@ class UpdraftPlus_BackupModule_googledrive {
|
|
186 |
Â
$res = $location;
|
187 |
Â
$updraftplus->log("Uploading file with title ".$title);
|
188 |
Â
$d = 0;
|
Â
|
|
Â
|
|
189 |
Â
do {
|
190 |
-
$
|
Â
|
|
Â
|
|
Â
|
|
191 |
Â
$res = $gdocs_object->upload_chunk();
|
192 |
Â
if (is_string($res)) set_transient($transkey, $res, 3600*3);
|
193 |
Â
$p = $gdocs_object->get_upload_percentage();
|
@@ -283,8 +288,10 @@ class UpdraftPlus_BackupModule_googledrive {
|
|
283 |
Â
if ( is_wp_error( $this->gdocs_access_token ) ) return $access_token;
|
284 |
Â
|
285 |
Â
$this->gdocs = new UpdraftPlus_GDocs( $this->gdocs_access_token );
|
286 |
-
|
287 |
-
|
Â
|
|
Â
|
|
288 |
Â
$this->gdocs->set_option( 'max_resume_attempts', 36 ); # Doesn't look like GDocs class actually uses this anyway
|
289 |
Â
}
|
290 |
Â
return true;
|
@@ -321,7 +328,7 @@ class UpdraftPlus_BackupModule_googledrive {
|
|
321 |
Â
</tr>
|
322 |
Â
<tr class="updraftplusmethod googledrive">
|
323 |
Â
<th>Google Drive Folder ID:</th>
|
324 |
-
<td><input type="text" style="width:332px" name="updraft_googledrive_remotepath" value="<?php echo htmlspecialchars(get_option('updraft_googledrive_remotepath')); ?>" /> <em>
|
325 |
Â
</tr>
|
326 |
Â
<tr class="updraftplusmethod googledrive">
|
327 |
Â
<th>Authenticate with Google:</th>
|
@@ -334,4 +341,4 @@ class UpdraftPlus_BackupModule_googledrive {
|
|
334 |
Â
|
335 |
Â
}
|
336 |
Â
|
337 |
-
?>
|
186 |
Â
$res = $location;
|
187 |
Â
$updraftplus->log("Uploading file with title ".$title);
|
188 |
Â
$d = 0;
|
189 |
+
// This counter is only used for when deciding what to log
|
190 |
+
$counter = 0;
|
191 |
Â
do {
|
192 |
+
$log_string = ($counter == 0) ? "Upload %: $d, URL: $res" : "Upload %: $d";
|
193 |
+
$counter++; if ($counter >= 20) $counter=0;
|
194 |
+
$updraftplus->log($log_string);
|
195 |
+
|
196 |
Â
$res = $gdocs_object->upload_chunk();
|
197 |
Â
if (is_string($res)) set_transient($transkey, $res, 3600*3);
|
198 |
Â
$p = $gdocs_object->get_upload_percentage();
|
288 |
Â
if ( is_wp_error( $this->gdocs_access_token ) ) return $access_token;
|
289 |
Â
|
290 |
Â
$this->gdocs = new UpdraftPlus_GDocs( $this->gdocs_access_token );
|
291 |
+
// We need to be able to upload at least one chunk within the timeout (at least, we have seen an error report where the failure to do this seemed to be the cause)
|
292 |
+
// If we assume a user has at least 16kb/s (we saw one user with as low as 22kb/s), and that their provider may allow them only 15s, then we have the following settings
|
293 |
+
$this->gdocs->set_option( 'chunk_size', 0.2 ); # 0.2Mb; change from default of 512Kb
|
294 |
+
$this->gdocs->set_option( 'request_timeout', 15 ); # Change from default of 5s
|
295 |
Â
$this->gdocs->set_option( 'max_resume_attempts', 36 ); # Doesn't look like GDocs class actually uses this anyway
|
296 |
Â
}
|
297 |
Â
return true;
|
328 |
Â
</tr>
|
329 |
Â
<tr class="updraftplusmethod googledrive">
|
330 |
Â
<th>Google Drive Folder ID:</th>
|
331 |
+
<td><input type="text" style="width:332px" name="updraft_googledrive_remotepath" value="<?php echo htmlspecialchars(get_option('updraft_googledrive_remotepath')); ?>" /> <em><strong>This is NOT a folder name</strong>. To get a folder's ID navigate to that folder in Google Drive in your web browser and copy the ID from your browser's address bar. It is the part that comes after <kbd>#folders/.</kbd> Leave empty to use your root folder)</em></td>
|
332 |
Â
</tr>
|
333 |
Â
<tr class="updraftplusmethod googledrive">
|
334 |
Â
<th>Authenticate with Google:</th>
|
341 |
Â
|
342 |
Â
}
|
343 |
Â
|
344 |
+
?>
|
methods/s3.php
CHANGED
@@ -163,24 +163,62 @@ class UpdraftPlus_BackupModule_s3 {
|
|
163 |
Â
<td></td>
|
164 |
Â
<td><em>Amazon S3 is a great choice, because UpdraftPlus supports chunked uploads - no matter how big your blog is, UpdraftPlus can upload it a little at a time, and not get thwarted by timeouts.</em></td>
|
165 |
Â
</tr>
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
166 |
Â
<tr class="updraftplusmethod s3">
|
167 |
Â
<th>S3 access key:</th>
|
168 |
-
<td><input type="text" autocomplete="off" style="width: 292px" name="updraft_s3_login" value="<?php echo htmlspecialchars(get_option('updraft_s3_login')) ?>" /></td>
|
169 |
Â
</tr>
|
170 |
Â
<tr class="updraftplusmethod s3">
|
171 |
Â
<th>S3 secret key:</th>
|
172 |
-
<td><input type="text" autocomplete="off" style="width: 292px" name="updraft_s3_pass" value="<?php echo htmlspecialchars(get_option('updraft_s3_pass')); ?>" /></td>
|
173 |
Â
</tr>
|
174 |
Â
<tr class="updraftplusmethod s3">
|
175 |
Â
<th>S3 location:</th>
|
176 |
-
<td>s3://<input type="text" style="width: 292px" name="updraft_s3_remote_path" value="<?php echo htmlspecialchars(get_option('updraft_s3_remote_path')); ?>" /></td>
|
177 |
Â
</tr>
|
178 |
-
<tr
|
179 |
Â
<th></th>
|
180 |
-
<td><p
|
181 |
Â
</tr>
|
182 |
Â
<?php
|
183 |
Â
}
|
184 |
Â
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
185 |
Â
}
|
186 |
Â
?>
|
163 |
Â
<td></td>
|
164 |
Â
<td><em>Amazon S3 is a great choice, because UpdraftPlus supports chunked uploads - no matter how big your blog is, UpdraftPlus can upload it a little at a time, and not get thwarted by timeouts.</em></td>
|
165 |
Â
</tr>
|
166 |
+
<tr class="updraftplusmethod s3">
|
167 |
+
<th></th>
|
168 |
+
<td>
|
169 |
+
<p>Get your access key and secret key <a href="http://aws.amazon.com/console/">from your AWS console</a>, then pick a (globally unique - all Amazon S3 users) bucket name (letters and numbers) (and optionally a path) to use for storage. This bucket will be created for you if it does not already exist.</p>
|
170 |
+
</td></tr>
|
171 |
Â
<tr class="updraftplusmethod s3">
|
172 |
Â
<th>S3 access key:</th>
|
173 |
+
<td><input type="text" autocomplete="off" style="width: 292px" id="updraft_s3_apikey" name="updraft_s3_login" value="<?php echo htmlspecialchars(get_option('updraft_s3_login')) ?>" /></td>
|
174 |
Â
</tr>
|
175 |
Â
<tr class="updraftplusmethod s3">
|
176 |
Â
<th>S3 secret key:</th>
|
177 |
+
<td><input type="text" autocomplete="off" style="width: 292px" id="updraft_s3_apisecret" name="updraft_s3_pass" value="<?php echo htmlspecialchars(get_option('updraft_s3_pass')); ?>" /></td>
|
178 |
Â
</tr>
|
179 |
Â
<tr class="updraftplusmethod s3">
|
180 |
Â
<th>S3 location:</th>
|
181 |
+
<td>s3://<input type="text" style="width: 292px" name="updraft_s3_remote_path" id="updraft_s3_path" value="<?php echo htmlspecialchars(get_option('updraft_s3_remote_path')); ?>" /></td>
|
182 |
Â
</tr>
|
183 |
+
<tr>
|
184 |
Â
<th></th>
|
185 |
+
<td><p><button id="updraft-s3-test" type="button" class="button-primary" style="font-size:18px !important">Test S3 Settings</button></p></td>
|
186 |
Â
</tr>
|
187 |
Â
<?php
|
188 |
Â
}
|
189 |
Â
|
190 |
+
function s3_test($key, $secret, $path) {
|
191 |
+
$bucket = (preg_match("#^([^/]+)/(.*)$#", $path, $bmatches)) ? $bmatches[1] : $path;
|
192 |
+
|
193 |
+
if (empty($bucket)) {
|
194 |
+
echo "Failure: No bucket details were given.";
|
195 |
+
return;
|
196 |
+
}
|
197 |
+
if (empty($key)) {
|
198 |
+
echo "Failure: No API key was given.";
|
199 |
+
return;
|
200 |
+
}
|
201 |
+
if (empty($secret)) {
|
202 |
+
echo "Failure: No API secret was given.";
|
203 |
+
return;
|
204 |
+
}
|
205 |
+
|
206 |
+
if (!class_exists('S3')) require_once(UPDRAFTPLUS_DIR.'/includes/S3.php');
|
207 |
+
$s3 = new S3($key, $secret);
|
208 |
+
|
209 |
+
$location = @$s3->getBucketLocation($bucket);
|
210 |
+
if ($location) {
|
211 |
+
echo "Success: this bucket exists (Amazon region: $location) and we have access to it.";
|
212 |
+
} else {
|
213 |
+
$try_to_create = @$s3->putBucket($bucket, S3::ACL_PRIVATE);
|
214 |
+
if ($try_to_create) {
|
215 |
+
echo "Success: We have successfully created this bucket in your S3 account.";
|
216 |
+
} else {
|
217 |
+
echo "Failure: We could not successfully access or create such a bucket. Please check your access credentials, and if those are correct then try another bucket name (as another S3 user may already have taken this name).";
|
218 |
+
}
|
219 |
+
}
|
220 |
+
|
221 |
+
}
|
222 |
+
|
223 |
Â
}
|
224 |
Â
?>
|
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 |
-
|
12 |
Â
|
13 |
Â
== Description ==
|
14 |
Â
|
@@ -22,6 +22,7 @@ UpdraftPlus simplifies backups (and restoration). Backup into the cloud (Amazon
|
|
22 |
Â
* Select which files to backup (plugins, themes, content, other)
|
23 |
Â
* Databases can be encrypted for security
|
24 |
Â
* Debug mode that gives full logging
|
Â
|
|
25 |
Â
|
26 |
Â
== Installation ==
|
27 |
Â
|
@@ -111,11 +112,12 @@ Thanks for asking - yes, I have. Check out my profile page - http://profiles.wor
|
|
111 |
Â
|
112 |
Â
== Changelog ==
|
113 |
Â
|
114 |
-
= 1.1.
|
115 |
Â
* Requested feature: more frequent scheduling options requested
|
116 |
Â
* Fixed bug which mangled default suggestion for backup working directory on Windows
|
Â
|
|
117 |
Â
|
118 |
-
= 1.1.11 - 04/
|
119 |
Â
* Bug fix: some backup runs were erroneously being identified as superfluous and cancelled
|
120 |
Â
|
121 |
Â
= 1.1.9 - 12/31/2012 =
|
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.14
|
7 |
Â
Donate link: http://david.dw-perspective.org.uk/donate
|
8 |
Â
License: GPLv3 or later
|
9 |
Â
|
10 |
Â
== Upgrade Notice ==
|
11 |
+
Provide a 'Test S3 Settings' button for Amazon S3 users
|
12 |
Â
|
13 |
Â
== Description ==
|
14 |
Â
|
22 |
Â
* Select which files to backup (plugins, themes, content, other)
|
23 |
Â
* Databases can be encrypted for security
|
24 |
Â
* Debug mode that gives full logging
|
25 |
+
* Thousands of users: widely tested and reliable
|
26 |
Â
|
27 |
Â
== Installation ==
|
28 |
Â
|
112 |
Â
|
113 |
Â
== Changelog ==
|
114 |
Â
|
115 |
+
= 1.1.14 - 01/07/2013 =
|
116 |
Â
* Requested feature: more frequent scheduling options requested
|
117 |
Â
* Fixed bug which mangled default suggestion for backup working directory on Windows
|
118 |
+
* Provide a 'Test S3 Settings' button for Amazon S3 users
|
119 |
Â
|
120 |
+
= 1.1.11 - 01/04/2013 =
|
121 |
Â
* Bug fix: some backup runs were erroneously being identified as superfluous and cancelled
|
122 |
Â
|
123 |
Â
= 1.1.9 - 12/31/2012 =
|
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 (
|
@@ -85,7 +85,9 @@ class UpdraftPlus {
|
|
85 |
Â
add_action('updraft_backup_all', array($this,'backup_all'));
|
86 |
Â
# this is our runs-after-backup event, whose purpose is to see if it succeeded or failed, and resume/mom-up etc.
|
87 |
Â
add_action('updraft_backup_resume', array($this,'backup_resume'));
|
Â
|
|
88 |
Â
add_action('wp_ajax_updraft_download_backup', array($this, 'updraft_download_backup'));
|
Â
|
|
89 |
Â
# http://codex.wordpress.org/Plugin_API/Filter_Reference/cron_schedules
|
90 |
Â
add_filter('cron_schedules', array($this,'modify_cron_schedules'));
|
91 |
Â
add_filter('plugin_action_links', array($this, 'plugin_action_links'), 10, 2);
|
@@ -1072,6 +1074,14 @@ class UpdraftPlus {
|
|
1072 |
Â
return $updraft_dir;
|
1073 |
Â
}
|
1074 |
Â
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
1075 |
Â
function updraft_download_backup() {
|
1076 |
Â
$type = $_POST['type'];
|
1077 |
Â
$timestamp = (int)$_POST['timestamp'];
|
@@ -1322,6 +1332,11 @@ class UpdraftPlus {
|
|
1322 |
Â
}
|
1323 |
Â
}
|
1324 |
Â
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
1325 |
Â
function add_admin_pages() {
|
1326 |
Â
add_submenu_page('options-general.php', "UpdraftPlus", "UpdraftPlus", "manage_options", "updraftplus",
|
1327 |
Â
array($this,"settings_output"));
|
@@ -1765,6 +1780,17 @@ echo $delete_local; ?> /> <br>Check this to delete the local backup file (only s
|
|
1765 |
Â
<?php
|
1766 |
Â
if ($active_service) echo "jQuery('.${active_service}').show();";
|
1767 |
Â
?>
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
1768 |
Â
});
|
1769 |
Â
/* ]]> */
|
1770 |
Â
</script>
|
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.14
|
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.14';
|
60 |
Â
|
61 |
Â
// Choices will be shown in the admin menu in the order used here
|
62 |
Â
var $backup_methods = array (
|
85 |
Â
add_action('updraft_backup_all', array($this,'backup_all'));
|
86 |
Â
# this is our runs-after-backup event, whose purpose is to see if it succeeded or failed, and resume/mom-up etc.
|
87 |
Â
add_action('updraft_backup_resume', array($this,'backup_resume'));
|
88 |
+
add_action('wp_enqueue_scripts', array($this, 'ajax_enqueue') );
|
89 |
Â
add_action('wp_ajax_updraft_download_backup', array($this, 'updraft_download_backup'));
|
90 |
+
add_action('wp_ajax_updraft_s3_test', array($this, 'updraft_s3_test'));
|
91 |
Â
# http://codex.wordpress.org/Plugin_API/Filter_Reference/cron_schedules
|
92 |
Â
add_filter('cron_schedules', array($this,'modify_cron_schedules'));
|
93 |
Â
add_filter('plugin_action_links', array($this, 'plugin_action_links'), 10, 2);
|
1074 |
Â
return $updraft_dir;
|
1075 |
Â
}
|
1076 |
Â
|
1077 |
+
// Called via AJAX
|
1078 |
+
function updraft_s3_test() {
|
1079 |
+
// Test the credentials, return a code
|
1080 |
+
require_once(UPDRAFTPLUS_DIR.'/methods/s3.php');
|
1081 |
+
UpdraftPlus_BackupModule_s3::s3_test($_POST['apikey'], $_POST['apisecret'], $_POST['path']);
|
1082 |
+
die;
|
1083 |
+
}
|
1084 |
+
|
1085 |
Â
function updraft_download_backup() {
|
1086 |
Â
$type = $_POST['type'];
|
1087 |
Â
$timestamp = (int)$_POST['timestamp'];
|
1332 |
Â
}
|
1333 |
Â
}
|
1334 |
Â
|
1335 |
+
function ajax_enqueue() {
|
1336 |
+
wp_enqueue_script('updraftplus-ajax', plugins_url('/includes/ajax.js', __FILE__) );
|
1337 |
+
wp_localize_script('updraftplus-ajax', 'updraft_test_s3', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ) ) );
|
1338 |
+
}
|
1339 |
+
|
1340 |
Â
function add_admin_pages() {
|
1341 |
Â
add_submenu_page('options-general.php', "UpdraftPlus", "UpdraftPlus", "manage_options", "updraftplus",
|
1342 |
Â
array($this,"settings_output"));
|
1780 |
Â
<?php
|
1781 |
Â
if ($active_service) echo "jQuery('.${active_service}').show();";
|
1782 |
Â
?>
|
1783 |
+
jQuery('#updraft-s3-test').click(function(){
|
1784 |
+
var data = {
|
1785 |
+
action: 'updraft_s3_test',
|
1786 |
+
apikey: jQuery('#updraft_s3_apikey').val(),
|
1787 |
+
apisecret: jQuery('#updraft_s3_apisecret').val(),
|
1788 |
+
path: jQuery('#updraft_s3_path').val()
|
1789 |
+
};
|
1790 |
+
jQuery.post(ajaxurl, data, function(response) {
|
1791 |
+
alert('Settings test result: ' + response);
|
1792 |
+
});
|
1793 |
+
});
|
1794 |
Â
});
|
1795 |
Â
/* ]]> */
|
1796 |
Â
</script>
|