UpdraftPlus WordPress Backup Plugin - Version 1.2.27

Version Description

  • 01/14/2013 =
  • Fixed bug with DropBox deletions
  • Fixed cases where DropBox failed to resume chunked uploading
  • Can now create uncreated zip files on a resumption attempt
  • FTP method now supports SSL (automatically detected)
  • New "Test FTP settings" button
Download this release

Release Info

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

Code changes from version 1.2.26 to 1.2.27

Files changed (4) hide show
  1. includes/ftp.class.php +2 -1
  2. methods/ftp.php +106 -15
  3. readme.txt +6 -4
  4. updraftplus.php +2 -2
includes/ftp.class.php CHANGED
@@ -12,7 +12,6 @@ class ftp_wrapper
12
  public $ssl = false;
13
  public $system_type = '';
14
 
15
-
16
  public function __construct($host, $username, $password, $port = 21)
17
  {
18
  $this->host = $host;
@@ -38,6 +37,8 @@ class ftp_wrapper
38
  return false;
39
  }
40
  }
 
 
41
 
42
  $result = ftp_login($this->conn_id, $this->username, $this->password);
43
 
12
  public $ssl = false;
13
  public $system_type = '';
14
 
 
15
  public function __construct($host, $username, $password, $port = 21)
16
  {
17
  $this->host = $host;
37
  return false;
38
  }
39
  }
40
+
41
+ if ($this->conn_id === false) return false;
42
 
43
  $result = ftp_login($this->conn_id, $this->username, $this->password);
44
 
