Version Description
- 01/08/2013 =
- DropBox support (no chunked uploading yet, but otherwise complete)
- Make the creation of the database dump also resumable, for people with really slow servers
- Database table backups are now timed
- FTP logging slightly improved
- DropBox support uses WordPress's built-in HTTP functions
Download this release
Release Info
Developer | DavidAnderson |
Plugin | UpdraftPlus WordPress Backup Plugin |
Version | 1.2.14 |
Comparing to | |
See all releases |
Code changes from version 1.2.12 to 1.2.14
- includes/Dropbox/OAuth/Consumer/WordPress.php +80 -0
- methods/dropbox.php +5 -22
- readme.txt +4 -2
- updraftplus.php +4 -4
includes/Dropbox/OAuth/Consumer/WordPress.php
ADDED
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* OAuth consumer using the WordPress API
|
5 |
+
* @author David Anderson <david@wordshell.net>
|
6 |
+
* @link https://github.com/DavidAnderson684/Dropbox
|
7 |
+
* @package Dropbox\OAuth
|
8 |
+
* @subpackage Consumer
|
9 |
+
*/
|
10 |
+
|
11 |
+
class Dropbox_ConsumerWordPress extends Dropbox_ConsumerAbstract
|
12 |
+
{
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Set properties and begin authentication
|
16 |
+
* @param string $key
|
17 |
+
* @param string $secret
|
18 |
+
* @param \Dropbox\OAuth\Consumer\StorageInterface $storage
|
19 |
+
* @param string $callback
|
20 |
+
*/
|
21 |
+
public function __construct($key, $secret, Dropbox_StorageInterface $storage, $callback = null)
|
22 |
+
{
|
23 |
+
// Check we are in a WordPress environment
|
24 |
+
if (!defined('ABSPATH')) {
|
25 |
+
throw new Dropbox_Exception('The WordPress OAuth consumer requires a WordPress environment');
|
26 |
+
}
|
27 |
+
|
28 |
+
$this->consumerKey = $key;
|
29 |
+
$this->consumerSecret = $secret;
|
30 |
+
$this->storage = $storage;
|
31 |
+
$this->callback = $callback;
|
32 |
+
$this->authenticate();
|
33 |
+
}
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Execute an API call
|
37 |
+
* @param string $method The HTTP method
|
38 |
+
* @param string $url The API endpoint
|
39 |
+
* @param string $call The API method to call
|
40 |
+
* @param array $additional Additional parameters
|
41 |
+
* @return array
|
42 |
+
*/
|
43 |
+
public function fetch($method, $url, $call, array $additional = array())
|
44 |
+
{
|
45 |
+
// Get the signed request URL
|
46 |
+
$request = $this->getSignedRequest($method, $url, $call, $additional);
|
47 |
+
if ($method == 'GET') {
|
48 |
+
$args = array ( );
|
49 |
+
$response = wp_remote_get($request['url'], $args);
|
50 |
+
$this->outFile = null;
|
51 |
+
} elseif ($method == 'POST') {
|
52 |
+
$args = array( 'body' => $request['postfields'] );
|
53 |
+
$response = wp_remote_post($request['url'], $args );
|
54 |
+
} elseif ($method == 'PUT' && $this->inFile) {
|
55 |
+
return new WP_Error('unsupported', __("WordPress does not have a native HTTP PUT function"));
|
56 |
+
}
|
57 |
+
|
58 |
+
// If the response body is not a JSON encoded string
|
59 |
+
// we'll return the entire response body
|
60 |
+
// Important to do this first, as the next section relies on the decoding having taken place
|
61 |
+
if (!$body = json_decode($response['body'])) {
|
62 |
+
$body = $response['body'];
|
63 |
+
}
|
64 |
+
|
65 |
+
// Check if an error occurred and throw an Exception. This is part of the authentication process - don't modify.
|
66 |
+
if (!empty($body->error)) {
|
67 |
+
$message = $body->error . ' (Status Code: ' . $response['code'] . ')';
|
68 |
+
throw new Dropbox_Exception($message);
|
69 |
+
}
|
70 |
+
|
71 |
+
if (is_wp_error($response)) {
|
72 |
+
$message = $response->get_error_message();
|
73 |
+
throw new Dropbox_Exception($message);
|
74 |
+
}
|
75 |
+
|
76 |
+
$results = array ( 'body' => $body, 'code' => $response['response']['code'], 'headers' => $response['headers'] );
|
77 |
+
return $results;
|
78 |
+
}
|
79 |
+
|
80 |
+
}
|
methods/dropbox.php
CHANGED
@@ -150,19 +150,10 @@ class UpdraftPlus_BackupModule_dropbox {
|
|
150 |
<th></th>
|
151 |
<td>
|
152 |
<?php
|
153 |
-
// Check requirements
|
154 |
if (!function_exists('mcrypt_encrypt')) {
|
155 |
?><p><strong>Warning:</strong> Your web server's PHP installation does not included a required module (MCrypt). Please contact your web hosting provider's support. UpdraftPlus's DropBox module <strong>requires</strong> MCrypt. Please do not file any support requests; there is no alternative.</p><?php
|
156 |
}
|
157 |
-
if (!function_exists("curl_init")) {
|
158 |
-
?><p><strong>Warning:</strong> Your web server's PHP installation does not included a required module (Curl). Please contact your web hosting provider's support. UpdraftPlus's DropBox module <strong>requires</strong> Curl. Your only options to get this working are 1) Install/enable curl or 2) Hire us or someone else to code additional support options into UpdraftPlus. 3) Wait, possibly forever, for someone else to do this.</p><?php
|
159 |
-
} else {
|
160 |
-
$curl_version = curl_version();
|
161 |
-
$curl_ssl_supported= ($curl_version['features'] & CURL_VERSION_SSL);
|
162 |
-
if (!$curl_ssl_supported) {
|
163 |
-
?><p><strong>Warning:</strong> Your web server's PHP/Curl installation does not support https access. We cannot access DropBox without this support. Please contact your web hosting provider's support. UpdraftPlus's DropBox module <strong>requires</strong> Curl+https. Your only options to get this working are 1) Install/enable curl with https or 2) Hire us or someone else to code additional support options into UpdraftPlus. 3) Wait, possibly forever, for someone else to do this.</p><?php
|
164 |
-
}
|
165 |
-
}
|
166 |
?>
|
167 |
</td>
|
168 |
</tr>
|
@@ -239,16 +230,6 @@ class UpdraftPlus_BackupModule_dropbox {
|
|
239 |
|
240 |
self::bootstrap(get_option('updraft_dropbox_appkey'), get_option('updraft_dropbox_secret'));
|
241 |
|
242 |
-
// $params = array(
|
243 |
-
// 'response_type' => 'code',
|
244 |
-
// 'client_id' => get_option('updraft_dropbo'),
|
245 |
-
// 'redirect_uri' => admin_url('options-general.php?page=updraftplus&action=updraftmethod-googledrive-auth'),
|
246 |
-
// 'scope' => 'https://www.googleapis.com/auth/drive.file https://docs.google.com/feeds/ https://docs.googleusercontent.com/ https://spreadsheets.google.com/feeds/',
|
247 |
-
// 'state' => 'token',
|
248 |
-
// 'access_type' => 'offline',
|
249 |
-
// 'approval_prompt' => 'auto'
|
250 |
-
// );
|
251 |
-
// header('Location: https://accounts.google.com/o/oauth2/auth?'.http_build_query($params));
|
252 |
}
|
253 |
|
254 |
// This basically reproduces the relevant bits of bootstrap.php from the SDK
|
@@ -260,7 +241,8 @@ class UpdraftPlus_BackupModule_dropbox {
|
|
260 |
require_once(UPDRAFTPLUS_DIR.'/includes/Dropbox/OAuth/Storage/StorageInterface.php');
|
261 |
require_once(UPDRAFTPLUS_DIR.'/includes/Dropbox/OAuth/Storage/Encrypter.php');
|
262 |
require_once(UPDRAFTPLUS_DIR.'/includes/Dropbox/OAuth/Storage/WordPress.php');
|
263 |
-
|
|
|
264 |
|
265 |
// Set the callback URL
|
266 |
$callback = admin_url('options-general.php?page=updraftplus&action=updraftmethod-dropbox-auth');
|
@@ -271,7 +253,8 @@ class UpdraftPlus_BackupModule_dropbox {
|
|
271 |
// Instantiate the storage
|
272 |
$storage = new Dropbox_WordPress($encrypter, "updraft_dropboxtk_");
|
273 |
|
274 |
-
$OAuth = new
|
|
|
275 |
return new Dropbox_API($OAuth);
|
276 |
}
|
277 |
|
150 |
<th></th>
|
151 |
<td>
|
152 |
<?php
|
153 |
+
// Check requirements. No need to check curl as we now use WP's built-in HTTP functions
|
154 |
if (!function_exists('mcrypt_encrypt')) {
|
155 |
?><p><strong>Warning:</strong> Your web server's PHP installation does not included a required module (MCrypt). Please contact your web hosting provider's support. UpdraftPlus's DropBox module <strong>requires</strong> MCrypt. Please do not file any support requests; there is no alternative.</p><?php
|
156 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
157 |
?>
|
158 |
</td>
|
159 |
</tr>
|
230 |
|
231 |
self::bootstrap(get_option('updraft_dropbox_appkey'), get_option('updraft_dropbox_secret'));
|
232 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
233 |
}
|
234 |
|
235 |
// This basically reproduces the relevant bits of bootstrap.php from the SDK
|
241 |
require_once(UPDRAFTPLUS_DIR.'/includes/Dropbox/OAuth/Storage/StorageInterface.php');
|
242 |
require_once(UPDRAFTPLUS_DIR.'/includes/Dropbox/OAuth/Storage/Encrypter.php');
|
243 |
require_once(UPDRAFTPLUS_DIR.'/includes/Dropbox/OAuth/Storage/WordPress.php');
|
244 |
+
// require_once(UPDRAFTPLUS_DIR.'/includes/Dropbox/OAuth/Consumer/Curl.php');
|
245 |
+
require_once(UPDRAFTPLUS_DIR.'/includes/Dropbox/OAuth/Consumer/WordPress.php');
|
246 |
|
247 |
// Set the callback URL
|
248 |
$callback = admin_url('options-general.php?page=updraftplus&action=updraftmethod-dropbox-auth');
|
253 |
// Instantiate the storage
|
254 |
$storage = new Dropbox_WordPress($encrypter, "updraft_dropboxtk_");
|
255 |
|
256 |
+
$OAuth = new Dropbox_ConsumerWordPress($key, $secret, $storage, $callback);
|
257 |
+
// $OAuth = new Dropbox_Curl($key, $secret, $storage, $callback);
|
258 |
return new Dropbox_API($OAuth);
|
259 |
}
|
260 |
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: David Anderson
|
|
3 |
Tags: backup, restore, database, cloud, amazon, s3, Amazon S3, DropBox, DropBox backup, 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.2.
|
7 |
Donate link: http://david.dw-perspective.org.uk/donate
|
8 |
License: GPLv3 or later
|
9 |
|
@@ -112,10 +112,12 @@ Thanks for asking - yes, I have. Check out my profile page - http://profiles.wor
|
|
112 |
|
113 |
== Changelog ==
|
114 |
|
115 |
-
= 1.2.
|
116 |
* DropBox support (no chunked uploading yet, but otherwise complete)
|
117 |
* Make the creation of the database dump also resumable, for people with really slow servers
|
118 |
* Database table backups are now timed
|
|
|
|
|
119 |
|
120 |
= 1.1.16 - 01/07/2013 =
|
121 |
* Requested feature: more frequent scheduling options requested
|
3 |
Tags: backup, restore, database, cloud, amazon, s3, Amazon S3, DropBox, DropBox backup, 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.2.14
|
7 |
Donate link: http://david.dw-perspective.org.uk/donate
|
8 |
License: GPLv3 or later
|
9 |
|
112 |
|
113 |
== Changelog ==
|
114 |
|
115 |
+
= 1.2.14 - 01/08/2013 =
|
116 |
* DropBox support (no chunked uploading yet, but otherwise complete)
|
117 |
* Make the creation of the database dump also resumable, for people with really slow servers
|
118 |
* Database table backups are now timed
|
119 |
+
* FTP logging slightly improved
|
120 |
+
* DropBox support uses WordPress's built-in HTTP functions
|
121 |
|
122 |
= 1.1.16 - 01/07/2013 =
|
123 |
* Requested feature: more frequent scheduling options requested
|
updraftplus.php
CHANGED
@@ -2,9 +2,9 @@
|
|
2 |
/*
|
3 |
Plugin Name: UpdraftPlus - Backup/Restore
|
4 |
Plugin URI: http://wordpress.org/extend/plugins/updraftplus
|
5 |
-
Description: Backup and
|
6 |
Author: David Anderson.
|
7 |
-
Version: 1.2.
|
8 |
Donate link: http://david.dw-perspective.org.uk/donate
|
9 |
License: GPLv3 or later
|
10 |
Author URI: http://wordshell.net
|
@@ -12,7 +12,7 @@ Author URI: http://wordshell.net
|
|
12 |
|
13 |
/*
|
14 |
TODO
|
15 |
-
//Add
|
16 |
//improve error reporting / pretty up return messages in admin area
|
17 |
//?? On 'backup now', open up a Lightbox, count down 5 seconds, then start examining the log file (if it can be found)
|
18 |
|
@@ -56,7 +56,7 @@ define('UPDRAFT_DEFAULT_OTHERS_EXCLUDE','upgrade,cache,updraft,index.php');
|
|
56 |
|
57 |
class UpdraftPlus {
|
58 |
|
59 |
-
var $version = '1.2.
|
60 |
|
61 |
// Choices will be shown in the admin menu in the order used here
|
62 |
var $backup_methods = array (
|
2 |
/*
|
3 |
Plugin Name: UpdraftPlus - Backup/Restore
|
4 |
Plugin URI: http://wordpress.org/extend/plugins/updraftplus
|
5 |
+
Description: Backup and restore: All your content and your DB can be automatically backed up to Amazon S3, DropBox, Google Drive, FTP, or emailed, on separate schedules.
|
6 |
Author: David Anderson.
|
7 |
+
Version: 1.2.14
|
8 |
Donate link: http://david.dw-perspective.org.uk/donate
|
9 |
License: GPLv3 or later
|
10 |
Author URI: http://wordshell.net
|
12 |
|
13 |
/*
|
14 |
TODO
|
15 |
+
//Add Box.Net and Microsoft Skydrive support??
|
16 |
//improve error reporting / pretty up return messages in admin area
|
17 |
//?? On 'backup now', open up a Lightbox, count down 5 seconds, then start examining the log file (if it can be found)
|
18 |
|
56 |
|
57 |
class UpdraftPlus {
|
58 |
|
59 |
+
var $version = '1.2.14';
|
60 |
|
61 |
// Choices will be shown in the admin menu in the order used here
|
62 |
var $backup_methods = array (
|