UpdraftPlus WordPress Backup Plugin - Version 0.9.21

Version Description

  • 12/07/2012 =
  • Implemented resumption of uploading on Google Drive - much bigger sites can now be backed up
  • Fixed bug whereby setting for deleting local backups was lost
Download this release

Release Info

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

Code changes from version 0.9.20 to 0.9.21

Files changed (2) hide show
  1. readme.txt +4 -0
  2. updraftplus.php +60 -60
readme.txt CHANGED
@@ -69,6 +69,10 @@ Contact me! This is a complex plugin and the only way I can ensure it's robust i
69
 
70
  == Changelog ==
71
 
 
 
 
 
72
  = 0.9.20 - 12/06/2012 =
73
  * Updated to latest S3.php library with chunked uploading patch
74
  * Implemented chunked uploading on Amazon S3 - much bigger sites can now be backed up with S3
69
 
70
  == Changelog ==
71
 
72
+ = 0.9.21 - 12/07/2012 =
73
+ * Implemented resumption of uploading on Google Drive - much bigger sites can now be backed up
74
+ * Fixed bug whereby setting for deleting local backups was lost
75
+
76
  = 0.9.20 - 12/06/2012 =
77
  * Updated to latest S3.php library with chunked uploading patch
78
  * Implemented chunked uploading on Amazon S3 - much bigger sites can now be backed up with S3
updraftplus.php CHANGED
@@ -4,16 +4,15 @@ 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: 0.9.20
8
  Donate link: http://david.dw-perspective.org.uk/donate
9
  License: GPL3
10
  Author URI: http://wordshell.net
11
  */
12
 
13
  //TODO (some of these items mine, some from original Updraft awaiting review):
14
- //GoogleDrive resume partial upload support (store the current status in a transient after each chunk; use that on resumption)
15
- //Add DropBox support
16
- //Struggles with large uploads - runs out of time before finishing. Break into chunks? Resume download on later run? (Add a new scheduled event to check on progress? Separate the upload from the creation?).
17
  //improve error reporting. s3 and dir backup have decent reporting now, but not sure i know what to do from here
18
  //list backups that aren't tracked (helps with double backup problem)
19
  //investigate $php_errormsg further
@@ -62,7 +61,7 @@ define('UPDRAFT_DEFAULT_OTHERS_EXCLUDE','upgrade,cache,updraft,index.php');
62
 