methods/ftp.php CHANGED
@@ -8,16 +8,25 @@ class UpdraftPlus_BackupModule_ftp {
8
 
9
  if( !class_exists('ftp_wrapper')) require_once(UPDRAFTPLUS_DIR.'/includes/ftp.class.php');
10
 
11
- //handle SSL and errors at some point TODO
12
- $ftp = new ftp_wrapper(get_option('updraft_server_address'), get_option('updraft_ftp_login'), get_option('updraft_ftp_pass'));
13
  $ftp->passive = true;
14
- $ftp->connect();
 
 
 
 
 
 
 
 
 
15
  //$ftp->make_dir(); we may need to recursively create dirs? TODO
16
 
17
  $ftp_remote_path = trailingslashit(get_option('updraft_ftp_remote_path'));
18
  foreach($backup_array as $file) {
19
  $fullpath = trailingslashit(get_option('updraft_dir')).$file;
20
- $updraftplus->log("FTP upload attempt: $file -> $ftp_remote_path/$file");
21
  $timer_start = microtime(true);
22
  $size_k = round(filesize($fullpath)/1024,1);
23
  if ($ftp->put($fullpath, $ftp_remote_path.$file, FTP_BINARY)) {
@@ -33,49 +42,131 @@ class UpdraftPlus_BackupModule_ftp {
33
  }
34
 
35
  function delete($file, $ftparr) {
 
36
  $ftp = $ftparr['ftp_object'];
37
  $ftp_remote_path = $ftparr['ftp_remote_path'];
38
- @$ftp->delete($ftp_remote_path.$file);
 
 
 
 
39
  }
40
 
41
  function download($file) {
42
  if( !class_exists('ftp_wrapper')) require_once(UPDRAFTPLUS_DIR.'/includes/ftp.class.php');
43
 
44
- //handle SSL and errors at some point TODO
45
  $ftp = new ftp_wrapper(get_option('updraft_server_address'),get_option('updraft_ftp_login'),get_option('updraft_ftp_pass'));
46
  $ftp->passive = true;
47
- $ftp->connect();
 
 
 
 
 
 
 
 
 
48
  //$ftp->make_dir(); we may need to recursively create dirs? TODO
49
 
50
  $ftp_remote_path = trailingslashit(get_option('updraft_ftp_remote_path'));
51
  $fullpath = trailingslashit(get_option('updraft_dir')).$file;
52
- $ftp->get($fullpath,$ftp_remote_path.$file,FTP_BINARY);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
53
  }
54
 
55
  function config_print() {
56
  ?>
57
  <tr class="updraftplusmethod ftp">
58
  <th>FTP Server:</th>
59
- <td><input type="text" style="width:260px" name="updraft_server_address" value="<?php echo htmlspecialchars(get_option('updraft_server_address')); ?>" /></td>
60
  </tr>
61
  <tr class="updraftplusmethod ftp">
62
  <th>FTP Login:</th>
63
- <td><input type="text" autocomplete="off" name="updraft_ftp_login" value="<?php echo htmlspecialchars(get_option('updraft_ftp_login')) ?>" /></td>
64
  </tr>
65
  <tr class="updraftplusmethod ftp">
66
  <th>FTP Password:</th>
67
- <td><input type="text" autocomplete="off" style="width:260px" name="updraft_ftp_pass" value="<?php echo htmlspecialchars(get_option('updraft_ftp_pass')); ?>" /></td>
68
  </tr>
69
  <tr class="updraftplusmethod ftp">
70
  <th>Remote Path:</th>
71
- <td><input type="text" style="width:260px" name="updraft_ftp_remote_path" value="<?php echo htmlspecialchars(get_option('updraft_ftp_remote_path')); ?>" /></td>
 
 
 
 
72
  </tr>
73
  <?php
74
  }
75
 
76
- function file_delete() {
77
- $this->log("$backup_datestamp: Delete remote ftp: $remote_path/$dofile");
78
- @$remote_object->delete($remote_path.$dofile);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
79
  }
80
 
81
  }
8
 
9
  if( !class_exists('ftp_wrapper')) require_once(UPDRAFTPLUS_DIR.'/includes/ftp.class.php');
10
 
11
+ $server = get_option('updraft_server_address');
12
+ $ftp = new ftp_wrapper($server , get_option('updraft_ftp_login'), get_option('updraft_ftp_pass'));
13
  $ftp->passive = true;
14
+
15
+ if (!$ftp->connect()) {
16
+ $ftp->ssl = true;
17
+ if (!$ftp->connect()) {
18
+ $updraftplus->log("FTP Failure: we did not successfully log in with those credentials.");
19
+ $updraftplus->error("FTP login failure");
20
+ return false;
21
+ }
22
+ }
23
+
24
  //$ftp->make_dir(); we may need to recursively create dirs? TODO
25
 
26
  $ftp_remote_path = trailingslashit(get_option('updraft_ftp_remote_path'));
27
  foreach($backup_array as $file) {
28
  $fullpath = trailingslashit(get_option('updraft_dir')).$file;
29
+ $updraftplus->log("FTP upload attempt: $file -> ftp://$server/${ftp_remote_path}${file}");
30
  $timer_start = microtime(true);
31
  $size_k = round(filesize($fullpath)/1024,1);
32
  if ($ftp->put($fullpath, $ftp_remote_path.$file, FTP_BINARY)) {
42
  }
43
 
44
  function delete($file, $ftparr) {
45
+ global $updraftplus;
46
  $ftp = $ftparr['ftp_object'];
47
  $ftp_remote_path = $ftparr['ftp_remote_path'];
48
+ if (@$ftp->delete($ftp_remote_path.$file)) {
49
+ $updraftplus->log("FTP delete: succeeded (${ftp_remote_path}${file})");
50
+ } else {
51
+ $updraftplus->log("FTP delete: failed (${ftp_remote_path}${file})");
52
+ }
53
  }
54
 
55
  function download($file) {
56
  if( !class_exists('ftp_wrapper')) require_once(UPDRAFTPLUS_DIR.'/includes/ftp.class.php');
57
 
58
+ //handle errors at some point TODO
59
  $ftp = new ftp_wrapper(get_option('updraft_server_address'),get_option('updraft_ftp_login'),get_option('updraft_ftp_pass'));
60
  $ftp->passive = true;
61
+
62
+ if (!$ftp->connect()) {
63
+ $ftp->ssl = true;
64
+ if (!$ftp->connect()) {
65
+ $updraftplus->log("FTP Failure: we did not successfully log in with those credentials.");
66
+ $updraftplus->error("FTP login failure");
67
+ return false;
68
+ }
69
+ }
70
+
71
  //$ftp->make_dir(); we may need to recursively create dirs? TODO
72
 
73
  $ftp_remote_path = trailingslashit(get_option('updraft_ftp_remote_path'));
74
  $fullpath = trailingslashit(get_option('updraft_dir')).$file;
75
+ $ftp->get($fullpath, $ftp_remote_path.$file, FTP_BINARY);
76
+ }
77
+
78
+ function config_print_javascript_onready() {
79
+ ?>
80
+ jQuery('#updraft-ftp-test').click(function(){
81
+ var data = {
82
+ action: 'updraft_credentials_test',
83
+ method: 'ftp',
84
+ nonce: '<?php echo wp_create_nonce('updraftplus-credentialtest-nonce'); ?>',
85
+ server: jQuery('#updraft_server_address').val(),
86
+ login: jQuery('#updraft_ftp_login').val(),
87
+ pass: jQuery('#updraft_ftp_pass').val(),
88
+ path: jQuery('#updraft_ftp_remote_path').val()
89
+ };
90
+ jQuery.post(ajaxurl, data, function(response) {
91
+ alert('Settings test result: ' + response);
92
+ });
93
+ });
94
+ <?php
95
  }
96
 
97
  function config_print() {
98
  ?>
99
  <tr class="updraftplusmethod ftp">
100
  <th>FTP Server:</th>
101
+ <td><input type="text" size="40" id="updraft_server_address" name="updraft_server_address" value="<?php echo htmlspecialchars(get_option('updraft_server_address')); ?>" /> <em>Both SSL and non-SSL are supported</em></td>
102
  </tr>
103
  <tr class="updraftplusmethod ftp">
104
  <th>FTP Login:</th>
105
+ <td><input type="text" size="40" id="updraft_ftp_login" name="updraft_ftp_login" value="<?php echo htmlspecialchars(get_option('updraft_ftp_login')) ?>" /></td>
106
  </tr>
107
  <tr class="updraftplusmethod ftp">
108
  <th>FTP Password:</th>
109
+ <td><input type="text" size="40" id="updraft_ftp_pass" name="updraft_ftp_pass" value="<?php echo htmlspecialchars(get_option('updraft_ftp_pass')); ?>" /></td>
110
  </tr>
111
  <tr class="updraftplusmethod ftp">
112
  <th>Remote Path:</th>
113
+ <td><input type="text" size="64" id="updraft_ftp_remote_path" name="updraft_ftp_remote_path" value="<?php echo htmlspecialchars(get_option('updraft_ftp_remote_path')); ?>" /> <em>Needs to already exist</em></td>
114
+ </tr>
115
+ <tr class="updraftplusmethod ftp">
116
+ <th></th>
117
+ <td><p><button id="updraft-ftp-test" type="button" class="button-primary" style="font-size:18px !important">Test FTP Login</button></p></td>
118
  </tr>
119
  <?php
120
  }
121
 
122
+ function credentials_test() {
123
+
124
+ $server = $_POST['server'];
125
+ $login = $_POST['login'];
126
+ $pass = $_POST['pass'];
127
+ $path = $_POST['path'];
128
+
129
+ if (empty($server)) {
130
+ echo "Failure: No server details were given.";
131
+ return;
132
+ }
133
+ if (empty($login)) {
134
+ echo "Failure: No login was given.";
135
+ return;
136
+ }
137
+ if (empty($pass)) {
138
+ echo "Failure: No password was given.";
139
+ return;
140
+ }
141
+
142
+ if( !class_exists('ftp_wrapper')) require_once(UPDRAFTPLUS_DIR.'/includes/ftp.class.php');
143
+
144
+ //handle SSL and errors at some point TODO
145
+ $ftp = new ftp_wrapper($server, $login, $pass);
146
+ $ftp->passive = true;
147
+
148
+ if (!$ftp->connect()) {
149
+ $ftp->ssl = true;
150
+ if (!$ftp->connect()) {
151
+ echo "Failure: we did not successfully log in with those credentials.";
152
+ return;
153
+ }
154
+ }
155
+ //$ftp->make_dir(); we may need to recursively create dirs? TODO
156
+
157
+ $file = md5(rand(0,99999999)).'.tmp';
158
+ $fullpath = trailingslashit($path).$file;
159
+ if (!file_exists(ABSPATH.'wp-includes/version.php')) {
160
+ echo "Failure: an unexpected internal UpdraftPlus error occurred when testing the credentials - please contact the developer";
161
+ return;
162
+ }
163
+ if ($ftp->put(ABSPATH.'wp-includes/version.php', $fullpath, FTP_BINARY)) {
164
+ echo "Success: we successfully logged in, and confirmed our ability to create a file in the given directory.";
165
+ @$ftp->delete($fullpath);
166
+ } else {
167
+ echo "Failure: we successfully logged in, but were not able to create a file in the given directory.";
168
+ }
169
+
170
  }
171
 
172
  }
readme.txt CHANGED
@@ -3,18 +3,18 @@ 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.26
7
  Donate link: http://david.dw-perspective.org.uk/donate
8
  License: GPLv3 or later
9
 
10
  == Upgrade Notice ==
11
- DropBox can now support larger, resumable uploads. Also improved DropBox help text. Made file downloads resumable.
12
 
13
  == Description ==
14
 
15
  UpdraftPlus simplifies backups (and restoration). Backup into the cloud (Amazon S3, DropBox, Google Drive, FTP, and email) and restore with a single click. Backups of files and database can have separate schedules.
16
 
17
- * Supports backups to Amazon S3, DropBox, Google Drive, FTP, email
18
  * One-click restore
19
  * Backup automatically on a repeating schedule
20
  * Files and databases can have separate schedules
@@ -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.26 - 01/14/2013 =
116
  * Fixed bug with DropBox deletions
117
  * Fixed cases where DropBox failed to resume chunked uploading
118
  * Can now create uncreated zip files on a resumption attempt
 
 
119
 
120
  = 1.2.20 - 01/12/2013 =
121
  * DropBox no longer limited to 150Mb uploads
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.27
7
  Donate link: http://david.dw-perspective.org.uk/donate
8
  License: GPLv3 or later
9
 
10
  == Upgrade Notice ==
11
+ DropBox can now support larger, resumable uploads. Also improved DropBox help text. Made file downloads resumable. FTP supports SSL.
12
 
13
  == Description ==
14
 
15
  UpdraftPlus simplifies backups (and restoration). Backup into the cloud (Amazon S3, DropBox, Google Drive, FTP, and email) and restore with a single click. Backups of files and database can have separate schedules.
16
 
17
+ * Supports backups to Amazon S3, DropBox, Google Drive, FTP (including SSL), email
18
  * One-click restore
19
  * Backup automatically on a repeating schedule
20
  * Files and databases can have separate schedules
112
 
113
  == Changelog ==
114
 
115
+ = 1.2.27 - 01/14/2013 =
116
  * Fixed bug with DropBox deletions
117
  * Fixed cases where DropBox failed to resume chunked uploading
118
  * Can now create uncreated zip files on a resumption attempt
119
+ * FTP method now supports SSL (automatically detected)
120
+ * New "Test FTP settings" button
121
 
122
  = 1.2.20 - 01/12/2013 =
123
  * DropBox no longer limited to 150Mb uploads
updraftplus.php CHANGED
@@ -4,7 +4,7 @@ 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.26
8
  Donate link: http://david.dw-perspective.org.uk/donate
9
  License: GPLv3 or later
10
  Author URI: http://wordshell.net
@@ -66,7 +66,7 @@ define('UPDRAFT_DEFAULT_OTHERS_EXCLUDE','upgrade,cache,updraft,index.php');
66
 
67
  class UpdraftPlus {
68
 
69
- var $version = '1.2.26';
70
 
71
  // Choices will be shown in the admin menu in the order used here
72
  var $backup_methods = array (
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.27
8
  Donate link: http://david.dw-perspective.org.uk/donate
9
  License: GPLv3 or later
10
  Author URI: http://wordshell.net
66
 
67
  class UpdraftPlus {
68
 
69
+ var $version = '1.2.27';
70
 
71
  // Choices will be shown in the admin menu in the order used here
72
  var $backup_methods = array (