UpdraftPlus WordPress Backup Plugin - Version 1.12.1

Version Description

  • 24/Mar/2016 =

  • TWEAK: Update the bundled remote communications library - needed for some UpdraftCentral users

Download this release

Release Info

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

Code changes from version 1.12.0 to 1.12.1

central/bootstrap.php CHANGED
@@ -389,10 +389,15 @@ class UpdraftPlus_UpdraftCentral_Main {
389
  if (!empty($key['extra_info']['mothership'])) {
390
 
391
  $mothership_url = $key['extra_info']['mothership'];
392
- $purl = parse_url($mothership_url);
393
- $path = empty($purl['path']) ? '' : $purl['path'];
394
 
395
- $reconstructed_url = $purl['scheme'].'://'.$purl['host'].(!empty($purl['port']) ? ':'.$purl['port'] : '').$purl['path'];
 
 
 
 
 
 
 
396
 
397
  } else {
398
  $reconstructed_url = __('Unknown', 'updraftplus');
@@ -404,7 +409,7 @@ class UpdraftPlus_UpdraftCentral_Main {
404
 
405
  $user_display = is_a($user, 'WP_User') ? $user->user_login.' ('.$user->user_email.')' : __('Unknown', 'updraftplus');
406
 
407
- $ret .= '<tr class="updraft_debugrow"><td style="vertical-align:top;">'.htmlspecialchars($name).' ('.htmlspecialchars($i).')</td><td>'.__("Access this site as user:", 'updraftplus')." ".htmlspecialchars($user_display)."<br>".__('Key was sent to:', 'updraftplus').' '.htmlspecialchars($reconstructed_url).'<br>';
408
 
409
  if (!empty($key['created'])) {
410
  $ret .= __('Created:', 'updraftplus').' '.date_i18n(get_option('date_format').' '.get_option('time_format'), $key['created']).'<br>';
389
  if (!empty($key['extra_info']['mothership'])) {
390
 
391
  $mothership_url = $key['extra_info']['mothership'];
 
 
392
 
393
+ if ('__updraftpluscom' == $mothership_url) {
394
+ $reconstructed_url = 'https://updraftplus.com';
395
+ } else {
396
+ $purl = parse_url($mothership_url);
397
+ $path = empty($purl['path']) ? '' : $purl['path'];
398
+
399
+ $reconstructed_url = $purl['scheme'].'://'.$purl['host'].(!empty($purl['port']) ? ':'.$purl['port'] : '').$path;
400
+ }
401
 
402
  } else {
403
  $reconstructed_url = __('Unknown', 'updraftplus');
409
 
410
  $user_display = is_a($user, 'WP_User') ? $user->user_login.' ('.$user->user_email.')' : __('Unknown', 'updraftplus');
411
 
412
+ $ret .= '<tr class="updraft_debugrow"><td style="vertical-align:top;">'.htmlspecialchars($name).' ('.htmlspecialchars($i).')</td><td>'.__("Access this site as user:", 'updraftplus')." ".htmlspecialchars($user_display)."<br>".__('Public key was sent to:', 'updraftplus').' '.htmlspecialchars($reconstructed_url).'<br>';
413
 
414
  if (!empty($key['created'])) {
415
  $ret .= __('Created:', 'updraftplus').' '.date_i18n(get_option('date_format').' '.get_option('time_format'), $key['created']).'<br>';
class-updraftplus.php CHANGED
@@ -131,7 +131,7 @@ class UpdraftPlus {
131
 
132
  // Gets an RPC object, and sets some defaults on it that we always want
133
  public function get_udrpc($indicator_name = 'migrator.updraftplus.com') {
134
- if (!class_exists('UpdraftPlus_Remote_Communications')) require_once(UPDRAFTPLUS_DIR.'/includes/class-udrpc.php');
135
  $ud_rpc = new UpdraftPlus_Remote_Communications($indicator_name);
136
  $ud_rpc->set_can_generate(true);
137
  return $ud_rpc;
131
 
132
  // Gets an RPC object, and sets some defaults on it that we always want
133
  public function get_udrpc($indicator_name = 'migrator.updraftplus.com') {
134
+ if (!class_exists('UpdraftPlus_Remote_Communications')) require_once(apply_filters('updraftplus_class_udrpc_path', UPDRAFTPLUS_DIR.'/includes/class-udrpc.php', $this->version));
135
  $ud_rpc = new UpdraftPlus_Remote_Communications($indicator_name);
136
  $ud_rpc->set_can_generate(true);
137
  return $ud_rpc;
includes/class-udrpc.php CHANGED
@@ -59,7 +59,7 @@ if (!class_exists('UpdraftPlus_Remote_Communications')):
59
  class UpdraftPlus_Remote_Communications {
60
 
61
  // Version numbers relate to versions of this PHP library only (i.e. it's not a protocol support number, and version numbers of other compatible libraries (e.g. JavaScript) are not comparable)
62
- public $version = '1.4';
63
 
64
  private $key_name_indicator;
65
 
@@ -94,6 +94,8 @@ class UpdraftPlus_Remote_Communications {
94
 
95
  private $http_credentials = array();
96
 
 
 
97
  public function __construct($key_name_indicator = 'default', $can_generate = false) {
98
  $this->set_key_name_indicator($key_name_indicator);
99
  }
@@ -443,13 +445,18 @@ class UpdraftPlus_Remote_Communications {
443
  $send_array['key_name'] = $this->key_name_indicator;
444
 
445
  // This random element means that if the site needs to send two identical commands or responses in the same second, then it can, and still use replay protection
446
- $send_array['rand'] = rand(0, PHP_INT_MAX);
 
447
 
448
  if ($this->next_send_sequence_id) {
449
  $send_array['sequence_id'] = $this->next_send_sequence_id;
450
  $this->next_send_sequence_id++;
451
  }
452
 
 
 
 
 
453
  if (null !== $data) $send_array['data'] = $data;
454
  $send_data = $this->encrypt_message(json_encode($send_array), $use_key_remote);
455
 
@@ -463,7 +470,7 @@ class UpdraftPlus_Remote_Communications {
463
  $signature = $this->signature_for_message($send_data, $use_key_local);
464
  $message['signature'] = $signature;
465
  }
466
-
467
  return $message;
468
 
469
  }
@@ -485,11 +492,12 @@ class UpdraftPlus_Remote_Communications {
485
 
486
  // This needs only to return an array with keys body and response - where response is also an array, with key 'code' (the HTTP status code)
487
  // The $post_options array support these keys: timeout, body,
488
- private function http_post($post_options) {
 
489
 
490
  @include(ABSPATH.WPINC.'/version.php');
491
  $http_credentials = $this->http_credentials;
492
-
493
  if (is_a($this->http_transport, 'GuzzleHttp\Client')) {
494
 
495
  // https://guzzle.readthedocs.org/en/5.3/clients.html
@@ -602,7 +610,8 @@ class UpdraftPlus_Remote_Communications {
602
  try {
603
  $post = $this->http_post($post_options);
604
  } catch (Exception $e) {
605
- return new WP_Error($e->getCode(), $e->getMessage(), $e);
 
606
  }
607
 
608
  if (is_wp_error($post)) return $post;
@@ -864,6 +873,8 @@ class UpdraftPlus_Remote_Communications {
864
  $wpdb->query($sql);
865
 
866
  }
 
 
867
 
868
  $command = (string)$udrpc_message['command'];
869
  $data = empty($udrpc_message['data']) ? null : $udrpc_message['data'];
59
  class UpdraftPlus_Remote_Communications {
60
 
61
  // Version numbers relate to versions of this PHP library only (i.e. it's not a protocol support number, and version numbers of other compatible libraries (e.g. JavaScript) are not comparable)
62
+ public $version = '1.4.1';
63
 
64
  private $key_name_indicator;
65
 
94
 
95
  private $http_credentials = array();
96
 
97
+ private $incoming_message = null;
98
+
99
  public function __construct($key_name_indicator = 'default', $can_generate = false) {
100
  $this->set_key_name_indicator($key_name_indicator);
101
  }
445
  $send_array['key_name'] = $this->key_name_indicator;
446
 
447
  // This random element means that if the site needs to send two identical commands or responses in the same second, then it can, and still use replay protection
448
+ // The value of PHP_INT_MAX on a 32-bit platform
449
+ $send_array['rand'] = rand(0, 2147483647);
450
 
451
  if ($this->next_send_sequence_id) {
452
  $send_array['sequence_id'] = $this->next_send_sequence_id;
453
  $this->next_send_sequence_id++;
454
  }
455
 
456
+ if ($is_response && !empty($this->incoming_message) && isset($this->incoming_message['rand'])) {
457
+ $send_array['incoming_rand'] = $this->incoming_message['rand'];
458
+ }
459
+
460
  if (null !== $data) $send_array['data'] = $data;
461
  $send_data = $this->encrypt_message(json_encode($send_array), $use_key_remote);
462
 
470
  $signature = $this->signature_for_message($send_data, $use_key_local);
471
  $message['signature'] = $signature;
472
  }
473
+
474
  return $message;
475
 
476
  }
492
 
493
  // This needs only to return an array with keys body and response - where response is also an array, with key 'code' (the HTTP status code)
494
  // The $post_options array support these keys: timeout, body,
495
+ // Public, to allow short-circuiting of the library's own encoding/decoding (e.g. for acting as a proxy for a message already encrypted elsewhere)
496
+ public function http_post($post_options) {
497
 
498
  @include(ABSPATH.WPINC.'/version.php');
499
  $http_credentials = $this->http_credentials;
500
+
501
  if (is_a($this->http_transport, 'GuzzleHttp\Client')) {
502
 
503
  // https://guzzle.readthedocs.org/en/5.3/clients.html
610
  try {
611
  $post = $this->http_post($post_options);
612
  } catch (Exception $e) {
613
+ // Curl can return an error code 0, which causes WP_Error to return early, without recording the message. So, we prefix the code.
614
+ return new WP_Error('http_post_'.$e->getCode(), $e->getMessage());
615
  }
616
 
617
  if (is_wp_error($post)) return $post;
873
  $wpdb->query($sql);
874
 
875
  }
876
+
877
+ $this->incoming_message = $udrpc_message;
878
 
879
  $command = (string)$udrpc_message['command'];
880
  $data = empty($udrpc_message['data']) ? null : $udrpc_message['data'];
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: Backup with UpdraftPlus, DavidAnderson, DNutbourne
3
  Tags: backup, backups, restore, amazon backup, s3 backup, dropbox backup, google drive backup, rackspace cloud files, rackspace backup, dreamhost, dreamobjects backup, ftp backup, webdav backup, google cloud storage, onedrive, microsoft one drive, microsoft azure, azure, back up, multisite, restoration, sftp backup, ftps, scp backup, migrate, duplicate, copy, mysql backup, database backup, db backups, website backup, wordpress backup, full backup, openstack backup, sicherung
4
  Requires at least: 3.2
5
  Tested up to: 4.5
6
- Stable tag: 1.12.0
7
  Author URI: https://updraftplus.com
8
  Donate link: http://david.dw-perspective.org.uk/donate
9
  License: GPLv3 or later
@@ -120,7 +120,11 @@ The <a href="https://updraftplus.com/news/">UpdraftPlus backup blog</a> is the b
120
 
121
  N.B. Paid versions of UpdraftPlus Backup / Restore have a version number which is 1 higher in the first digit, and has an extra component on the end, but the changelog below still applies. i.e. changes listed for 1.11.29 of the free version correspond to changes made in 2.11.29.x of the paid version.
122
 
123
- = 1.12.0 - 23/Mar/2016
 
 
 
 
124
 
125
  * FEATURE: Compatible with the forthcoming (very soon!) UpdraftCentral remote control panel
126
  * COMPATIBILITY: Tested + supported on the upcoming WordPress 4.5
@@ -1808,4 +1812,4 @@ We recognise and thank the following for code and/or libraries used and/or modif
1808
 
1809
 
1810
  == Upgrade Notice ==
1811
- * 1.12.0: Compatible with the forthcoming UpdraftCentral; various tweaks, fixes and small improvements.
3
  Tags: backup, backups, restore, amazon backup, s3 backup, dropbox backup, google drive backup, rackspace cloud files, rackspace backup, dreamhost, dreamobjects backup, ftp backup, webdav backup, google cloud storage, onedrive, microsoft one drive, microsoft azure, azure, back up, multisite, restoration, sftp backup, ftps, scp backup, migrate, duplicate, copy, mysql backup, database backup, db backups, website backup, wordpress backup, full backup, openstack backup, sicherung
4
  Requires at least: 3.2
5
  Tested up to: 4.5
6
+ Stable tag: 1.12.1
7
  Author URI: https://updraftplus.com
8
  Donate link: http://david.dw-perspective.org.uk/donate
9
  License: GPLv3 or later
120
 
121
  N.B. Paid versions of UpdraftPlus Backup / Restore have a version number which is 1 higher in the first digit, and has an extra component on the end, but the changelog below still applies. i.e. changes listed for 1.11.29 of the free version correspond to changes made in 2.11.29.x of the paid version.
122
 
123
+ = 1.12.1 - 24/Mar/2016 =
124
+
125
+ * TWEAK: Update the bundled remote communications library - needed for some UpdraftCentral users
126
+
127
+ = 1.12.0 - 23/Mar/2016 =
128
 
129
  * FEATURE: Compatible with the forthcoming (very soon!) UpdraftCentral remote control panel
130
  * COMPATIBILITY: Tested + supported on the upcoming WordPress 4.5
1812
 
1813
 
1814
  == Upgrade Notice ==
1815
+ * 1.12.1: Compatible with the forthcoming UpdraftCentral; various tweaks, fixes and small improvements.
updraftplus.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: UpdraftPlus - Backup/Restore
4
  Plugin URI: https://updraftplus.com
5
  Description: Backup and restore: take backups locally, or backup to Amazon S3, Dropbox, Google Drive, Rackspace, (S)FTP, WebDAV & email, on automatic schedules.
6
  Author: UpdraftPlus.Com, DavidAnderson
7
- Version: 1.12.0
8
  Donate link: http://david.dw-perspective.org.uk/donate
9
  License: GPLv3 or later
10
  Text Domain: updraftplus
4
  Plugin URI: https://updraftplus.com
5
  Description: Backup and restore: take backups locally, or backup to Amazon S3, Dropbox, Google Drive, Rackspace, (S)FTP, WebDAV & email, on automatic schedules.
6
  Author: UpdraftPlus.Com, DavidAnderson
7
+ Version: 1.12.1
8
  Donate link: http://david.dw-perspective.org.uk/donate
9
  License: GPLv3 or later
10
  Text Domain: updraftplus