BackUpWordPress - Version 3.0.1

Version Description

  • This is a critical update. Fixes a bug in the core backup library. Please update immediately.
Download this release

Release Info

Developer pauldewouters
Plugin Icon 128x128 BackUpWordPress
Version 3.0.1
Comparing to
See all releases

Code changes from version 3.0 to 3.0.1

History.md ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ n.n.n / 2014-11-20
3
+ ==================
4
+
5
+ * remove uneeded images
6
+ * latest hm-backup
7
+ * latest hm-backup
8
+ * Typos in v 3.0 changelog
9
+ * Specify POT filename in grunt task
10
+ * Update POT file
11
+ * Markdown readme
12
+ * Regenerate readme
13
+ * Add plugin headers
14
+ * Merge branch 'master' of github.com:humanmade/backupwordpress
15
+ * Refactor the recursive filesize scanner
16
+ * correct text domain
17
+ * Merge pull request #556 from humanmade/issue-556
18
+ * Merge pull request #580 from humanmade/issue-580
19
+ * Merge pull request #584 from humanmade/update-backdrop
20
+ * Remove unneede statements
21
+ * reload the excludes filelist in the correct place when someone excludes a file
22
+ * Latest backdrop
23
+ * Regenerate minified CSS
24
+ * Regenerate minified JS
25
+ * Fix cancel backup action
26
+ * WordPress Coding Standards
27
+ * Exit early if incompatible version of WordPress
28
+ * Update translations
29
+ * Update changelog
30
+ * Merge pull request #573 from humanmade/design
31
+ * Load minified CSS
32
+ * Formatting
33
+ * Biweekly wording
34
+ * Add missing period
35
+ * use nonce_url instead of manually adding the nonce query param
36
+ * close the settings form when done
37
+ * Design changes as per ticket
38
+ * Start tracking langauge in server info
39
+ * Right align the primary button in the enable support modal
40
+ * Re-factor the directory filesize code to use a single array instead of thoussands of transients
41
+ * Remove the warning that would show if you were using anything other than the latest stable, it's no longer needed now that the FAQ is local
42
+ * switch to using a single transient to store directory filesize data
43
+ * Merge pull request #552 from humanmade/issue-552
44
+ * Merge pull request #562 from humanmade/enhancement/issue-562
45
+ * Add an anchor link
46
+ * Add error message
47
+ * Rename function
48
+ * Prefix GET params
49
+ * Update exclude rule action
50
+ * Adds function for building admin action urls
51
+ * fix vertical scroll
52
+ * Adds some functions to manage settings form submission errors
53
+ * Rename nonce and action
54
+ * fetch errors to display
55
+ * Form submission handling for BWP and add-ons settings
56
+ * Use a new function that persists form submission errors to a transient
57
+ * None check
58
+ * Pass the nonce around in the ajax request
59
+ * Enable support action links
60
+ * Check nonces
61
+ * Modify action URLs to use the admin_post hook
62
+ * Remove unneeded code
63
+ * New line at end
64
+ * Use admin_post hook
65
+ * Merge pull request #502 from humanmade/stream-integration
66
+ * Merge pull request #554 from humanmade/fix-display-schedule-time
67
+ * Display schedule start time in local timezone
68
+ * Add an action hook that gives access to consumers to the backup progress
admin/schedule-form-excludes.php CHANGED
@@ -45,7 +45,7 @@
45
 
46
  <?php else : ?>
47
 
48
- <a href="<?php echo hmbkp_admin_action_url( 'remove_exclude_rule', array( 'hmbkp_remove_exclude' => $exclude, 'hmbkp_schedule_id' => $schedule->get_id() ) ); ?>" class="delete-action"><?php _e( 'Remove', 'hmbkp' ); ?></a>
49
 
50
  <?php endif; ?>
51
 
45
 
46
  <?php else : ?>
47
 
48
+ <a href="<?php echo hmbkp_admin_action_url( 'remove_exclude_rule', array( 'hmbkp_remove_exclude' => $exclude, 'hmbkp_schedule_id' => $schedule->get_id() ) ); ?>" class="delete-action"><?php _e( 'Stop excluding', 'hmbkp' ); ?></a>
49
 
