UpdraftPlus WordPress Backup Plugin - Version 1.2.33

Version Description

  • 01/17/2013 =
  • New button to delete all existing settings
Download this release

Release Info

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

Code changes from version 1.2.31 to 1.2.33

Files changed (4) hide show
  1. methods/ftp.php +2 -1
  2. methods/s3.php +2 -1
  3. readme.txt +4 -2
  4. updraftplus.php +52 -28
methods/ftp.php CHANGED
@@ -79,7 +79,8 @@ class UpdraftPlus_BackupModule_ftp {
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(),
79
  ?>
80
  jQuery('#updraft-ftp-test').click(function(){
81
  var data = {
82
+ action: 'updraft_ajax',
83
+ subaction: 'credentials_test',
84
  method: 'ftp',
85
  nonce: '<?php echo wp_create_nonce('updraftplus-credentialtest-nonce'); ?>',
86
  server: jQuery('#updraft_server_address').val(),
methods/s3.php CHANGED
@@ -160,7 +160,8 @@ class UpdraftPlus_BackupModule_s3 {
160
  ?>
161
  jQuery('#updraft-s3-test').click(function(){
162
  var data = {
163
- action: 'updraft_credentials_test',
 
164
  method: 's3',
165
  nonce: '<?php echo wp_create_nonce('updraftplus-credentialtest-nonce'); ?>',
166
  apikey: jQuery('#updraft_s3_apikey').val(),
160
  ?>
161
  jQuery('#updraft-s3-test').click(function(){
162
  var data = {
163
+ action: 'updraft_ajax',
164
+ subaction: 'credentials_test',
165
  method: 's3',
166
  nonce: '<?php echo wp_create_nonce('updraftplus-credentialtest-nonce'); ?>',
167
  apikey: jQuery('#updraft_s3_apikey').val(),
readme.txt CHANGED
@@ -3,12 +3,12 @@ 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.31
7
  Donate link: http://david.dw-perspective.org.uk/donate
8
  License: GPLv3 or later
9
 
10
  == Upgrade Notice ==
11
- Complete DropBox support. FTP over SSL. Less noise.
12
 
13
  == Description ==
14
 
@@ -119,6 +119,8 @@ Yes; especially before you submit any support requests.
119
  Thanks for asking - yes, I have. Check out my profile page - http://profiles.wordpress.org/DavidAnderson/ . I am also available for hire for bespoke work.
120
 
121
  == Changelog ==
 
 
122
 
123
  = 1.2.31 - 01/15/2013 =
124
  * Fixed bug with DropBox deletions
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.33
7
  Donate link: http://david.dw-perspective.org.uk/donate
8
  License: GPLv3 or later
9
 
10
  == Upgrade Notice ==
11
+ Complete DropBox support. FTP over SSL. Less noise. Option to delete all settings.
12
 
13
  == Description ==
14
 
119
  Thanks for asking - yes, I have. Check out my profile page - http://profiles.wordpress.org/DavidAnderson/ . I am also available for hire for bespoke work.
120
 
121
  == Changelog ==
122
+ = 1.2.33 - 01/17/2013 =
123
+ * New button to delete all existing settings
124
 
125
  = 1.2.31 - 01/15/2013 =
126
  * Fixed bug with DropBox deletions
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 restore: your content and database 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.31
8
  Donate link: http://david.dw-perspective.org.uk/donate
9
  License: GPLv3 or later
10
  Author URI: http://wordshell.net
@@ -64,7 +64,7 @@ define('UPDRAFT_DEFAULT_OTHERS_EXCLUDE','upgrade,cache,updraft,index.php');
64
 
65
  class UpdraftPlus {
66
 
67
- var $version = '1.2.31';
68
 
69
  // Choices will be shown in the admin menu in the order used here
70
  var $backup_methods = array (
@@ -99,7 +99,7 @@ class UpdraftPlus {
99
  add_action('updraft_backup_resume', array($this,'backup_resume'));
100
  add_action('wp_enqueue_scripts', array($this, 'ajax_enqueue') );
101
  add_action('wp_ajax_updraft_download_backup', array($this, 'updraft_download_backup'));
102
- add_action('wp_ajax_updraft_credentials_test', array($this, 'updraft_credentials_test'));
103
  # http://codex.wordpress.org/Plugin_API/Filter_Reference/cron_schedules
104
  add_filter('cron_schedules', array($this,'modify_cron_schedules'));
105
  add_filter('plugin_action_links', array($this, 'plugin_action_links'), 10, 2);
@@ -1182,18 +1182,21 @@ class UpdraftPlus {
1182
  }
1183
 
1184
  // Called via AJAX
1185
- function updraft_credentials_test() {
1186
  // Test the nonce (probably not needed, since we're presumably admin-authed, but there's no harm)
1187
  $nonce = (empty($_POST['nonce'])) ? "" : $_POST['nonce'];
1188
- if (! wp_verify_nonce($nonce, 'updraftplus-credentialtest-nonce') ) die('Security check');
1189
 
1190
- $method = (preg_match("/^[a-z0-9]+$/", $_POST['method'])) ? $_POST['method'] : "";
 
1191
 
1192
- // Test the credentials, return a code
1193
- require_once(UPDRAFTPLUS_DIR."/methods/$method.php");
 
 
 
 
1194
 
1195
- $objname = "UpdraftPlus_BackupModule_${method}";
1196
- if (method_exists($objname, "credentials_test")) call_user_func(array('UpdraftPlus_BackupModule_'.$method, 'credentials_test'));
1197
  die;
1198
 
1199
  }
@@ -1410,13 +1413,7 @@ class UpdraftPlus {
1410
  return (ini_get('max_execution_time') >= $time)?true:false;
1411
  }
1412
 
1413
- function admin_init() {
1414
- if(get_option('updraft_debug_mode')) {
1415
- ini_set('display_errors',1);
1416
- error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED);
1417
- ini_set('track_errors',1);
1418
- }
1419
- wp_enqueue_script('jquery');
1420
  register_setting( 'updraft-options-group', 'updraft_interval', array($this,'schedule_backup') );
1421
  register_setting( 'updraft-options-group', 'updraft_interval_database', array($this,'schedule_backup_database') );
1422
  register_setting( 'updraft-options-group', 'updraft_retain', array($this,'retain_range') );
@@ -1447,6 +1444,17 @@ class UpdraftPlus {
1447
  register_setting( 'updraft-options-group', 'updraft_include_uploads', 'absint' );
1448
  register_setting( 'updraft-options-group', 'updraft_include_others', 'absint' );
1449
  register_setting( 'updraft-options-group', 'updraft_include_others_exclude', 'wp_filter_nohtml_kses' );
 
 
 
 
 
 
 
 
 
 
 
1450
 
1451
  if (current_user_can('manage_options') && get_option('updraft_service') == "googledrive" && get_option('updraft_googledrive_clientid') != "" && get_option('updraft_googledrive_token','xyz') == 'xyz') {
1452
  add_action('admin_notices', array($this,'show_admin_warning_googledrive') );
@@ -1458,8 +1466,8 @@ class UpdraftPlus {
1458
  }
1459
 
1460
  function ajax_enqueue() {
1461
- wp_enqueue_script('updraftplus-ajax', plugins_url('/includes/ajax.js', __FILE__) );
1462
- wp_localize_script('updraftplus-ajax', 'updraft_credentials_test', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ) ) );
1463
  }
1464
 
1465
  function add_admin_pages() {
@@ -1564,9 +1572,15 @@ class UpdraftPlus {
1564
  echo '</div>';
1565
  }
1566
 
1567
- if(isset($_POST['action']) && $_POST['action'] == 'updraft_backup_debug_all') $this->backup(true,true);
1568
-
1569
- if(isset($_POST['action']) && $_POST['action'] == 'updraft_backup_debug_db') $this->backup_db();
 
 
 
 
 
 
1570
 
1571
  ?>
1572
  <div class="wrap">
@@ -1952,7 +1966,8 @@ echo $delete_local; ?> /> <br>Check this to delete the local backup file (only s
1952
  ?>
1953
  <div style="padding-top: 40px;">
1954
  <hr>
1955
- <h3>Debug Information</h3>
 
1956
  <?php
1957
  $peak_memory_usage = memory_get_peak_usage(true)/1024/1024;
1958
  $memory_usage = memory_get_usage(true)/1024/1024;
@@ -1960,13 +1975,22 @@ echo $delete_local; ?> /> <br>Check this to delete the local backup file (only s
1960
  echo 'Current memory usage: '.$memory_usage.' MB<br/>';
1961
  echo 'PHP memory limit: '.ini_get('memory_limit').' <br/>';
1962
  ?>
1963
- <form method="post" action="">
 
 
 
1964
  <input type="hidden" name="action" value="updraft_backup_debug_all" />
1965
- <p><input type="submit" class="button-primary" <?php echo $backup_disabled ?> value="Debug Backup" onclick="return(confirm('This will cause an immediate backup. The page will stall loading until it finishes (ie, unscheduled). Use this if you\'re trying to see peak memory usage.'))" /></p>
1966
  </form>
1967
- <form method="post" action="">
1968
  <input type="hidden" name="action" value="updraft_backup_debug_db" />
1969
- <p><input type="submit" class="button-primary" <?php echo $backup_disabled ?> value="Debug DB Backup" onclick="return(confirm('This will cause an immediate DB backup. The page will stall loading until it finishes (ie, unscheduled). The backup will remain locally despite your prefs and will not go into the backup history or up into the cloud.'))" /></p>
 
 
 
 
 
 
1970
  </form>
1971
  </div>
1972
  <?php } ?>
2
  /*
3
  Plugin Name: UpdraftPlus - Backup/Restore
4
  Plugin URI: http://wordpress.org/extend/plugins/updraftplus
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.2.33
8
  Donate link: http://david.dw-perspective.org.uk/donate
9
  License: GPLv3 or later
10
  Author URI: http://wordshell.net
64
 
65
  class UpdraftPlus {
66
 
67
+ var $version = '1.2.33';
68
 
69
  // Choices will be shown in the admin menu in the order used here
70
  var $backup_methods = array (
99
  add_action('updraft_backup_resume', array($this,'backup_resume'));
100
  add_action('wp_enqueue_scripts', array($this, 'ajax_enqueue') );
101
  add_action('wp_ajax_updraft_download_backup', array($this, 'updraft_download_backup'));
102
+ add_action('wp_ajax_updraft_ajax', array($this, 'updraft_ajax_handler'));
103
  # http://codex.wordpress.org/Plugin_API/Filter_Reference/cron_schedules
104
  add_filter('cron_schedules', array($this,'modify_cron_schedules'));
105
  add_filter('plugin_action_links', array($this, 'plugin_action_links'), 10, 2);
1182
  }
1183
 
1184
  // Called via AJAX
1185
+ function updraft_ajax_handler() {
1186
  // Test the nonce (probably not needed, since we're presumably admin-authed, but there's no harm)
1187
  $nonce = (empty($_POST['nonce'])) ? "" : $_POST['nonce'];
1188
+ if (! wp_verify_nonce($nonce, 'updraftplus-credentialtest-nonce') || empty($_POST['subaction'])) die('Security check');
1189
 
1190
+ if ($_POST['subaction'] == 'credentials_test') {
1191
+ $method = (preg_match("/^[a-z0-9]+$/", $_POST['method'])) ? $_POST['method'] : "";
1192
 
1193
+ // Test the credentials, return a code
1194
+ require_once(UPDRAFTPLUS_DIR."/methods/$method.php");
1195
+
1196
+ $objname = "UpdraftPlus_BackupModule_${method}";
1197
+ if (method_exists($objname, "credentials_test")) call_user_func(array('UpdraftPlus_BackupModule_'.$method, 'credentials_test'));
1198
+ }
1199
 
 
 
1200
  die;
1201
 
1202
  }
1413
  return (ini_get('max_execution_time') >= $time)?true:false;
1414
  }
1415
 
1416
+ function register_settings() {
 
 
 
 
 
 
1417
  register_setting( 'updraft-options-group', 'updraft_interval', array($this,'schedule_backup') );
1418
  register_setting( 'updraft-options-group', 'updraft_interval_database', array($this,'schedule_backup_database') );
1419
  register_setting( 'updraft-options-group', 'updraft_retain', array($this,'retain_range') );
1444
  register_setting( 'updraft-options-group', 'updraft_include_uploads', 'absint' );
1445
  register_setting( 'updraft-options-group', 'updraft_include_others', 'absint' );
1446
  register_setting( 'updraft-options-group', 'updraft_include_others_exclude', 'wp_filter_nohtml_kses' );
1447
+ }
1448
+
1449
+ function admin_init() {
1450
+ if(get_option('updraft_debug_mode')) {
1451
+ ini_set('display_errors',1);
1452
+ error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED);
1453
+ ini_set('track_errors',1);
1454
+ }
1455
+ wp_enqueue_script('jquery');
1456
+
1457
+ $this->register_settings();
1458
 
1459
  if (current_user_can('manage_options') && get_option('updraft_service') == "googledrive" && get_option('updraft_googledrive_clientid') != "" && get_option('updraft_googledrive_token','xyz') == 'xyz') {
1460
  add_action('admin_notices', array($this,'show_admin_warning_googledrive') );
1466
  }
1467
 
1468
  function ajax_enqueue() {
1469
+ // wp_enqueue_script('updraftplus-ajax', plugins_url('/includes/ajax.js', __FILE__) );
1470
+ // wp_localize_script('updraftplus-ajax', 'updraft_credentials_test', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ) ) );
1471
  }
1472
 
1473
  function add_admin_pages() {
1572
  echo '</div>';
1573
  }
1574
 
1575
+ if(isset($_POST['action']) && $_POST['action'] == 'updraft_backup_debug_all') { $this->backup(true,true); }
1576
+ elseif (isset($_POST['action']) && $_POST['action'] == 'updraft_backup_debug_db') { $this->backup_db(); }
1577
+ elseif (isset($_POST['action']) && $_POST['action'] == 'updraft_wipesettings') {
1578
+ $settings = array('updraft_interval', 'updraft_interval_database', 'updraft_retain', 'updraft_encryptionphrase', 'updraft_service', 'updraft_s3_login', 'updraft_s3_pass', 'updraft_s3_remote_path', 'updraft_dropbox_appkey', 'updraft_dropbox_secret', 'updraft_dropbox_folder', 'updraft_googledrive_clientid', 'updraft_googledrive_secret', 'updraft_googledrive_remotepath', 'updraft_ftp_login', 'updraft_ftp_pass', 'updraft_ftp_remote_path', 'updraft_server_address', 'updraft_dir', 'updraft_email', 'updraft_delete_local', 'updraft_debug_mode', 'updraft_include_plugins', 'updraft_include_themes', 'updraft_include_uploads', 'updraft_include_others', 'updraft_include_others_exclude');
1579
+ foreach ($settings as $s) {
1580
+ delete_option($s);
1581
+ }
1582
+ $this->show_admin_warning("Your settings have been wiped.");
1583
+ }
1584
 
1585
  ?>
1586
  <div class="wrap">
1966
  ?>
1967
  <div style="padding-top: 40px;">
1968
  <hr>
1969
+ <h3>Debug Information And Expert Options</h3>
1970
+ <p>
1971
  <?php
1972
  $peak_memory_usage = memory_get_peak_usage(true)/1024/1024;
1973
  $memory_usage = memory_get_usage(true)/1024/1024;
1975
  echo 'Current memory usage: '.$memory_usage.' MB<br/>';
1976
  echo 'PHP memory limit: '.ini_get('memory_limit').' <br/>';
1977
  ?>
1978
+ </p>
1979
+ <p style="max-width: 600px;">The buttons below will immediately execute a backup run, independently of WordPress's scheduler. If these work whilst your scheduled backups and the &quot;Backup Now&quot; button do absolutely nothing (i.e. not even produce a log file), then it means that your scheduler is broken. You should then disable all your other plugins, and try the &quot; Backup Now&quot; button. If that fails, then contact your web hosting company and ask them if they have disable wp-cron. If it succeeds, then re-activate your other plugins one-by-one, and find the one that is the problem and report a bug to them.</p>
1980
+
1981
+ <form method="post">
1982
  <input type="hidden" name="action" value="updraft_backup_debug_all" />
1983
+ <p><input type="submit" class="button-primary" <?php echo $backup_disabled ?> value="Debug Full Backup" onclick="return(confirm('This will cause an immediate backup. The page will stall loading until it finishes (ie, unscheduled).'))" /></p>
1984
  </form>
1985
+ <form method="post">
1986
  <input type="hidden" name="action" value="updraft_backup_debug_db" />
1987
+ <p><input type="submit" class="button-primary" <?php echo $backup_disabled ?> value="Debug DB Backup" onclick="return(confirm('This will cause an immediate DB backup. The page will stall loading until it finishes (ie, unscheduled). The backup may well run out of time; really this button is only helpful for checking that the backup is able to get through the initial stages, or for small WordPress sites.'))" /></p>
1988
+ </form>
1989
+ <h3>Wipe Settings</h3>
1990
+ <p style="max-width: 600px;">This button will delete all UpdraftPlus settings (but not any of your existing backups from your cloud storage). You will then need to enter all your settings again. You can also do this before deactivating/deinstalling UpdraftPlus if you wish.</p>
1991
+ <form method="post">
1992
+ <input type="hidden" name="action" value="updraft_wipesettings" />
1993
+ <p><input type="submit" class="button-primary" value="Wipe All Settings" onclick="return(confirm('This will delete all your UpdraftPlus settings - are you sure you want to do this?'))" /></p>
1994
  </form>
1995
  </div>
1996
  <?php } ?>