BackUpWordPress - Version 3.4.4

Version Description

= 3.4 =

  • This version introduces a major refactoring of the code responsible for the core backup engine. We made sure to write unit tests for the new code, and we have tested it on several user's sites. It fixes a lot of old bugs, and Windows users should see major improvements to reliability.

= 3.3.4 =

  • WordPress 4.4 compatibility.

= 3.3.1 =

  • Fixes a bug that would prevent downloading backups since 3.3.0 - please update.

= 3.2.5 =

  • Security fixes related to add_query_arg

= 3.2.1 =

  • Important bug fixes. Please upgrade to this version to avoid incomplete or broken backups.

= 3.1.3 =

  • Fixes backwards compatibility for add-ons and avoids a Fatal Error. Please upgrade straight to this version before upgrading your add-ons.

= 3.0.4 =

  • Fixes a few minor bugs. Immediate update is recommended.

= 3.0.2 =

  • Important: we have dropped support for PHP 5.2, you will not be able to activate BackUpWordPress on a server running PHP versions older than PHP 5.3.29

= 3.0.1 =

  • 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.4.4
Comparing to
See all releases

Code changes from version 3.4.4-beta to 3.4.4

backupwordpress.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: BackUpWordPress
4
  Plugin URI: http://bwp.hmn.md/
5
  Description: Simple automated backups of your WordPress powered website. Once activated you'll find me under <strong>Tools &rarr; Backups</strong>. On multisite, you'll find me under the Network Settings menu.
6
- Version: 3.4.4-beta
7
  Author: Human Made Limited
8
  Author URI: http://hmn.md/
9
  License: GPL-2+
@@ -32,23 +32,26 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
32
  */
33
 
34
  // Only load if >= PHP 5.3
35
- if ( version_compare( phpversion(), '5.3', '>=' ) ) {
36
 
37
- if ( ! defined( 'HMBKP_PLUGIN_PATH' ) ) {
38
- define( 'HMBKP_PLUGIN_PATH', plugin_dir_path( __FILE__ ) );
39
- }
40
 
41
- if ( ! defined( 'HMBKP_BASENAME' ) ) {
42
- define( 'HMBKP_BASENAME', plugin_basename( __FILE__ ) );
43
- }
44
 
45
- require_once( HMBKP_PLUGIN_PATH . 'classes/class-setup.php' );
 
 
46
 
47
- register_activation_hook( __FILE__, array( 'HM\BackUpWordPress\Setup', 'activate' ) );
48
- register_deactivation_hook( __FILE__, array( 'HM\BackUpWordPress\Setup', 'deactivate' ) );
49
 
50
- require_once( HMBKP_PLUGIN_PATH . 'classes/class-plugin.php' );
 
51
 
 
 
52
  } else {
53
- wp_die( sprintf( __( 'BackUpWordPress will not work on this site: PHP Version %s is unsupported.', 'backupwordpress' ), phpversion() ), __( 'BackUpWordPress Error', 'backupwordpress' ), array( 'back_link' => true ) );
 
 
54
  }
 
3
  Plugin Name: BackUpWordPress
4
  Plugin URI: http://bwp.hmn.md/
5
  Description: Simple automated backups of your WordPress powered website. Once activated you'll find me under <strong>Tools &rarr; Backups</strong>. On multisite, you'll find me under the Network Settings menu.
6
+ Version: 3.4.4
7
  Author: Human Made Limited
8
  Author URI: http://hmn.md/
9
  License: GPL-2+
32
  */
33
 
34
  // Only load if >= PHP 5.3
 
35
 
 
 
 
36
 
37
+ if ( ! defined( 'HMBKP_PLUGIN_PATH' ) ) {
38
+ define( 'HMBKP_PLUGIN_PATH', plugin_dir_path( __FILE__ ) );
39
+ }
40
 
41
+ if ( ! defined( 'HMBKP_BASENAME' ) ) {
42
+ define( 'HMBKP_BASENAME', plugin_basename( __FILE__ ) );
43
+ }
44
 
