WP-DB-Backup - Version 2.3.0

Version Description

  • Remove backup directory use
Download this release

Release Info

Developer filosofo
Plugin Icon 128x128 WP-DB-Backup
Version 2.3.0
Comparing to
See all releases

Code changes from version 2.2.4 to 2.3.0

Files changed (3) hide show
  1. README.markdown +15 -18
  2. readme.txt +13 -17
  3. wp-db-backup.php +26 -38
README.markdown CHANGED
@@ -5,8 +5,8 @@ Contributors: filosofo
5
  Donate link: http://austinmatzko.com/wordpress-plugins/wp-db-backup/
6
  Tags: mysql, database, backup, cron
7
  Requires at least: 2.0.3
8
- Tested up to: 3.6.1
9
- Stable tag: 2.2.4
10
 
11
  On-demand backup of your WordPress database.
12
 
@@ -20,7 +20,9 @@ Released under the terms of the GNU GPL, version 2.
20
 
21
  NO WARRANTY.
22
 
23
- Copyright (c) 2013 Austin Matzko
 
 
24
 
25
  Installation
26
  ------------
@@ -42,11 +44,6 @@ How do I restore my database from a backup?
42
 
43
  Briefly, use phpMyAdmin, which is included with most hosting control panels. More details and links to further explanations are [here](http://codex.wordpress.org/Restoring_Your_Database_From_Backup).
44
 
45
- Why can't I schedule automatic backups to be saved to my server?
46
- ----------------------------------------------------------------
47
-
48
- Although WP-DB-Backup provides the option of saving the backup file to the server, I strongly discourage anyone from leaving backed-up database files on the server. If the server is not perfectly configured, then someone could gain access to your data, and I do not want to make it easy for that to happen.
49
-
50
  My backup stops or hangs without completing.
51
  --------------------------------------------
52
 
@@ -92,7 +89,6 @@ Usage
92
  This may prevent you from emailing the backup file because it's too big.
93
 
94
  1. Select how you'd like the backup to be delivered:
95
- * Save to server : this will create a file in /wp-content/backup-*/ for you to retreive later
96
  * Download to your computer : this will send the backup file to your browser to be downloaded
97
  * Email : this will email the backup file to the address you specify
98
 
@@ -106,19 +102,20 @@ date = CCYYmmdd_B format: 20050711_039
106
  the "B" is the internet "Swatch" time.
107
  See the PHP date() function for details.
108
 
109
- When having the database backup emailed or sent to your browser for immediate download, the backup file will be _deleted_ from the server when the transfer is finished. Only if you select delivery method "Save to server" will the backup file remain on your server.
110
-
111
- *** SECURITY WARNING ***
112
- Your database backup contains sensitive information,
113
- and should not be left on the server for any extended
114
- period of time. The "Save to server" delivery method is provided
115
- as a convenience only. I will not accept any responsibility
116
- if other people obtain your backup file.
117
- *** SECURITY WARNING ***
118
 
119
  Changelog
120
  ---------
121
 
 
 
 
 
 
 
 
 
 
122
  2.2.3
123
  -----
124
  * Nonce check fix for localized WP users from Sergey Biryukov
5
  Donate link: http://austinmatzko.com/wordpress-plugins/wp-db-backup/
6
  Tags: mysql, database, backup, cron
7
  Requires at least: 2.0.3
8
+ Tested up to: 4.2.2
9
+ Stable tag: 2.3.0
10
 
11
  On-demand backup of your WordPress database.
12
 
20
 
21
  NO WARRANTY.
22
 
23
+ Copyright (c) 2015 Austin Matzko
24
+
25
+ [Source Code on GitHub](https://github.com/matzko/wp-db-backup)
26
 
27
  Installation
28
  ------------
44
 
45
  Briefly, use phpMyAdmin, which is included with most hosting control panels. More details and links to further explanations are [here](http://codex.wordpress.org/Restoring_Your_Database_From_Backup).
46
 
 
 
 
 
 
47
  My backup stops or hangs without completing.
48
  --------------------------------------------
49
 
89
  This may prevent you from emailing the backup file because it's too big.
90
 
91
  1. Select how you'd like the backup to be delivered:
 
92
  * Download to your computer : this will send the backup file to your browser to be downloaded
93
  * Email : this will email the backup file to the address you specify
94
 
102
  the "B" is the internet "Swatch" time.
103
  See the PHP date() function for details.
104
 
105
+ When having the database backup emailed or sent to your browser for immediate download, the backup file will be _deleted_ from the server when the transfer is finished.
 
 
 
 
 
 
 
 
106
 
107
  Changelog
108
  ---------
109
 
110
+ 2.3.0
111
+ -----
112
+ * Remove backup directory use
113
+
114
+ 2.2.4
115
+ -----
116
+ * Remove deprecated functionality
117
+ * Do not attempt to delete non-existent files
118
+
119
  2.2.3
120
  -----
121
  * Nonce check fix for localized WP users from Sergey Biryukov
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: filosofo
3
  Donate link: http://austinmatzko.com/wordpress-plugins/wp-db-backup/
4
  Tags: mysql, database, backup, cron
5
  Requires at least: 2.0.3
6
- Tested up to: 3.6.1
7
- Stable tag: 2.2.4
8
 
9
  On-demand backup of your WordPress database.
10
 
@@ -17,7 +17,9 @@ Released under the terms of the GNU GPL, version 2.
17
 
18
  NO WARRANTY.
19
 
20
- Copyright (c) 2013 Austin Matzko
 
 
21
 
22
  == Installation ==
23
  1. Extract the wp-db-backup/ folder file to /wp-content/plugins/
@@ -35,10 +37,6 @@ Released under the terms of the GNU GPL, version 2.
35
 
36
  Briefly, use phpMyAdmin, which is included with most hosting control panels. More details and links to further explanations are [here](http://codex.wordpress.org/Restoring_Your_Database_From_Backup).
37
 
38
- = Why can't I schedule automatic backups to be saved to my server? =
39
-
40
- Although WP-DB-Backup provides the option of saving the backup file to the server, I strongly discourage anyone from leaving backed-up database files on the server. If the server is not perfectly configured, then someone could gain access to your data, and I do not want to make it easy for that to happen.
41
-
42
  = My backup stops or hangs without completing. =
43
 
44
  If you edit the text of wp-db-backup.php in a text editor like Notepad, you’ll see around line 50 the following:
@@ -79,7 +77,6 @@ Because it's a fairly safe bet that the core WordPress files will be successfull
79
  This may prevent you from emailing the backup file because it's too big.
80
 
81
  1. Select how you'd like the backup to be delivered:
82
- * Save to server : this will create a file in /wp-content/backup-*/ for you to retreive later
83
  * Download to your computer : this will send the backup file to your browser to be downloaded
84
  * Email : this will email the backup file to the address you specify
85
 
@@ -93,18 +90,17 @@ date = CCYYmmdd_B format: 20050711_039
93
  the "B" is the internet "Swatch" time.
94
  See the PHP date() function for details.
95
 
96
- When having the database backup emailed or sent to your browser for immediate download, the backup file will be _deleted_ from the server when the transfer is finished. Only if you select delivery method "Save to server" will the backup file remain on your server.
97
-
98
- *** SECURITY WARNING ***
99
- Your database backup contains sensitive information,
100
- and should not be left on the server for any extended
101
- period of time. The "Save to server" delivery method is provided
102
- as a convenience only. I will not accept any responsibility
103
- if other people obtain your backup file.
104
- *** SECURITY WARNING ***
105
 
106
  == Changelog ==
107
 
 
 
 
 
 
 
 
108
  = 2.2.3 =
109
  * Nonce check fix for localized WP users from Sergey Biryukov
110
  * Fix for gzipped files' incorrect size.
3
  Donate link: http://austinmatzko.com/wordpress-plugins/wp-db-backup/
4
  Tags: mysql, database, backup, cron
5
  Requires at least: 2.0.3
6
+ Tested up to: 4.2.2
7
+ Stable tag: 2.3.0
8
 
9
  On-demand backup of your WordPress database.
10
 
17
 
18
  NO WARRANTY.
19
 
20
+ Copyright (c) 2015 Austin Matzko
21
+
22
+ [Source Code on GitHub](https://github.com/matzko/wp-db-backup)
23
 
24
  == Installation ==
25
  1. Extract the wp-db-backup/ folder file to /wp-content/plugins/
37
 
38
  Briefly, use phpMyAdmin, which is included with most hosting control panels. More details and links to further explanations are [here](http://codex.wordpress.org/Restoring_Your_Database_From_Backup).
39
 
 
 
 
 
40
  = My backup stops or hangs without completing. =
41
 
42
  If you edit the text of wp-db-backup.php in a text editor like Notepad, you’ll see around line 50 the following:
77
  This may prevent you from emailing the backup file because it's too big.
78
 
79
  1. Select how you'd like the backup to be delivered:
 
80
  * Download to your computer : this will send the backup file to your browser to be downloaded
81
  * Email : this will email the backup file to the address you specify
82
 
90
  the "B" is the internet "Swatch" time.
91
  See the PHP date() function for details.
92
 
93
+ When having the database backup emailed or sent to your browser for immediate download, the backup file will be _deleted_ from the server when the transfer is finished.
 
 
 
 
 
 
 
 
94
 
95
  == Changelog ==
96
 
97
+ = 2.3.0 =
98
+ * Remove backup directory use
99
+
100
+ = 2.2.4 =
101
+ * Remove deprecated functionality
102
+ * Do not attempt to delete non-existent files
103
+
104
  = 2.2.3 =
105
  * Nonce check fix for localized WP users from Sergey Biryukov
106
  * Fix for gzipped files' incorrect size.
wp-db-backup.php CHANGED
@@ -1,13 +1,13 @@
1
  <?php
2
  /*
3
  Plugin Name: WordPress Database Backup
4
- Plugin URI: http://austinmatzko.com/wordpress-plugins/wp-db-backup/
5
  Description: On-demand backup of your WordPress database. Navigate to <a href="edit.php?page=wp-db-backup">Tools &rarr; Backup</a> to get started.
6
  Author: Austin Matzko
7
  Author URI: http://austinmatzko.com/
8
- Version: 2.2.4
9
 
10
- Copyright 2013 Austin Matzko (email : austin at pressedcode.com)
11
 
12
  This program is free software; you can redistribute it and/or modify
13
  it under the terms of the GNU General Public License as published by
@@ -24,28 +24,14 @@ Copyright 2013 Austin Matzko (email : austin at pressedcode.com)
24
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
25
  */
26
 
27
- /**
28
- * Change WP_BACKUP_DIR if you want to
29
- * use a different backup location
30
- */
31
-
32
  if ( ! defined('ABSPATH') ) {
33
  die('Please do not load this file directly.');
34
  }
35
 
36
  $rand = substr( md5( md5( DB_PASSWORD ) ), -5 );
37
- global $wpdbb_content_dir, $wpdbb_content_url, $wpdbb_plugin_dir;
38
  $wpdbb_content_dir = ( defined('WP_CONTENT_DIR') ) ? WP_CONTENT_DIR : ABSPATH . 'wp-content';
39
  $wpdbb_content_url = ( defined('WP_CONTENT_URL') ) ? WP_CONTENT_URL : get_option('siteurl') . '/wp-content';
40
- $wpdbb_plugin_dir = ( defined('WP_PLUGIN_DIR') ) ? WP_PLUGIN_DIR : $wpdbb_content_dir . '/plugins';
41
-
42
- if ( ! defined('WP_BACKUP_DIR') ) {
43
- define('WP_BACKUP_DIR', $wpdbb_content_dir . '/backup-' . $rand . '/');
44
- }
45
-
46
- if ( ! defined('WP_BACKUP_URL') ) {
47
- define('WP_BACKUP_URL', $wpdbb_content_url . '/backup-' . $rand . '/');
48
- }
49
 
50
  if ( ! defined('ROWS_PER_SEGMENT') ) {
51
  define('ROWS_PER_SEGMENT', 100);
@@ -89,7 +75,7 @@ class wpdbBackup {
89
  add_action('wp_ajax_save_backup_time', array(&$this, 'save_backup_time'));
90
  add_action('init', array(&$this, 'init_textdomain'));
91
  add_action('init', array(&$this, 'set_page_url'));
92
- add_action('load-update-core.php', array(&$this, 'update_notice_action'));
93
  add_action('wp_db_backup_cron', array(&$this, 'cron_backup'));
94
  add_action('wp_cron_daily', array(&$this, 'wp_cron_daily'));
95
  add_filter('cron_schedules', array(&$this, 'add_sched_options'));
@@ -123,7 +109,7 @@ class wpdbBackup {
123
  }
124
  }
125
 
126
- $this->backup_dir = trailingslashit(apply_filters('wp_db_b_backup_dir', WP_BACKUP_DIR));
127
  $this->basename = 'wp-db-backup';
128
 
129
  $this->referer_check_key = $this->basename . '-download_' . DB_NAME;
@@ -216,20 +202,30 @@ class wpdbBackup {
216
  }
217
 
218
  /*
219
- * Add a link to back up your database when doing a core upgrade
220
  */
221
  function update_notice_action() {
222
- if ( 'upgrade-core' == $_REQUEST['action'] ) :
 
 
 
 
 
 
 
 
 
223
  ob_start(array(&$this, 'update_notice'));
224
  add_action('admin_footer', create_function('', 'ob_end_flush();'));
225
  endif;
226
  }
227
- function update_notice($text = '') {
228
- $pattern = '#(<a href\="' . __('http://codex.wordpress.org/WordPress_Backups') . '">.*?</p>)#';
229
- $replace = '$1' . "\n<p>" . sprintf(__('Click <a href="%s" target="_blank">here</a> to back up your database using the WordPress Database Backup plugin. <strong>Note:</strong> WordPress Database Backup does <em>not</em> back up your files, just your database.', 'wp-db-backup'), 'tools.php?page=wp-db-backup') . "</p>\n";
230
- $text = preg_replace($pattern, $replace, $text);
231
- return $text;
232
- }
 
233
 
234
  function build_backup_script() {
235
  global $table_prefix, $wpdb;
@@ -271,7 +267,7 @@ class wpdbBackup {
271
 
272
  function backup(table, segment) {
273
  var fram = document.getElementById("backuploader");
274
- fram.src = "' . $this->page_url . '&fragment=" + table + ":" + segment + ":' . $this->backup_filename . ':";
275
  }
276
 
277
  var curStep = 0;
@@ -1148,7 +1144,7 @@ class wpdbBackup {
1148
  $file = $this->backup_file;
1149
  switch($_POST['deliver']) {
1150
  case 'http':
1151
- $feedback .= '<br />' . sprintf(__('Your backup file: <a href="%1s">%2s</a> should begin downloading shortly.','wp-db-backup'), WP_BACKUP_URL . "{$this->backup_file}", $this->backup_file);
1152
  break;
1153
  case 'smtp':
1154
  if (! is_email($_POST['backup_recipient'])) {
@@ -1158,9 +1154,6 @@ class wpdbBackup {
1158
  }
1159
  $feedback = '<br />' . sprintf(__('Your backup has been emailed to %s','wp-db-backup'), $feedback);
1160
  break;
1161
- case 'none':
1162
- $feedback .= '<br />' . __('Your backup file has been saved on the server. If you would like to download it now, right click and select "Save As"','wp-db-backup');
1163
- $feedback .= ':<br /> <a href="' . WP_BACKUP_URL . "$file\">$file</a> : " . sprintf(__('%s bytes','wp-db-backup'), filesize($this->backup_dir . $file));
1164
  }
1165
  $feedback .= '</p></div>';
1166
  }
@@ -1295,11 +1288,6 @@ class wpdbBackup {
1295
  <legend><?php _e('Backup Options','wp-db-backup'); ?></legend>
1296
  <p><?php _e('What to do with the backup file:','wp-db-backup'); ?></p>
1297
  <ul>
1298
- <li><label for="do_save">
1299
- <input type="radio" id="do_save" name="deliver" value="none" style="border:none;" />
1300
- <?php _e('Save to server','wp-db-backup');
1301
- echo " (<code>" . $this->backup_dir . "</code>)"; ?>
1302
- </label></li>
1303
  <li><label for="do_download">
1304
  <input type="radio" checked="checked" id="do_download" name="deliver" value="http" style="border:none;" />
1305
  <?php _e('Download to your computer','wp-db-backup'); ?>
1
  <?php
2
  /*
3
  Plugin Name: WordPress Database Backup
4
+ Plugin URI: https://github.com/matzko/wp-db-backup
5
  Description: On-demand backup of your WordPress database. Navigate to <a href="edit.php?page=wp-db-backup">Tools &rarr; Backup</a> to get started.
6
  Author: Austin Matzko
7
  Author URI: http://austinmatzko.com/
8
+ Version: 2.3.0
9
 
10
+ Copyright 2015 Austin Matzko (email : austin at pressedcode.com)
11
 
12
  This program is free software; you can redistribute it and/or modify
13
  it under the terms of the GNU General Public License as published by
24
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
25
  */
26
 
 
 
 
 
 
27
  if ( ! defined('ABSPATH') ) {
28
  die('Please do not load this file directly.');
29
  }
30
 
31
  $rand = substr( md5( md5( DB_PASSWORD ) ), -5 );
32
+ global $wpdbb_content_dir, $wpdbb_content_url;
33
  $wpdbb_content_dir = ( defined('WP_CONTENT_DIR') ) ? WP_CONTENT_DIR : ABSPATH . 'wp-content';
34
  $wpdbb_content_url = ( defined('WP_CONTENT_URL') ) ? WP_CONTENT_URL : get_option('siteurl') . '/wp-content';
 
 
 
 
 
 
 
 
 
35
 
36
  if ( ! defined('ROWS_PER_SEGMENT') ) {
37
  define('ROWS_PER_SEGMENT', 100);
75
  add_action('wp_ajax_save_backup_time', array(&$this, 'save_backup_time'));
76
  add_action('init', array(&$this, 'init_textdomain'));
77
  add_action('init', array(&$this, 'set_page_url'));
78
+ add_action('admin_init', array(&$this, 'update_notice_action'));
79
  add_action('wp_db_backup_cron', array(&$this, 'cron_backup'));
80
  add_action('wp_cron_daily', array(&$this, 'wp_cron_daily'));
81
  add_filter('cron_schedules', array(&$this, 'add_sched_options'));
109
  }
110
  }
111
 
112
+ $this->backup_dir = trailingslashit(apply_filters('wp_db_b_backup_dir', (isset($_GET['wp_db_temp_dir']) && is_writable($_GET['wp_db_temp_dir'])) ? $_GET['wp_db_temp_dir'] : get_temp_dir()));
113
  $this->basename = 'wp-db-backup';
114
 
115
  $this->referer_check_key = $this->basename . '-download_' . DB_NAME;
202
  }
203
 
204
  /*
205
+ * Add a link to back up your database when doing a core upgrade.
206
  */
207
  function update_notice_action() {
208
+ global $pagenow;
209
+ if (
210
+ (
211
+ isset($_REQUEST['action'])
212
+ && ('upgrade-core' == $_REQUEST['action'])
213
+ )
214
+ || (
215
+ !empty($pagenow) && ('update-core.php' == $pagenow)
216
+ )
217
+ ) :
218
  ob_start(array(&$this, 'update_notice'));
219
  add_action('admin_footer', create_function('', 'ob_end_flush();'));
220
  endif;
221
  }
222
+
223
+ function update_notice($text = '') {
224
+ $pattern = '#(<a href\="' . __('http://codex.wordpress.org/WordPress_Backups') . '">.*?</p>)#';
225
+ $replace = '$1' . "\n<p>" . sprintf(__('Click <a href="%s" target="_blank">here</a> to back up your database using the WordPress Database Backup plugin. <strong>Note:</strong> WordPress Database Backup does <em>not</em> back up your files, just your database.', 'wp-db-backup'), 'tools.php?page=wp-db-backup') . "</p>\n";
226
+ $text = preg_replace($pattern, $replace, $text);
227
+ return $text;
228
+ }
229
 
230
  function build_backup_script() {
231
  global $table_prefix, $wpdb;
267
 
268
  function backup(table, segment) {
269
  var fram = document.getElementById("backuploader");
270
+ fram.src = "' . $this->page_url . '&fragment=" + table + ":" + segment + ":' . $this->backup_filename . ':&wp_db_temp_dir=' . $this->backup_dir . '";
271
  }
272
 
273
  var curStep = 0;
1144
  $file = $this->backup_file;
1145
  switch($_POST['deliver']) {
1146
  case 'http':
1147
+ $feedback .= '<br />' . sprintf(__('Your backup file: %2s should begin downloading shortly.','wp-db-backup'), "{$this->backup_file}", $this->backup_file);
1148
  break;
1149
  case 'smtp':
1150
  if (! is_email($_POST['backup_recipient'])) {
1154
  }
1155
  $feedback = '<br />' . sprintf(__('Your backup has been emailed to %s','wp-db-backup'), $feedback);
1156
  break;
 
 
 
1157
  }
1158
  $feedback .= '</p></div>';
1159
  }
1288
  <legend><?php _e('Backup Options','wp-db-backup'); ?></legend>
1289
  <p><?php _e('What to do with the backup file:','wp-db-backup'); ?></p>
1290
  <ul>
 
 
 
 
 
1291
  <li><label for="do_download">
1292
  <input type="radio" checked="checked" id="do_download" name="deliver" value="http" style="border:none;" />
1293
  <?php _e('Download to your computer','wp-db-backup'); ?>