UpdraftPlus WordPress Backup Plugin - Version 1.4.29

Version Description

  • 02/23/2013 =
  • Now remembers what cloud service you used for historical backups, if you later switch
  • Now performs user downloads from the settings page asynchronously, meaning that enormous backups can be fetched this way
  • Fixed bug which forced GoogleDrive users to re-authenticate unnecessarily
  • Fixed apparent race condition that broke some backups
  • Include disk free space warning
  • More intelligent scheduling of resumptions, leading to faster completion on hosts with low max_execution_time values
  • Polls and updates in-page backup history status (no refresh required)
  • Hooks for SFTP + encrypted FTP add-on
Download this release

Release Info

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

Code changes from version 1.4.28 to 1.4.29

Files changed (4) hide show
  1. includes/ftp.class.php +4 -18
  2. methods/ftp.php +26 -27
  3. readme.txt +3 -3
  4. updraftplus.php +9 -8
includes/ftp.class.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /* from http://www.solutionbot.com/2009/01/02/php-ftp-class/ */
3
- class ftp_wrapper
4
  {
5
  private $conn_id;
6
  private $host;
@@ -8,9 +8,9 @@ class ftp_wrapper
8
  private $password;
9
  private $port;
10
  public $timeout = 90;
11
- public $passive = false;
12
- public $ssl = false;
13
  public $system_type = '';
 
14
 
15
  public function __construct($host, $username, $password, $port = 21)
16
  {
@@ -22,21 +22,7 @@ class ftp_wrapper
22
 
23
  public function connect()
24
  {
25
- if ($this->ssl == false)
26
- {
27
- $this->conn_id = ftp_connect($this->host, $this->port);
28
- }
29
- else
30
- {
31
- if (function_exists('ftp_ssl_connect'))
32
- {
33
- $this->conn_id = ftp_ssl_connect($this->host, $this->port);
34
- }
35
- else
36
- {
37
- return false;
38
- }
39
- }
40
 
41
  if ($this->conn_id === false) return false;
42
 
1
  <?php
2
  /* from http://www.solutionbot.com/2009/01/02/php-ftp-class/ */
3
+ class UpdraftPlus_ftp_wrapper
4
  {
5
  private $conn_id;
6
  private $host;
8
  private $password;
9
  private $port;
10
  public $timeout = 90;
11
+ public $passive = true;
 
12
  public $system_type = '';
13
+ public $login_type = 'non-encrypted';
14
 
15
  public function __construct($host, $username, $password, $port = 21)
16
  {
22
 
23
  public function connect()
24
  {
25
+ $this->conn_id = ftp_connect($this->host, $this->port);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26
 
27
  if ($this->conn_id === false) return false;
28
 
methods/ftp.php CHANGED
@@ -6,27 +6,26 @@ class UpdraftPlus_BackupModule_ftp {
6
 
7
  global $updraftplus;
8
 
9
- if( !class_exists('ftp_wrapper')) require_once(UPDRAFTPLUS_DIR.'/includes/ftp.class.php');
10
 
11
  $server = UpdraftPlus_Options::get_updraft_option('updraft_server_address');
12
- $ftp = new ftp_wrapper($server , UpdraftPlus_Options::get_updraft_option('updraft_ftp_login'), UpdraftPlus_Options::get_updraft_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(UpdraftPlus_Options::get_updraft_option('updraft_ftp_remote_path'));
27
  foreach($backup_array as $file) {
28
  $fullpath = trailingslashit(UpdraftPlus_Options::get_updraft_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)) {
@@ -53,19 +52,16 @@ class UpdraftPlus_BackupModule_ftp {
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(UpdraftPlus_Options::get_updraft_option('updraft_server_address'),UpdraftPlus_Options::get_updraft_option('updraft_ftp_login'),UpdraftPlus_Options::get_updraft_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
@@ -98,9 +94,15 @@ class UpdraftPlus_BackupModule_ftp {
98
 
99
  public static function config_print() {
100
  ?>
 
 
 
 
 
 
101
  <tr class="updraftplusmethod ftp">
102
  <th>FTP Server:</th>
103
- <td><input type="text" size="40" id="updraft_server_address" name="updraft_server_address" value="<?php echo htmlspecialchars(UpdraftPlus_Options::get_updraft_option('updraft_server_address')); ?>" /> <em>Both SSL and non-SSL are supported</em></td>
104
  </tr>
105
  <tr class="updraftplusmethod ftp">
106
  <th>FTP Login:</th>
@@ -141,18 +143,15 @@ class UpdraftPlus_BackupModule_ftp {
141
  return;
142
  }
143
 
144
- if( !class_exists('ftp_wrapper')) require_once(UPDRAFTPLUS_DIR.'/includes/ftp.class.php');
145
 
146
  //handle SSL and errors at some point TODO
147
- $ftp = new ftp_wrapper($server, $login, $pass);
148
  $ftp->passive = true;
149
 
150
  if (!$ftp->connect()) {
151
- $ftp->ssl = true;
152
- if (!$ftp->connect()) {
153
- echo "Failure: we did not successfully log in with those credentials.";
154
- return;
155
- }
156
  }
157
  //$ftp->make_dir(); we may need to recursively create dirs? TODO
158
 
@@ -163,7 +162,7 @@ class UpdraftPlus_BackupModule_ftp {
163
  return;
164
  }
165
  if ($ftp->put(ABSPATH.'wp-includes/version.php', $fullpath, FTP_BINARY)) {
166
- echo "Success: we successfully logged in, and confirmed our ability to create a file in the given directory.";
167
  @$ftp->delete($fullpath);
168
  } else {
169
  echo "Failure: we successfully logged in, but were not able to create a file in the given directory.";
6
 
7
  global $updraftplus;
8
 
9
+ if( !class_exists('UpdraftPlus_ftp_wrapper')) require_once(UPDRAFTPLUS_DIR.'/includes/ftp.class.php');
10
 
11
  $server = UpdraftPlus_Options::get_updraft_option('updraft_server_address');
12
+
13
+ $user = UpdraftPlus_Options::get_updraft_option('updraft_ftp_login');
14
+ $ftp = new UpdraftPlus_ftp_wrapper($server , $user, UpdraftPlus_Options::get_updraft_option('updraft_ftp_pass'));
15
  $ftp->passive = true;
16
 
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
  //$ftp->make_dir(); we may need to recursively create dirs? TODO
24
+
25
  $ftp_remote_path = trailingslashit(UpdraftPlus_Options::get_updraft_option('updraft_ftp_remote_path'));
26
  foreach($backup_array as $file) {
27
  $fullpath = trailingslashit(UpdraftPlus_Options::get_updraft_option('updraft_dir')).$file;
28
+ $updraftplus->log("FTP upload attempt: $file -> ftp://$user@$server/${ftp_remote_path}${file}");
29
  $timer_start = microtime(true);
30
  $size_k = round(filesize($fullpath)/1024,1);
31
  if ($ftp->put($fullpath, $ftp_remote_path.$file, FTP_BINARY)) {
52
  }
53
 
54
  function download($file) {
55
+ if( !class_exists('UpdraftPlus_ftp_wrapper')) require_once(UPDRAFTPLUS_DIR.'/includes/ftp.class.php');
56
 
57
  //handle errors at some point TODO
58
+ $ftp = new UpdraftPlus_ftp_wrapper(UpdraftPlus_Options::get_updraft_option('updraft_server_address'),UpdraftPlus_Options::get_updraft_option('updraft_ftp_login'),UpdraftPlus_Options::get_updraft_option('updraft_ftp_pass'));
59
  $ftp->passive = true;
60
 
61
  if (!$ftp->connect()) {
62
+ $updraftplus->log("FTP Failure: we did not successfully log in with those credentials.");
63
+ $updraftplus->error("FTP login failure");
64
+ return false;
 
 
 
65
  }
66
 
67
  //$ftp->make_dir(); we may need to recursively create dirs? TODO
94
 
95
  public static function config_print() {
96
  ?>
97
+
98
+ <tr class="updraftplusmethod ftp">
99
+ <th></th>
100
+ <td><em><?php echo apply_filters('updraft_sftp_ftps_notice', '<strong>Only non-encrypted FTP is supported by regular UpdraftPlus.</strong> If you want encryption (e.g. you are storing sensitive business data), then <a href="http://updraftplus.com/shop/sftp/">an add-on is available.</a>'); ?></em></td>
101
+ </tr>
102
+
103
  <tr class="updraftplusmethod ftp">
104
  <th>FTP Server:</th>
105
+ <td><input type="text" size="40" id="updraft_server_address" name="updraft_server_address" value="<?php echo htmlspecialchars(UpdraftPlus_Options::get_updraft_option('updraft_server_address')); ?>" /></td>
106
  </tr>
107
  <tr class="updraftplusmethod ftp">
108
  <th>FTP Login:</th>
143
  return;
144
  }
145
 
146
+ if( !class_exists('UpdraftPlus_ftp_wrapper')) require_once(UPDRAFTPLUS_DIR.'/includes/ftp.class.php');
147
 
148
  //handle SSL and errors at some point TODO
149
+ $ftp = new UpdraftPlus_ftp_wrapper($server, $login, $pass);
150
  $ftp->passive = true;
151
 
152
  if (!$ftp->connect()) {
153
+ echo "Failure: we did not successfully log in with those credentials.";
154
+ return;
 
 
 
155
  }
156
  //$ftp->make_dir(); we may need to recursively create dirs? TODO
157
 
162
  return;
163
  }
164
  if ($ftp->put(ABSPATH.'wp-includes/version.php', $fullpath, FTP_BINARY)) {
165
+ echo "Success: we successfully logged in, and confirmed our ability to create a file in the given directory (login type: ".$ftp->login_type.')';
166
  @$ftp->delete($fullpath);
167
  } else {
168
  echo "Failure: we successfully logged in, but were not able to create a file in the given directory.";
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: David Anderson
3
  Tags: backup, restore, database, cloud, amazon, s3, dropbox, google drive, ftp, cloud, back up, multisite
4
  Requires at least: 3.2
5
  Tested up to: 3.5.1
6
- Stable tag: 1.4.28
7
  Author URI: http://updraftplus.com
8
  Donate link: http://david.dw-perspective.org.uk/donate
9
  License: GPLv3 or later
@@ -101,7 +101,7 @@ Thanks for asking - yes, I have. Check out my profile page - http://profiles.wor
101
 
102
  == Changelog ==
103
 
104
- = 1.4.28 - 02/23/2013 =
105
  * Now remembers what cloud service you used for historical backups, if you later switch
106
  * Now performs user downloads from the settings page asynchronously, meaning that enormous backups can be fetched this way
107
  * Fixed bug which forced GoogleDrive users to re-authenticate unnecessarily
@@ -109,7 +109,7 @@ Thanks for asking - yes, I have. Check out my profile page - http://profiles.wor
109
  * Include disk free space warning
110
  * More intelligent scheduling of resumptions, leading to faster completion on hosts with low max_execution_time values
111
  * Polls and updates in-page backup history status (no refresh required)
112
- * Hooks for SFTP add-on
113
 
114
  = 1.4.14 - 02/19/2013 =
115
  * Display final status message in email
3
  Tags: backup, restore, database, cloud, amazon, s3, dropbox, google drive, ftp, cloud, back up, multisite
4
  Requires at least: 3.2
5
  Tested up to: 3.5.1
6
+ Stable tag: 1.4.29
7
  Author URI: http://updraftplus.com
8
  Donate link: http://david.dw-perspective.org.uk/donate
9
  License: GPLv3 or later
101
 
102
  == Changelog ==
103
 
104
+ = 1.4.29 - 02/23/2013 =
105
  * Now remembers what cloud service you used for historical backups, if you later switch
106
  * Now performs user downloads from the settings page asynchronously, meaning that enormous backups can be fetched this way
107
  * Fixed bug which forced GoogleDrive users to re-authenticate unnecessarily
109
  * Include disk free space warning
110
  * More intelligent scheduling of resumptions, leading to faster completion on hosts with low max_execution_time values
111
  * Polls and updates in-page backup history status (no refresh required)
112
+ * Hooks for SFTP + encrypted FTP add-on
113
 
114
  = 1.4.14 - 02/19/2013 =
115
  * Display final status message in email
updraftplus.php CHANGED
@@ -2,9 +2,9 @@
2
  /*
3
  Plugin Name: UpdraftPlus - Backup/Restore
4
  Plugin URI: http://updraftplus.com
5
- Description: Backup and restore: your content and database can be automatically backed up to Amazon S3, Dropbox, Google Drive, FTP or email, on separate schedules.
6
  Author: David Anderson
7
- Version: 1.4.28
8
  Donate link: http://david.dw-perspective.org.uk/donate
9
  License: GPLv3 or later
10
  Author URI: http://wordshell.net
@@ -23,6 +23,7 @@ TODO - some are out of date/done, needs pruning
23
  // Warn the user if their zip-file creation is slooowww...
24
  // Create a "Want Support?" button/console, that leads them through what is needed, and performs some basic tests...
25
  // Resuming partial (S)FTP uploads
 
26
  // Make disk space check more intelligent (currently hard-coded at 35Mb)
27
  // Specific folders on DropBox
28
  // Provide backup/restoration for UpdraftPlus's settings, to allow 'bootstrap' on a fresh WP install - some kind of single-use code which a remote UpdraftPlus can use to authenticate
@@ -240,7 +241,7 @@ class UpdraftPlus {
240
  $logline .= (method_exists('ZipArchive', 'addFile')) ? "Y" : "N";
241
  }
242
  $this->log($logline);
243
- $disk_free_space = disk_free_space($updraft_dir);
244
  $this->log("Free space on disk containing Updraft's temporary directory: ".round($disk_free_space/1048576,1)." Mb");
245
  }
246
 
@@ -1770,8 +1771,8 @@ class UpdraftPlus {
1770
 
1771
  function disk_space_check($space) {
1772
  $updraft_dir = $this->backups_dir_location();
1773
- $disk_free_space = disk_free_space($updraft_dir);
1774
- if ($disk_free_space === false) return -1;
1775
  return ($disk_free_space > $space) ? true : false;
1776
  }
1777
 
@@ -1817,7 +1818,7 @@ class UpdraftPlus {
1817
  }
1818
 
1819
  function wordshell_random_advert($urls) {
1820
- if (defined('UPDRAFTPLUS_PREMIUM')) return "";
1821
  $rad = rand(0,8);
1822
  switch ($rad) {
1823
  case 0:
@@ -1835,7 +1836,7 @@ class UpdraftPlus {
1835
  return $this->url_start($urls,'www.simbahosting.co.uk')."Need high-quality WordPress hosting from WordPress specialists? (Including automatic backups and 1-click installer). Get it from the creators of UpdraftPlus.".$this->url_end($urls,'www.simbahosting.co.uk');
1836
  break;
1837
  case 5:
1838
- if (!defined('UPDRAFTPLUS_PREMIUM')) {
1839
  return $this->url_start($urls,'updraftplus.com')."Need even more features and support? Check out UpdraftPlus Premium".$this->url_end($urls,'updraftplus.com');
1840
  } else {
1841
  return "Thanks for being an UpdraftPlus premium user. Keep visiting ".$this->url_start($urls,'updraftplus.com')."updraftplus.com".$this->url_end($urls,'updraftplus.com')." to see what's going on.";
@@ -2212,7 +2213,7 @@ class UpdraftPlus {
2212
  <div class="wrap">
2213
  <h1><?php echo $this->plugin_title; ?></h1>
2214
 
2215
- Maintained by <b>David Anderson</b> (<a href="http://updraftplus.com">UpdraftPlus.Com</a> | <a href="http://david.dw-perspective.org.uk">Author Homepage</a> | <?php if (!defined('UPDRAFTPLUS_PREMIUM')) { ?><a href="http://wordshell.net">WordShell - WordPress command line</a> | <a href="http://david.dw-perspective.org.uk/donate">Donate</a> | <?php } ?><a href="http://wordpress.org/extend/plugins/updraftplus/faq/">FAQs</a> | <a href="http://profiles.wordpress.org/davidanderson/">My other WordPress plugins</a>). Version: <?php echo $this->version; ?>
2216
  <br>
2217
  <?php
2218
  if(isset($_GET['updraft_restore_success'])) {
2
  /*
3
  Plugin Name: UpdraftPlus - Backup/Restore
4
  Plugin URI: http://updraftplus.com
5
+ Description: Backup and restore: your content and database can be backed up locally or to Amazon S3, Dropbox, Google Drive, (S)FTP & email, on separate schedules.
6
  Author: David Anderson
7
+ Version: 1.4.29
8
  Donate link: http://david.dw-perspective.org.uk/donate
9
  License: GPLv3 or later
10
  Author URI: http://wordshell.net
23
  // Warn the user if their zip-file creation is slooowww...
24
  // Create a "Want Support?" button/console, that leads them through what is needed, and performs some basic tests...
25
  // Resuming partial (S)FTP uploads
26
+ // Translations
27
  // Make disk space check more intelligent (currently hard-coded at 35Mb)
28
  // Specific folders on DropBox
29
  // Provide backup/restoration for UpdraftPlus's settings, to allow 'bootstrap' on a fresh WP install - some kind of single-use code which a remote UpdraftPlus can use to authenticate
241
  $logline .= (method_exists('ZipArchive', 'addFile')) ? "Y" : "N";
242
  }
243
  $this->log($logline);
244
+ $disk_free_space = @disk_free_space($updraft_dir);
245
  $this->log("Free space on disk containing Updraft's temporary directory: ".round($disk_free_space/1048576,1)." Mb");
246
  }
247
 
1771
 
1772
  function disk_space_check($space) {
1773
  $updraft_dir = $this->backups_dir_location();
1774
+ $disk_free_space = @disk_free_space($updraft_dir);
1775
+ if ($disk_free_space == false) return -1;
1776
  return ($disk_free_space > $space) ? true : false;
1777
  }
1778
 
1818
  }
1819
 
1820
  function wordshell_random_advert($urls) {
1821
+ if (defined('UPDRAFTPLUS_NOADS')) return "";
1822
  $rad = rand(0,8);
1823
  switch ($rad) {
1824
  case 0:
1836
  return $this->url_start($urls,'www.simbahosting.co.uk')."Need high-quality WordPress hosting from WordPress specialists? (Including automatic backups and 1-click installer). Get it from the creators of UpdraftPlus.".$this->url_end($urls,'www.simbahosting.co.uk');
1837
  break;
1838
  case 5:
1839
+ if (!defined('UPDRAFTPLUS_NOADS')) {
1840
  return $this->url_start($urls,'updraftplus.com')."Need even more features and support? Check out UpdraftPlus Premium".$this->url_end($urls,'updraftplus.com');
1841
  } else {
1842
  return "Thanks for being an UpdraftPlus premium user. Keep visiting ".$this->url_start($urls,'updraftplus.com')."updraftplus.com".$this->url_end($urls,'updraftplus.com')." to see what's going on.";
2213
  <div class="wrap">
2214
  <h1><?php echo $this->plugin_title; ?></h1>
2215
 
2216
+ Maintained by <b>David Anderson</b> (<a href="http://updraftplus.com">UpdraftPlus.Com</a> | <a href="http://david.dw-perspective.org.uk">Author Homepage</a> | <?php if (!defined('UPDRAFTPLUS_NOADS')) { ?><a href="http://wordshell.net">WordShell - WordPress command line</a> | <a href="http://david.dw-perspective.org.uk/donate">Donate</a> | <?php } ?><a href="http://wordpress.org/extend/plugins/updraftplus/faq/">FAQs</a> | <a href="http://profiles.wordpress.org/davidanderson/">My other WordPress plugins</a>). Version: <?php echo $this->version; ?>
2217
  <br>
2218
  <?php
2219
  if(isset($_GET['updraft_restore_success'])) {