45
+ require_once( HMBKP_PLUGIN_PATH . 'classes/class-setup.php' );
 
46
 
47
+ register_activation_hook( __FILE__, array( 'HMBKP_Setup', 'activate' ) );
48
+ register_deactivation_hook( __FILE__, array( 'HMBKP_Setup', 'deactivate' ) );
49
 
50
+ if ( HMBKP_Setup::meets_requirements() ) {
51
+ require_once( HMBKP_PLUGIN_PATH . 'classes/class-plugin.php' );
52
  } else {
53
+ add_action( 'admin_init', array( 'HMBKP_Setup', 'self_deactivate' ) );
54
+
55
+ add_action( 'all_admin_notices', array( 'HMBKP_Setup', 'display_admin_notices' ) );
56
  }
57
+
classes/backup/class-backup.php CHANGED
@@ -37,6 +37,8 @@ class Backup {
37
 
38
  public function run() {
39
 
 
 
40
  if ( $this->type !== 'file' ) {
41
  $this->backup_database();
42
  }
@@ -45,6 +47,8 @@ class Backup {
45
  $this->backup_files();
46
  }
47
 
 
 
48
  }
49
 
50
  public function backup_database() {
37
 
38
  public function run() {
39
 
40
+ Path::get_instance()->cleanup();
41
+
42
  if ( $this->type !== 'file' ) {
43
  $this->backup_database();
44
  }
47
  $this->backup_files();
48
  }
49
 
50
+ Path::get_instance()->cleanup();
51
+
52
  }
53
 
54
  public function backup_database() {
classes/class-path.php CHANGED
@@ -187,7 +187,7 @@ class Path {
187
  }
188
 
189
  public function reset_path() {
190
- $this->set_path( false );
191
  }
192
 
193
  /**
@@ -429,7 +429,7 @@ class Path {
429
  return;
430
  }
431
 
432
- foreach ( new CleanUpIterator( new \DirectoryIterator( $this->path ) ) as $file ) {
433
 
434
  if ( $file->isDot() || ! $file->isReadable() || ! $file->isFile() ) {
435
  continue;
@@ -438,15 +438,26 @@ class Path {
438
  @unlink( $file->getPathname() );
439
 
440
  }
441
-
442
  }
443
-
444
  }
445
 
446
  class CleanUpIterator extends \FilterIterator {
447
 
448
- // Don't match index.html,files with zip extension or status logfiles.
449
  public function accept() {
450
- return ! preg_match( '/(index\.html|.*\.zip|.*-running)/', $this->current() );
 
 
 
 
 
 
 
 
 
 
 
 
 
451
  }
452
  }
187
  }
188
 
189
  public function reset_path() {
190
+ $this->path = $this->custom_path = '';
191
  }
192
 
193
  /**
429
  return;
430
  }
431
 
432
+ foreach ( new CleanUpIterator( new \DirectoryIterator( Path::get_path() ) ) as $file ) {
433
 
434
  if ( $file->isDot() || ! $file->isReadable() || ! $file->isFile() ) {
435
  continue;
438
  @unlink( $file->getPathname() );
439
 
440
  }
 
441
  }
 
442
  }
443
 
444
  class CleanUpIterator extends \FilterIterator {
445
 
446
+ // Don't match index.html, files with zip extension or status logfiles.
447
  public function accept() {
448
+
449
+ // Don't remove existing backups
450
+ if ( 'zip' === $this->current()->getExtension() ) {
451
+ return false;
452
+ }
453
+
454
+ // Don't remove the index.html file
455
+ if ( 'index.html' === $this->current()->getBasename() ) {
456
+ return false;
457
+ }
458
+
459
+ // Don't cleanup the backup running file
460
+ return ! preg_match( '/(.*-running)/', $this->current() );
461
+
462
  }
463
  }
classes/class-plugin.php CHANGED
@@ -6,7 +6,7 @@ namespace HM\BackUpWordPress;
6
  * Class Plugin
7
  */
8
  final class Plugin {
9
- const PLUGIN_VERSION = '3.4.4-beta';
10
 
11
  /**
12
  * @var Plugin The singleton instance.
@@ -63,11 +63,13 @@ final class Plugin {
63
  */
64
  public function maybe_self_deactivate() {
65
 
66
- if ( false === Setup::meets_requirements() ) {
67
 
68
- add_action( 'admin_init', array( 'HM\BackUpWordPress\Setup', 'self_deactivate' ) );
69
 
70
- add_action( 'all_admin_notices', array( 'HM\BackUpWordPress\Setup', 'display_admin_notices' ) );
 
 
71
 
72
  return true;
73
 
@@ -288,6 +290,10 @@ final class Plugin {
288
  */
289
  protected function generate_key() {
290
 
 
 
 
 
291
  $key = array( ABSPATH, time() );
292
  $constants = array( 'AUTH_KEY', 'SECURE_AUTH_KEY', 'LOGGED_IN_KEY', 'NONCE_KEY', 'AUTH_SALT', 'SECURE_AUTH_SALT', 'LOGGED_IN_SALT', 'NONCE_SALT', 'SECRET_KEY' );
293
 
6
  * Class Plugin
7
  */
8
  final class Plugin {
9
+ const PLUGIN_VERSION = '3.4.4';
10
 
11
  /**
12
  * @var Plugin The singleton instance.
63
  */
64
  public function maybe_self_deactivate() {
65
 
66
+ require_once( HMBKP_PLUGIN_PATH . 'classes/class-setup.php' );
67
 
68
+ if ( false === \HMBKP_Setup::meets_requirements() ) {
69
 
70
+ add_action( 'admin_init', array( '\HMBKP_Setup', 'self_deactivate' ) );
71
+
72
+ add_action( 'all_admin_notices', array( '\HMBKP_Setup', 'display_admin_notices' ) );
73
 
74
  return true;
75
 
290
  */
291
  protected function generate_key() {
292
 
293
+ $check = apply_filters( "hmbkp_generate_key", null );
294
+ if ( null !== $check )
295
+ return $check;
296
+
297
  $key = array( ABSPATH, time() );
298
  $constants = array( 'AUTH_KEY', 'SECURE_AUTH_KEY', 'LOGGED_IN_KEY', 'NONCE_KEY', 'AUTH_SALT', 'SECURE_AUTH_SALT', 'LOGGED_IN_SALT', 'NONCE_SALT', 'SECRET_KEY' );
299
 
classes/class-setup.php CHANGED
@@ -1,11 +1,8 @@
1
  <?php
2
-
3
- namespace HM\BackUpWordPress;
4
-
5
  /**
6
  * Class BackUpWordPress_Setup
7
  */
8
- class Setup {
9
 
10
  /**
11
  * Defines the minimum version of WordPress required by BWP.
@@ -67,11 +64,15 @@ class Setup {
67
 
68
  $schedules = $wpdb->get_col( $wpdb->prepare( "SELECT option_name FROM $wpdb->options WHERE option_name LIKE %s", 'hmbkp_schedule_%' ) );
69
 
70
- foreach ( array_map( function ( $item ) {
71
- return ltrim( $item, 'hmbkp_schedule_' );
72
- }, $schedules ) as $item ) {
73
  wp_clear_scheduled_hook( 'hmbkp_schedule_hook', array( 'id' => $item ) );
74
  }
 
 
 
 
 
 
75
  }
76
 
77
  /**
@@ -104,7 +105,7 @@ class Setup {
104
  require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
105
  }
106
 
107
- deactivate_plugins( dirname( __DIR__ ) . '/backupwordpress.php' );
108
 
109
  if ( isset( $_GET['activate'] ) ) {
110
  unset( $_GET['activate'] );
@@ -155,7 +156,7 @@ class Setup {
155
  */
156
  public static function display_admin_notices() {
157
 
158
- echo '<div class="error"><p>' . esc_html( self::get_notice_message() ) . '</p></div>';
159
 
160
  }
161
 
1
  <?php
 
 
 
2
  /**
3
  * Class BackUpWordPress_Setup
4
  */
5
+ class HMBKP_Setup {
6
 
7
  /**
8
  * Defines the minimum version of WordPress required by BWP.
64
 
65
  $schedules = $wpdb->get_col( $wpdb->prepare( "SELECT option_name FROM $wpdb->options WHERE option_name LIKE %s", 'hmbkp_schedule_%' ) );
66
 
67
+ foreach ( array_map( array( 'self', 'trim_prefix' ), $schedules ) as $item ) {
 
 
68
  wp_clear_scheduled_hook( 'hmbkp_schedule_hook', array( 'id' => $item ) );
69
  }
70
+
71
+
72
+ }
73
+
74
+ public static function trim_prefix( $item ) {
75
+ return ltrim( $item, 'hmbkp_schedule_' );
76
  }
77
 
78
  /**
105
  require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
106
  }
107
 
108
+ deactivate_plugins( dirname( dirname(__FILE__ ) ) . '/backupwordpress.php' );
109
 
110
  if ( isset( $_GET['activate'] ) ) {
111
  unset( $_GET['activate'] );
156
  */
157
  public static function display_admin_notices() {
158
 
159
+ echo '<div class="error"><p>' . self::get_notice_message() . '</p></div>';
160
 
161
  }
162
 
languages/backupwordpress.pot CHANGED
@@ -2,9 +2,9 @@
2
  # This file is distributed under the GPL-2+.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: BackUpWordPress 3.4.4-beta\n"
6
  "Report-Msgid-Bugs-To: backupwordpress@hmn.md\n"
7
- "POT-Creation-Date: 2016-02-11 15:36:33+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
@@ -1151,4 +1151,4 @@ msgctxt "backups count"
1151
  msgid "One backup completed"
1152
  msgid_plural "%1$s backups completed"
1153
  msgstr[0] ""
1154
- msgstr[1] ""
2
  # This file is distributed under the GPL-2+.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: BackUpWordPress 3.4.4\n"
6
  "Report-Msgid-Bugs-To: backupwordpress@hmn.md\n"
7
+ "POT-Creation-Date: 2016-02-23 15:50:44+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
1151
  msgid "One backup completed"
1152
  msgid_plural "%1$s backups completed"
1153
  msgstr[0] ""
1154
+ msgstr[1] ""
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.9
5
  Tested up to: 4.4.2
6
- Stable tag: 3.4.3
7
 
8
  Simple automated backups of your WordPress-powered website.
9
 
@@ -158,6 +158,13 @@ users should see major improvements to reliability.
158
 
159
  == Changelog ==
160
 
 
 
 
 
 
 
 
161
  ### 3.4.4-beta
162
 
163
  * Fixes a bug which caused the root path to the WordPress install to be miscalulated in certain setups.
3
  Tags: back up, backup, backups, database, zip, db, files, archive, wp-cli, humanmade
4
  Requires at least: 3.9
5
  Tested up to: 4.4.2
6
+ Stable tag: 3.4.4
7
 
8
  Simple automated backups of your WordPress-powered website.
9
 
158
 
159
  == Changelog ==
160
 
161
+ ### 3.4.4 / 2016-02-23
162
+
163
+ * Ensure temporary files are correctly cleaned up before and after running a backup.
164
+ * Avoid killing site if plugin is active on PHP 52
165
+ * Allow custom secure key using filter
166
+ * Fixes a bug which caused the root path to the WordPress install to be miscalulated in certain setups.
167
+
168
  ### 3.4.4-beta
169
 
170
  * Fixes a bug which caused the root path to the WordPress install to be miscalulated in certain setups.