63
  class UpdraftPlus {
64
 
65
- var $version = '0.9.20';
66
 
67
  var $dbhandle;
68
  var $errors = array();
@@ -72,7 +71,6 @@ class UpdraftPlus {
72
  var $backup_time;
73
  var $gdocs;
74
  var $gdocs_access_token;
75
- var $gdocs_location;
76
 
77
  function __construct() {
78
  // Initialisation actions
@@ -92,7 +90,7 @@ class UpdraftPlus {
92
  add_action('init', array($this, 'googledrive_backup_auth'));
93
  }
94
 
95
- // Handle Google OAuth 2.0
96
  function googledrive_backup_auth() {
97
  if ( is_admin() && isset( $_GET['page'] ) && $_GET['page'] == 'updraftplus' && isset( $_GET['action'] ) && $_GET['action'] == 'auth' ) {
98
  if ( isset( $_GET['state'] ) ) {
@@ -194,6 +192,7 @@ class UpdraftPlus {
194
  ) )
195
  )
196
  );
 
197
  $result = @file_get_contents('https://accounts.google.com/o/oauth2/token', false, stream_context_create($context));
198
  # Oddly, sometimes fails and then trying again works...
199
  /*
@@ -288,7 +287,7 @@ class UpdraftPlus {
288
  $this->log("$file: $key: This file has NOT been successfully uploaded in the last 3 hours: will retry");
289
  $undone_files[$key] = $file;
290
  } else {
291
- $this-log("$file: Note: This file was not marked as successfully uploaded, but does not exist on the local filesystem");
292
  $this->uploaded_file($file);
293
  }
294
  }
@@ -402,7 +401,7 @@ class UpdraftPlus {
402
  $this->log("Saving last backup information into WordPress db");
403
  $this->save_last_backup($backup_array);
404
 
405
- // Delete local files, send the email
406
  $this->cloud_backup_finish($backup_array);
407
 
408
  }
@@ -432,15 +431,11 @@ class UpdraftPlus {
432
 
433
  function cloud_backup_finish($backup_array) {
434
 
435
- //delete local files if the pref is set
436
- foreach($backup_array as $file) { $this->delete_local($file); }
437
-
438
  // Send the results email if requested
439
  if(get_option('updraft_email') != "" && get_option('updraft_service') != 'email') $this->send_results_email();
440
 
441
  }
442
 
443
-
444
  function send_results_email() {
445
 
446
  $sendmail_to = get_option('updraft_email');
@@ -449,7 +444,7 @@ class UpdraftPlus {
449
 
450
  $append_log = (get_option('updraft_debug_mode') && $this->logfile_name != "") ? "\r\nLog contents:\r\n".file_get_contents($this->logfile_name) : "" ;
451
 
452
- wp_mail($sendmail_to,'Backed up: '.get_bloginfo('name').' (UpdraftPlus) '.date('Y-m-d H:i',time()),'Site: '.site_url()."\r\nUpdraftPlus WordPress backup is complete.\r\nBackup contains: ".get_transient("updraftplus_backupcontains")."\r\n\r\n".$this->wordshell_random_advert(0)."\r\n".$append_log);
453
 
454
  }
455
 
@@ -465,6 +460,7 @@ class UpdraftPlus {
465
  function uploaded_file($file, $id = false) {
466
  # We take an MD5 hash because set_transient wants a name of 45 characters or less
467
  $hash = md5($file);
 
468
  set_transient("updraft_".$hash, "yes", 3600*4);
469
  if ($id) {
470
  $ids = get_option('updraft_file_ids', array() );
@@ -472,6 +468,9 @@ class UpdraftPlus {
472
  update_option('updraft_file_ids',$ids);
473
  $this->log("Stored file<->id correlation in database ($file <-> $id)");
474
  }
 
 
 
475
  }
476
 
477
  function cloud_backup($backup_array) {
@@ -627,6 +626,7 @@ class UpdraftPlus {
627
  function s3_backup($backup_array) {
628
 
629
  if(!class_exists('S3')) require_once(dirname(__FILE__).'/includes/S3.php');
 
630
  $s3 = new S3(get_option('updraft_s3_login'), get_option('updraft_s3_pass'));
631
 
632
  $bucket_name = untrailingslashit(get_option('updraft_s3_remote_path'));
@@ -638,8 +638,8 @@ class UpdraftPlus {
638
  $bucket_path = $bmatches[2]."/";
639
  }
640
 
641
-
642
  if (@$s3->putBucket($bucket_name, S3::ACL_PRIVATE)) {
 
643
  foreach($backup_array as $file) {
644
 
645
  // We upload in 5Mb chunks to allow more efficient resuming and hence uploading of larger files
@@ -747,33 +747,34 @@ class UpdraftPlus {
747
  return true;
748
  }
749
 
 
 
 
 
750
  function googledrive_upload_file( $file, $title, $parent = '') {
751
 
752
  // Make sure $this->gdocs is a UpdraftPlus_GDocs object, or give an error
753
  if ( is_wp_error( $e = $this->need_gdocs() ) ) return false;
754
 
755
- if ( empty( $this->gdocs_location ) ) {
 
 
 
 
 
756
  $this->log("$file: Attempting to upload file to Google Drive.");
757
- $location = $this->gdocs->prepare_upload(
758
- $file,
759
- $title,
760
- $parent
761
- );
762
  } else {
763
- $this->log('$file: Attempting to resume upload.');
764
- $location = $this->gdocs->resume_upload(
765
- $file,
766
- $this->gdocs_location
767
- );
768
  }
769
 
770
  if ( is_wp_error( $location ) ) {
771
  $this->log("GoogleDrive upload: an error occurred");
772
  foreach ($location->get_error_messages() as $msg) {
 
773
  $this->log("Error details: ".$msg);
774
  }
775
- // TODO
776
- //$this->reschedule_backup( $id );
777
  return false;
778
  }
779
 
@@ -786,36 +787,37 @@ class UpdraftPlus {
786
  $res = $location;
787
  $this->log("Uploading file with title ".$title);
788
  $d = 0;
789
- // echo '<div id="progress">';
790
  do {
791
- $this->gdocs_location = $res;
792
  $res = $this->gdocs->upload_chunk();
 
793
  $p = $this->gdocs->get_upload_percentage();
794
  if ( $p - $d >= 1 ) {
795
  $b = intval( $p - $d );
796
  // echo '<span style="width:' . $b . '%"></span>';
797
  $d += $b;
798
  }
799
- // $this->options['backup_list'][$id]['percentage'] = $p;
800
  // $this->options['backup_list'][$id]['speed'] = $this->gdocs->get_upload_speed();
801
  } while ( is_string( $res ) );
802
  // echo '</div>';
803
 
804
- if ( is_wp_error( $res ) ) {
805
  $this->log( "An error occurred during GoogleDrive upload (2)" );
806
- # TODO
807
- // $this->reschedule_backup( $id );
 
 
808
  return false;
809
  }
810
 
811
  $this->log("The file was successfully uploaded to Google Drive in ".number_format_i18n( $this->gdocs->time_taken(), 3)." seconds at an upload speed of ".size_format( $this->gdocs->get_upload_speed() )."/s.");
812
-
813
- $this->gdocs_location = null;
814
  // unset( $this->options['backup_list'][$id]['location'], $this->options['backup_list'][$id]['attempt'] );
815
  }
816
 
817
  return $this->gdocs->get_file_id();
818
- // unset( $this->options['backup_list'][$id]['percentage'], $this->options['backup_list'][$id]['speed'] );
819
  // $this->update_quota();
820
  // Google's "user info" service
821
  // if ( empty( $this->options['user_info'] ) ) $this->set_user_info();
@@ -839,7 +841,7 @@ class UpdraftPlus {
839
  $file_path = trailingslashit(get_option('updraft_dir')).$file;
840
  $file_name = basename($file_path);
841
  $this->log("$file_name: Attempting to upload to Google Drive");
842
- $timer_start = microtime( true );
843
  if ( $id = $this->googledrive_upload_file( $file_path, $file_name, get_option('updraft_googledrive_remotepath')) ) {
844
  $this->log('OK: Archive ' . $file_name . ' uploaded to Google Drive in ' . ( round(microtime( true ) - $timer_start,2) ) . ' seconds (id: '.$id.')' );
845
  $this->uploaded_file($file, $id);
@@ -2114,7 +2116,8 @@ ENDHERE;
2114
  </tr>
2115
  <tr class="deletelocal s3 ftp email" <?php echo $display_delete_local?>>
2116
  <th>Delete local backup:</th>
2117
- <td><input type="checkbox" name="updraft_delete_local" value="1" <?php echo $delete_local; ?> /> <br>Check this to delete the local backup file (only sensible if you have enabled a remote backup (below), otherwise you will have no backup remaining).</td>
 
2118
  </tr>
2119
 
2120
  <tr class="backup-retain-description">
@@ -2139,7 +2142,6 @@ ENDHERE;
2139
  <th>Remote backup:</th>
2140
  <td><select name="updraft_service" id="updraft-service">
2141
  <?php
2142
- $delete_local = (get_option('updraft_delete_local')) ? 'checked="checked"' : "";
2143
  $debug_mode = (get_option('updraft_debug_mode')) ? 'checked="checked"' : "";
2144
 
2145
  $display_none = 'style="display:none"';
@@ -2202,7 +2204,7 @@ ENDHERE;
2202
  </tr>
2203
  <tr class="s3" <?php echo $s3_display?>>
2204
  <th>S3 secret key:</th>
2205
- <td><input type="password" autocomplete="off" style="width:292px" name="updraft_s3_pass" value="<?php echo get_option('updraft_s3_pass'); ?>" /></td>
2206
  </tr>
2207
  <tr class="s3" <?php echo $s3_display?>>
2208
  <th>S3 location:</th>
@@ -2214,13 +2216,26 @@ ENDHERE;
2214
  </tr>
2215
 
2216
  <!-- Google Drive -->
 
 
 
 
 
 
 
 
 
 
 
 
 
2217
  <tr class="googledrive" <?php echo $googledrive_display?>>
2218
  <th>Google Drive Client ID:</th>
2219
  <td><input type="text" autocomplete="off" style="width:332px" name="updraft_googledrive_clientid" value="<?php echo get_option('updraft_googledrive_clientid') ?>" /></td>
2220
  </tr>
2221
  <tr class="googledrive" <?php echo $googledrive_display?>>
2222
  <th>Google Drive Client Secret:</th>
2223
- <td><input type="password" autocomplete="off" style="width:332px" name="updraft_googledrive_secret" value="<?php echo get_option('updraft_googledrive_secret'); ?>" /></td>
2224
  </tr>
2225
  <tr class="googledrive" <?php echo $googledrive_display?>>
2226
  <th>Google Drive Folder ID:</th>
@@ -2228,25 +2243,9 @@ ENDHERE;
2228
  </tr>
2229
  <tr class="googledrive" <?php echo $googledrive_display?>>
2230
  <th>Authenticate with Google:</th>
2231
- <td><p><a href="?page=updraftplus&action=auth&updraftplus_googleauth=doit"><strong>After</strong> you have saved your settings (by clicking &quot;Save Changes&quot; below), then come back here once and click this link to complete authentication with Google.</a>
2232
 
2233
- <?php
2234
- if (get_option('updraft_googledrive_token','xyz') != 'xyz') {
2235
- echo " (You appear to be already authenticated)";
2236
- }
2237
- ?>
2238
  </p>
2239
- </td>
2240
- </tr>
2241
- <tr class="googledrive" <?php echo $googledrive_display?>>
2242
- <th></th>
2243
- <td>
2244
- Create a Client ID in the API Access section of your <a href="https://code.google.com/apis/console/">Google API Console</a>. Select 'Web Application' as the application type.</p><p>You must add <kbd><?php echo admin_url('options-general.php?page=updraftplus&action=auth'); ?></kbd> as the authorised redirect URI when asked.
2245
-
2246
- <?php
2247
- if (!class_exists('SimpleXMLElement')) { echo " <b>WARNING:</b> You do not have the SimpleXMLElement installed. Google Drive backups will <b>not</b> work until you do."; }
2248
- ?>
2249
-
2250
  </td>
2251
  </tr>
2252
 
@@ -2260,7 +2259,7 @@ ENDHERE;
2260
  </tr>
2261
  <tr class="ftp" <?php echo $ftp_display?>>
2262
  <th><a href="#" title="Click for help!" onclick="jQuery('.ftp-description').toggle();return false;">FTP Password:</a></th>
2263
- <td><input type="password" autocomplete="off" style="width:260px" name="updraft_ftp_pass" value="<?php echo get_option('updraft_ftp_pass'); ?>" /></td>
2264
  </tr>
2265
  <tr class="ftp" <?php echo $ftp_display?>>
2266
  <th><a href="#" title="Click for help!" onclick="jQuery('.ftp-description').toggle();return false;">Remote Path:</a></th>
@@ -2416,4 +2415,5 @@ ENDHERE;
2416
 
2417
  }
2418
 
 
2419
  ?>
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: 0.9.21
8
  Donate link: http://david.dw-perspective.org.uk/donate
9
  License: GPL3
10
  Author URI: http://wordshell.net
11
  */
12
 
13
  //TODO (some of these items mine, some from original Updraft awaiting review):
14
+ //Add DropBox and Microsoft Skydrive support
15
+ //Backup record should include *where* the backup was placed, so that we don't attempt to delete old ones from the wrong place? (Or would that be unexpected to users to have things from elsewhere deleted?)
 
16
  //improve error reporting. s3 and dir backup have decent reporting now, but not sure i know what to do from here
17
  //list backups that aren't tracked (helps with double backup problem)
18
  //investigate $php_errormsg further
61
 
62
  class UpdraftPlus {
63
 
64
+ var $version = '0.9.21';
65
 
66
  var $dbhandle;
67
  var $errors = array();
71
  var $backup_time;
72
  var $gdocs;
73
  var $gdocs_access_token;
 
74
 
75
  function __construct() {
76
  // Initialisation actions
90
  add_action('init', array($this, 'googledrive_backup_auth'));
91
  }
92
 
93
+ // Handle Google OAuth 2.0 - ?page=updraftplus&action=auth
94
  function googledrive_backup_auth() {
95
  if ( is_admin() && isset( $_GET['page'] ) && $_GET['page'] == 'updraftplus' && isset( $_GET['action'] ) && $_GET['action'] == 'auth' ) {
96
  if ( isset( $_GET['state'] ) ) {
192
  ) )
193
  )
194
  );
195
+ // TODO Use curl??
196
  $result = @file_get_contents('https://accounts.google.com/o/oauth2/token', false, stream_context_create($context));
197
  # Oddly, sometimes fails and then trying again works...
198
  /*
287
  $this->log("$file: $key: This file has NOT been successfully uploaded in the last 3 hours: will retry");
288
  $undone_files[$key] = $file;
289
  } else {
290
+ $this->log("$file: Note: This file was not marked as successfully uploaded, but does not exist on the local filesystem");
291
  $this->uploaded_file($file);
292
  }
293
  }
401
  $this->log("Saving last backup information into WordPress db");
402
  $this->save_last_backup($backup_array);
403
 
404
+ // Send the email
405
  $this->cloud_backup_finish($backup_array);
406
 
407
  }
431
 
432
  function cloud_backup_finish($backup_array) {
433
 
 
 
 
434
  // Send the results email if requested
435
  if(get_option('updraft_email') != "" && get_option('updraft_service') != 'email') $this->send_results_email();
436
 
437
  }
438
 
 
439
  function send_results_email() {
440
 
441
  $sendmail_to = get_option('updraft_email');
444
 
445
  $append_log = (get_option('updraft_debug_mode') && $this->logfile_name != "") ? "\r\nLog contents:\r\n".file_get_contents($this->logfile_name) : "" ;
446
 
447
+ wp_mail($sendmail_to,'Backed up: '.get_bloginfo('name').' (UpdraftPlus '.$this->version.') '.date('Y-m-d H:i',time()),'Site: '.site_url()."\r\nUpdraftPlus WordPress backup is complete.\r\nBackup contains: ".get_transient("updraftplus_backupcontains")."\r\n\r\n".$this->wordshell_random_advert(0)."\r\n".$append_log);
448
 
449
  }
450
 
460
  function uploaded_file($file, $id = false) {
461
  # We take an MD5 hash because set_transient wants a name of 45 characters or less
462
  $hash = md5($file);
463
+ $this->log("$file: $hash: recording as successfully uploaded");
464
  set_transient("updraft_".$hash, "yes", 3600*4);
465
  if ($id) {
466
  $ids = get_option('updraft_file_ids', array() );
468
  update_option('updraft_file_ids',$ids);
469
  $this->log("Stored file<->id correlation in database ($file <-> $id)");
470
  }
471
+ // Delete local files if the option is set
472
+ $this->delete_local($file);
473
+
474
  }
475
 
476
  function cloud_backup($backup_array) {
626
  function s3_backup($backup_array) {
627
 
628
  if(!class_exists('S3')) require_once(dirname(__FILE__).'/includes/S3.php');
629
+
630
  $s3 = new S3(get_option('updraft_s3_login'), get_option('updraft_s3_pass'));
631
 
632
  $bucket_name = untrailingslashit(get_option('updraft_s3_remote_path'));
638
  $bucket_path = $bmatches[2]."/";
639
  }
640
 
 
641
  if (@$s3->putBucket($bucket_name, S3::ACL_PRIVATE)) {
642
+
643
  foreach($backup_array as $file) {
644
 
645
  // We upload in 5Mb chunks to allow more efficient resuming and hence uploading of larger files
747
  return true;
748
  }
749
 
750
+ // Returns:
751
+ // true = already uploaded
752
+ // false = failure
753
+ // otherwise, the file ID
754
  function googledrive_upload_file( $file, $title, $parent = '') {
755
 
756
  // Make sure $this->gdocs is a UpdraftPlus_GDocs object, or give an error
757
  if ( is_wp_error( $e = $this->need_gdocs() ) ) return false;
758
 
759
+ $hash = md5($file);
760
+ $transkey = 'upd_'.$hash.'_gloc';
761
+ // This is unset upon completion, so if it is set then we are resuming
762
+ $possible_location = get_transient($transkey);
763
+
764
+ if ( empty( $possible_location ) ) {
765
  $this->log("$file: Attempting to upload file to Google Drive.");
766
+ $location = $this->gdocs->prepare_upload( $file, $title, $parent );
 
 
 
 
767
  } else {
768
+ $this->log("$file: Attempting to resume upload.");
769
+ $location = $this->gdocs->resume_upload( $file, $possible_location );
 
 
 
770
  }
771
 
772
  if ( is_wp_error( $location ) ) {
773
  $this->log("GoogleDrive upload: an error occurred");
774
  foreach ($location->get_error_messages() as $msg) {
775
+ $this->error($msg);
776
  $this->log("Error details: ".$msg);
777
  }
 
 
778
  return false;
779
  }
780
 
787
  $res = $location;
788
  $this->log("Uploading file with title ".$title);
789
  $d = 0;
 
790
  do {
791
+ $this->log("Google Drive upload: chunk d: $d, loc: $res");
792
  $res = $this->gdocs->upload_chunk();
793
+ if (is_string($res)) set_transient($transkey, $res, 3600*3);
794
  $p = $this->gdocs->get_upload_percentage();
795
  if ( $p - $d >= 1 ) {
796
  $b = intval( $p - $d );
797
  // echo '<span style="width:' . $b . '%"></span>';
798
  $d += $b;
799
  }
 
800
  // $this->options['backup_list'][$id]['speed'] = $this->gdocs->get_upload_speed();
801
  } while ( is_string( $res ) );
802
  // echo '</div>';
803
 
804
+ if ( is_wp_error( $res ) || $res !== true) {
805
  $this->log( "An error occurred during GoogleDrive upload (2)" );
806
+ $this->error( "An error occurred during GoogleDrive upload (2)" );
807
+ if (is_wp_error( $res )) {
808
+ foreach ($res->get_error_messages() as $msg) { $this->log($msg); }
809
+ }
810
  return false;
811
  }
812
 
813
  $this->log("The file was successfully uploaded to Google Drive in ".number_format_i18n( $this->gdocs->time_taken(), 3)." seconds at an upload speed of ".size_format( $this->gdocs->get_upload_speed() )."/s.");
814
+
815
+ delete_transient($transkey);
816
  // unset( $this->options['backup_list'][$id]['location'], $this->options['backup_list'][$id]['attempt'] );
817
  }
818
 
819
  return $this->gdocs->get_file_id();
820
+
821
  // $this->update_quota();
822
  // Google's "user info" service
823
  // if ( empty( $this->options['user_info'] ) ) $this->set_user_info();
841
  $file_path = trailingslashit(get_option('updraft_dir')).$file;
842
  $file_name = basename($file_path);
843
  $this->log("$file_name: Attempting to upload to Google Drive");
844
+ $timer_start = microtime(true);
845
  if ( $id = $this->googledrive_upload_file( $file_path, $file_name, get_option('updraft_googledrive_remotepath')) ) {
846
  $this->log('OK: Archive ' . $file_name . ' uploaded to Google Drive in ' . ( round(microtime( true ) - $timer_start,2) ) . ' seconds (id: '.$id.')' );
847
  $this->uploaded_file($file, $id);
2116
  </tr>
2117
  <tr class="deletelocal s3 ftp email" <?php echo $display_delete_local?>>
2118
  <th>Delete local backup:</th>
2119
+ <td><input type="checkbox" name="updraft_delete_local" value="1" <?php $delete_local = (get_option('updraft_delete_local')) ? 'checked="checked"' : "";
2120
+ echo $delete_local; ?> /> <br>Check this to delete the local backup file (only sensible if you have enabled a remote backup (below), otherwise you will have no backup remaining).</td>
2121
  </tr>
2122
 
2123
  <tr class="backup-retain-description">
2142
  <th>Remote backup:</th>
2143
  <td><select name="updraft_service" id="updraft-service">
2144
  <?php
 
2145
  $debug_mode = (get_option('updraft_debug_mode')) ? 'checked="checked"' : "";
2146
 
2147
  $display_none = 'style="display:none"';
2204
  </tr>
2205
  <tr class="s3" <?php echo $s3_display?>>
2206
  <th>S3 secret key:</th>
2207
+ <td><input type="text" autocomplete="off" style="width:292px" name="updraft_s3_pass" value="<?php echo get_option('updraft_s3_pass'); ?>" /></td>
2208
  </tr>
2209
  <tr class="s3" <?php echo $s3_display?>>
2210
  <th>S3 location:</th>
2216
  </tr>
2217
 
2218
  <!-- Google Drive -->
2219
+
2220
+ <tr class="googledrive" <?php echo $googledrive_display?>>
2221
+ <th>Google Drive:</th>
2222
+ <td>
2223
+ <a href="https://code.google.com/apis/console/">Follow this link to your Google API Console</a>, and there create a Client ID in the API Access section. Select 'Web Application' as the application type.</p><p>You must add <kbd><?php echo admin_url('options-general.php?page=updraftplus&action=auth'); ?></kbd> as the authorised redirect URI when asked.
2224
+
2225
+ <?php
2226
+ if (!class_exists('SimpleXMLElement')) { echo " <b>WARNING:</b> You do not have the SimpleXMLElement installed. Google Drive backups will <b>not</b> work until you do."; }
2227
+ ?>
2228
+
2229
+ </td>
2230
+ </tr>
2231
+
2232
  <tr class="googledrive" <?php echo $googledrive_display?>>
2233
  <th>Google Drive Client ID:</th>
2234
  <td><input type="text" autocomplete="off" style="width:332px" name="updraft_googledrive_clientid" value="<?php echo get_option('updraft_googledrive_clientid') ?>" /></td>
2235
  </tr>
2236
  <tr class="googledrive" <?php echo $googledrive_display?>>
2237
  <th>Google Drive Client Secret:</th>
2238
+ <td><input type="text" style="width:332px" name="updraft_googledrive_secret" value="<?php echo get_option('updraft_googledrive_secret'); ?>" /></td>
2239
  </tr>
2240
  <tr class="googledrive" <?php echo $googledrive_display?>>
2241
  <th>Google Drive Folder ID:</th>
2243
  </tr>
2244
  <tr class="googledrive" <?php echo $googledrive_display?>>
2245
  <th>Authenticate with Google:</th>
2246
+ <td><p><?php if (get_option('updraft_googledrive_token','xyz') != 'xyz') echo "<strong>(You appear to be already authenticated).</strong>"; ?> <a href="?page=updraftplus&action=auth&updraftplus_googleauth=doit"><strong>After</strong> you have saved your settings (by clicking &quot;Save Changes&quot; below), then come back here once and click this link to complete authentication with Google.</a>
2247
 
 
 
 
 
 
2248
  </p>
 
 
 
 
 
 
 
 
 
 
 
2249
  </td>
2250
  </tr>
2251
 
2259
  </tr>
2260
  <tr class="ftp" <?php echo $ftp_display?>>
2261
  <th><a href="#" title="Click for help!" onclick="jQuery('.ftp-description').toggle();return false;">FTP Password:</a></th>
2262
+ <td><input type="text" autocomplete="off" style="width:260px" name="updraft_ftp_pass" value="<?php echo get_option('updraft_ftp_pass'); ?>" /></td>
2263
  </tr>
2264
  <tr class="ftp" <?php echo $ftp_display?>>
2265
  <th><a href="#" title="Click for help!" onclick="jQuery('.ftp-description').toggle();return false;">Remote Path:</a></th>
2415
 
2416
  }
2417
 
2418
+
2419
  ?>