50
  <?php endif; ?>
51
 
assets/d-azure-alt.png DELETED
Binary file
assets/d-azure.png DELETED
Binary file
assets/d-dream-alt.png DELETED
Binary file
assets/d-dream.png DELETED
Binary file
assets/d-drive-alt.png DELETED
Binary file
assets/d-drive.png DELETED
Binary file
assets/d-dropbox-alt.png DELETED
Binary file
assets/d-dropbox.png DELETED
Binary file
assets/d-ftp-alt.png DELETED
Binary file
assets/d-ftp.png DELETED
Binary file
assets/d-rack-alt.png DELETED
Binary file
assets/d-rack.png DELETED
Binary file
assets/d-s3-alt.png DELETED
Binary file
assets/d-s3.png DELETED
Binary file
assets/hmbkp.js CHANGED
@@ -61,8 +61,9 @@ jQuery( document ).ready( function( $ ) {
61
  }
62
 
63
  // Fail silently for now
64
- else
65
  $( '.calculating' ).remove();
 
66
 
67
  }
68
  ).error( function() {
@@ -173,8 +174,9 @@ function hmbkpToggleScheduleFields( recurrence ){
173
  function hmbkpCatchResponseAndOfferToEmail( data ) {
174
 
175
  // Backup Succeeded
176
- if ( ! data || data == 0 )
177
  location.reload( true );
 
178
 
179
  // The backup failed, show the error and offer to have it emailed back
180
  else {
@@ -189,18 +191,6 @@ function hmbkpCatchResponseAndOfferToEmail( data ) {
189
  if ( ! data || data == 0 )
190
  return;
191
 
192
- // jQuery.colorbox( {
193
- // 'innerWidth' : "320px",
194
- // 'maxHeight' : "100%",
195
- // 'html' : data,
196
- // 'overlayClose' : false,
197
- // 'escKey' : false,
198
- // 'onLoad' : function() {
199
- // jQuery( '#cboxClose' ).remove();
200
- // jQuery.colorbox.resize();
201
- // }
202
- // } );
203
-
204
  }
205
  );
206
 
61
  }
62
 
63
  // Fail silently for now
64
+ else {
65
  $( '.calculating' ).remove();
66
+ }
67
 
68
  }
69
  ).error( function() {
174
  function hmbkpCatchResponseAndOfferToEmail( data ) {
175
 
176
  // Backup Succeeded
177
+ if ( ! data || data == 0 ) {
178
  location.reload( true );
179
+ }
180
 
181
  // The backup failed, show the error and offer to have it emailed back
182
  else {
191
  if ( ! data || data == 0 )
192
  return;
193
 
 
 
 
 
 
 
 
 
 
 
 
 
194
  }
195
  );
196
 
backupwordpress.php CHANGED
@@ -5,7 +5,7 @@ Plugin Name: BackUpWordPress
5
  Plugin URI: http://bwp.hmn.md/
6
  Description: Simple automated backups of your WordPress powered website. Once activated you'll find me under <strong>Tools &rarr; Backups</strong>.
7
  Author: Human Made Limited
8
- Version: 3.0
9
  Author URI: http://hmn.md/
10
  License: GPL-2.0+
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.txt
5
  Plugin URI: http://bwp.hmn.md/
6
  Description: Simple automated backups of your WordPress powered website. Once activated you'll find me under <strong>Tools &rarr; Backups</strong>.
7
  Author: Human Made Limited
8
+ Version: 3.0.1
9
  Author URI: http://hmn.md/
10
  License: GPL-2.0+
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.txt
hm-backup/hm-backup.php CHANGED
@@ -94,6 +94,14 @@ class HM_Backup {
94
  */
95
  private $unreadable_files = array();
96
 
 
 
 
 
 
 
 
 
97
  /**
98
  * Contains an array of errors
99
  *
@@ -132,26 +140,6 @@ class HM_Backup {
132
  */
133
  protected $archive_verified = false;
134
 
135
- /**
136
- * @var array
137
- */
138
- protected $included_files = array();
139
-
140
- /**
141
- * @var int
142
- */
143
- protected $included_file_count = 0;
144
-
145
- /**
146
- * @var int
147
- */
148
- protected $excluded_file_count = 0;
149
-
150
- /**
151
- * @var int
152
- */
153
- protected $get_unreadable_file_count = 0;
154
-
155
  /**
156
  * Check whether safe mode is active or not
157
  *
@@ -208,14 +196,10 @@ class HM_Backup {
208
 
209
  $home_path = ABSPATH;
210
 
211
- // Attempt to guess the home path based on the location of wp-config.php
212
- if ( ! file_exists( ABSPATH . 'wp-config.php' ) ) {
213
- $home_path = trailingslashit( dirname( ABSPATH ) );
214
- }
215
-
216
  // If site_url contains home_url and they differ then assume WordPress is installed in a sub directory
217
- if ( $home_url !== $site_url && strpos( $site_url, $home_url ) === 0 )
218
  $home_path = trailingslashit( substr( self::conform_dir( ABSPATH ), 0, strrpos( self::conform_dir( ABSPATH ), str_replace( $home_url, '', $site_url ) ) ) );
 
219
 
220
  return self::conform_dir( $home_path );
221
 
@@ -261,7 +245,7 @@ class HM_Backup {
261
  @set_time_limit( 0 );
262
 
263
  // Set a custom error handler so we can track errors
264
- set_error_handler( array( &$this, 'error_handler' ) );
265
 
266
  }
267
 
@@ -1041,6 +1025,103 @@ class HM_Backup {
1041
 
1042
  }
1043
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1044
  private function load_pclzip() {
1045
 
1046
  // Load PclZip
@@ -1062,12 +1143,14 @@ class HM_Backup {
1062
 
1063
  $excludes = array();
1064
 
1065
- if ( isset( $this->excludes ) )
1066
  $excludes = $this->excludes;
 
1067
 
1068
  // If path() is inside root(), exclude it
1069
- if ( strpos( $this->get_path(), $this->get_root() ) !== false )
1070
  array_unshift( $excludes, trailingslashit( $this->get_path() ) );
 
1071
 
1072
  return array_unique( $excludes );
1073
 
@@ -1081,11 +1164,13 @@ class HM_Backup {
1081
  */
1082
  public function set_excludes( $excludes, $append = false ) {
1083
 
1084
- if ( is_string( $excludes ) )
1085
  $excludes = explode( ',', $excludes );
 
1086
 
1087
- if ( $append )
1088
  $excludes = array_merge( $this->excludes, $excludes );
 
1089
 
1090
  $this->excludes = array_filter( array_unique( array_map( 'trim', $excludes ) ) );
1091
 
@@ -1126,53 +1211,66 @@ class HM_Backup {
1126
  $file = $absolute = $fragment = false;
1127
 
1128
  // Files don't end with /
1129
- if ( ! in_array( substr( $rule, - 1 ), array( '\\', '/' ) ) )
1130
  $file = true;
 
1131
 
1132
  // If rule starts with a / then treat as absolute path
1133
- elseif ( in_array( substr( $rule, 0, 1 ), array( '\\', '/' ) ) )
1134
  $absolute = true;
 
1135
 
1136
  // Otherwise treat as dir fragment
1137
- else
1138
  $fragment = true;
 
1139
 
1140
  // Strip $this->root and conform
1141
  $rule = str_ireplace( $this->get_root(), '', untrailingslashit( self::conform_dir( $rule ) ) );
1142
 
 
1143
  // Strip the preceeding slash
1144
- if ( in_array( substr( $rule, 0, 1 ), array( '\\', '/' ) ) )
1145
  $rule = substr( $rule, 1 );
 
1146
 
1147
  // Escape string for regex
1148
- if ( $context === 'regex' )
1149
  $rule = str_replace( '.', '\.', $rule );
 
1150
 
1151
  // Convert any existing wildcards
1152
- if ( $wildcard !== '*' && strpos( $rule, '*' ) !== false )
1153
  $rule = str_replace( '*', $wildcard, $rule );
 
1154
 
1155
  // Wrap directory fragments and files in wildcards for zip
1156
- if ( $context === 'zip' && ( $fragment || $file ) )
1157
  $rule = $wildcard . $rule . $wildcard;
 
1158
 
1159
  // Add a wildcard to the end of absolute url for zips
1160
- if ( $context === 'zip' && $absolute )
1161
  $rule .= $wildcard;
 
1162
 
1163
  // Add and end carrot to files for pclzip but only if it doesn't end in a wildcard
1164
- if ( $file && $context === 'regex' )
1165
  $rule .= '$';
 
1166
 
1167
  // Add a start carrot to absolute urls for pclzip
1168
- if ( $absolute && $context === 'regex' )
1169
  $rule = '^' . $rule;
 
 
1170
 
1171
  }
1172
 
1173
  // Escape shell args for zip command
1174
- if ( $context === 'zip' )
1175
  $excludes = array_map( 'escapeshellarg', array_unique( $excludes ) );
 
1176
 
1177
  return implode( $separator, $excludes );
1178
 
@@ -1525,10 +1623,10 @@ class HM_Backup {
1525
  * of the zip
1526
  *
1527
  * @param string $event
1528
- * @param array &$file
1529
  * @return bool
1530
  */
1531
- function hmbkp_pclzip_callback( $event, &$file ) {
1532
 
1533
  global $_hmbkp_exclude_string;
1534
 
94
  */
95
  private $unreadable_files = array();
96
 
97
+ /**
98
+ * An array of all the files in root
99
+ * that will be included in the backup
100
+ *
101
+ * @var array
102
+ */
103
+ protected $included_files = array();
104
+
105
  /**
106
  * Contains an array of errors
107
  *
140
  */
141
  protected $archive_verified = false;
142
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
143
  /**
144
  * Check whether safe mode is active or not
145
  *
196
 
197
  $home_path = ABSPATH;
198
 
 
 
 
 
 
199
  // If site_url contains home_url and they differ then assume WordPress is installed in a sub directory
200
+ if ( $home_url !== $site_url && strpos( $site_url, $home_url ) === 0 ) {
201
  $home_path = trailingslashit( substr( self::conform_dir( ABSPATH ), 0, strrpos( self::conform_dir( ABSPATH ), str_replace( $home_url, '', $site_url ) ) ) );
202
+ }
203
 
204
  return self::conform_dir( $home_path );
205
 
245
  @set_time_limit( 0 );
246
 
247
  // Set a custom error handler so we can track errors
248
+ set_error_handler( array( $this, 'error_handler' ) );
249
 
250
  }
251
 
1025
 
1026
  }
1027
 
1028
+ /**
1029
+ * Returns an array of files that will be included in the backup.
1030
+ *
1031
+ * @return array
1032
+ */
1033
+ public function get_included_files() {
1034
+
1035
+ if ( ! empty( $this->included_files ) )
1036
+ return $this->included_files;
1037
+
1038
+ $this->included_files = array();
1039
+
1040
+ $excludes = $this->exclude_string( 'regex' );
1041
+
1042
+ foreach ( $this->get_files() as $file ) {
1043
+
1044
+ // Skip dot files, they should only exist on versions of PHP between 5.2.11 -> 5.3
1045
+ if ( method_exists( $file, 'isDot' ) && $file->isDot() )
1046
+ continue;
1047
+
1048
+ // Skip unreadable files
1049
+ if ( ! @realpath( $file->getPathname() ) || ! $file->isReadable() )
1050
+ continue;
1051
+
1052
+ // Excludes
1053
+ if ( $excludes && preg_match( '(' . $excludes . ')', str_ireplace( trailingslashit( $this->get_root() ), '', self::conform_dir( $file->getPathname() ) ) ) )
1054
+ continue;
1055
+
1056
+ $this->included_files[] = $file;
1057
+
1058
+ }
1059
+
1060
+ return $this->included_files;
1061
+
1062
+ }
1063
+
1064
+ /**
1065
+ * Returns an array of files that match the exclude rules.
1066
+ *
1067
+ * @return array
1068
+ */
1069
+ public function get_excluded_files() {
1070
+
1071
+ if ( ! empty( $this->excluded_files ) )
1072
+ return $this->excluded_files;
1073
+
1074
+ $this->excluded_files = array();
1075
+
1076
+ $excludes = $this->exclude_string( 'regex' );
1077
+
1078
+ foreach ( $this->get_files() as $file ) {
1079
+
1080
+ // Skip dot files, they should only exist on versions of PHP between 5.2.11 -> 5.3
1081
+ if ( method_exists( $file, 'isDot' ) && $file->isDot() )
1082
+ continue;
1083
+
1084
+ // Skip unreadable files
1085
+ if ( ! @realpath( $file->getPathname() ) || ! $file->isReadable() )
1086
+ continue;
1087
+
1088
+ // Excludes
1089
+ if ( $excludes && preg_match( '(' . $excludes . ')', str_ireplace( trailingslashit( $this->get_root() ), '', self::conform_dir( $file->getPathname() ) ) ) )
1090
+ $this->excluded_files[] = $file;
1091
+
1092
+ }
1093
+
1094
+ return $this->excluded_files;
1095
+
1096
+ }
1097
+
1098
+ /**
1099
+ * Returns an array of unreadable files.
1100
+ *
1101
+ * @return array
1102
+ */
1103
+ public function get_unreadable_files() {
1104
+
1105
+ if ( ! empty( $this->unreadable_files ) )
1106
+ return $this->unreadable_files;
1107
+
1108
+ $this->unreadable_files = array();
1109
+
1110
+ foreach ( $this->get_files() as $file ) {
1111
+
1112
+ // Skip dot files, they should only exist on versions of PHP between 5.2.11 -> 5.3
1113
+ if ( method_exists( $file, 'isDot' ) && $file->isDot() )
1114
+ continue;
1115
+
1116
+ if ( ! @realpath( $file->getPathname() ) || ! $file->isReadable() )
1117
+ $this->unreadable_files[] = $file;
1118
+
1119
+ }
1120
+
1121
+ return $this->unreadable_files;
1122
+
1123
+ }
1124
+
1125
  private function load_pclzip() {
1126
 
1127
  // Load PclZip
1143
 
1144
  $excludes = array();
1145
 
1146
+ if ( isset( $this->excludes ) ) {
1147
  $excludes = $this->excludes;
1148
+ }
1149
 
1150
  // If path() is inside root(), exclude it
1151
+ if ( strpos( $this->get_path(), $this->get_root() ) !== false ) {
1152
  array_unshift( $excludes, trailingslashit( $this->get_path() ) );
1153
+ }
1154
 
1155
  return array_unique( $excludes );
1156
 
1164
  */
1165
  public function set_excludes( $excludes, $append = false ) {
1166
 
1167
+ if ( is_string( $excludes ) ) {
1168
  $excludes = explode( ',', $excludes );
1169
+ }
1170
 
1171
+ if ( $append ) {
1172
  $excludes = array_merge( $this->excludes, $excludes );
1173
+ }
1174
 
1175
  $this->excludes = array_filter( array_unique( array_map( 'trim', $excludes ) ) );
1176
 
1211
  $file = $absolute = $fragment = false;
1212
 
1213
  // Files don't end with /
1214
+ if ( ! in_array( substr( $rule, - 1 ), array( '\\', '/' ) ) ) {
1215
  $file = true;
1216
+ }
1217
 
1218
  // If rule starts with a / then treat as absolute path
1219
+ elseif ( in_array( substr( $rule, 0, 1 ), array( '\\', '/' ) ) ) {
1220
  $absolute = true;
1221
+ }
1222
 
1223
  // Otherwise treat as dir fragment
1224
+ else {
1225
  $fragment = true;
1226
+ }
1227
 
1228
  // Strip $this->root and conform
1229
  $rule = str_ireplace( $this->get_root(), '', untrailingslashit( self::conform_dir( $rule ) ) );
1230
 
1231
+
1232
  // Strip the preceeding slash
1233
+ if ( in_array( substr( $rule, 0, 1 ), array( '\\', '/' ) ) ) {
1234
  $rule = substr( $rule, 1 );
1235
+ }
1236
 
1237
  // Escape string for regex
1238
+ if ( $context === 'regex' ) {
1239
  $rule = str_replace( '.', '\.', $rule );
1240
+ }
1241
 
1242
  // Convert any existing wildcards
1243
+ if ( $wildcard !== '*' && strpos( $rule, '*' ) !== false ) {
1244
  $rule = str_replace( '*', $wildcard, $rule );
1245
+ }
1246
 
1247
  // Wrap directory fragments and files in wildcards for zip
1248
+ if ( $context === 'zip' && ( $fragment || $file ) ) {
1249
  $rule = $wildcard . $rule . $wildcard;
1250
+ }
1251
 
1252
  // Add a wildcard to the end of absolute url for zips
1253
+ if ( $context === 'zip' && $absolute ) {
1254
  $rule .= $wildcard;
1255
+ }
1256
 
1257
  // Add and end carrot to files for pclzip but only if it doesn't end in a wildcard
1258
+ if ( $file && $context === 'regex' ) {
1259
  $rule .= '$';
1260
+ }
1261
 
1262
  // Add a start carrot to absolute urls for pclzip
1263
+ if ( $absolute && $context === 'regex' ) {
1264
  $rule = '^' . $rule;
1265
+ }
1266
+
1267
 
1268
  }
1269
 
1270
  // Escape shell args for zip command
1271
+ if ( $context === 'zip' ) {
1272
  $excludes = array_map( 'escapeshellarg', array_unique( $excludes ) );
1273
+ }
1274
 
1275
  return implode( $separator, $excludes );
1276
 
1623
  * of the zip
1624
  *
1625
  * @param string $event
1626
+ * @param array $file
1627
  * @return bool
1628
  */
1629
+ function hmbkp_pclzip_callback( $event, $file ) {
1630
 
1631
  global $_hmbkp_exclude_string;
1632
 
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: humanmade, willmot, pauldewouters, joehoyle, mattheu, tcrsavage, c
3
  Tags: back up, backup, backups, database, zip, db, files, archive, wp-cli, humanmade
4
  Requires at least: 3.8.4
5
  Tested up to: 4.1
6
- Stable tag: 3.0
7
 
8
  Simple automated backups of your WordPress powered website.
9
 
@@ -114,8 +114,23 @@ You can also tweet <a href="http://twitter.com/humanmadeltd">@humanmadeltd</a> o
114
  2. Choose your schedule, backup type, number of backups to keep and whether to recieve a notification email.
115
  3. Easily manage exclude rules and see exactly which files are included and excluded from your backup.
116
 
 
 
 
 
117
  == Changelog ==
118
 
 
 
 
 
 
 
 
 
 
 
 
119
  #### 3.0 / 2014-11-14
120
 
121
  * Refactor the recursive filesize scanner
3
  Tags: back up, backup, backups, database, zip, db, files, archive, wp-cli, humanmade
4
  Requires at least: 3.8.4
5
  Tested up to: 4.1
6
+ Stable tag: 3.0.1
7
 
8
  Simple automated backups of your WordPress powered website.
9
 
114
  2. Choose your schedule, backup type, number of backups to keep and whether to recieve a notification email.
115
  3. Easily manage exclude rules and see exactly which files are included and excluded from your backup.
116
 
117
+ == Upgrade Notice ==
118
+
119
+ * This is a critical update. Fixes a bug in the core backup library. Please update immediately.
120
+
121
  == Changelog ==
122
 
123
+ #### 3.0.1 / 2014-11-20
124
+
125
+ * remove uneeded images
126
+ * latest hm-backup / fixes a serious bug in backups.
127
+ * Typos in v 3.0 changelog
128
+ * Specify POT filename in grunt task
129
+ * Update POT file
130
+ * Markdown readme
131
+ * Regenerate readme
132
+ * Add plugin headers
133
+
134
  #### 3.0 / 2014-11-14
135
 
136
  * Refactor the recursive filesize scanner