BackUpWordPress - Version 1.1.4

Version Description

Download this release

Release Info

Developer willmot
Plugin Icon 128x128 BackUpWordPress
Version 1.1.4
Comparing to
See all releases

Code changes from version 1.1.3 to 1.1.4

admin.actions.php CHANGED
@@ -26,11 +26,14 @@ function hmbkp_request_do_backup() {
26
  // Are we sure
27
  if ( !isset( $_GET['action'] ) || $_GET['action'] !== 'hmbkp_backup_now' || hmbkp_is_in_progress() || !is_writable( hmbkp_path() ) || !is_dir( hmbkp_path() ) )
28
  return false;
29
-
 
30
  wp_schedule_single_event( time(), 'hmbkp_schedule_single_backup_hook' );
31
 
 
32
  wp_cron();
33
-
 
34
  wp_redirect( remove_query_arg( 'action' ) );
35
  exit;
36
 
26
  // Are we sure
27
  if ( !isset( $_GET['action'] ) || $_GET['action'] !== 'hmbkp_backup_now' || hmbkp_is_in_progress() || !is_writable( hmbkp_path() ) || !is_dir( hmbkp_path() ) )
28
  return false;
29
+
30
+ // Schedule a single backup
31
  wp_schedule_single_event( time(), 'hmbkp_schedule_single_backup_hook' );
32
 
33
+ // Fire the cron now
34
  wp_cron();
35
+
36
+ // Redirect back
37
  wp_redirect( remove_query_arg( 'action' ) );
38
  exit;
39
 
admin.page.php CHANGED
@@ -49,7 +49,7 @@
49
  </p>
50
 
51
  <?php if ( !hmbkp_shell_exec_available() ) : ?>
52
- <p>&#10007; <?php printf( __( '%s is disabled which means we have to use the slower PHP fallbacks, you could try contacting yout host and asking them to enable it.', 'hmbkp' ), '<code>shell_exec</code>' ); ?>
53
  <?php endif; ?>
54
 
55
  <?php if ( hmbkp_shell_exec_available() ) : ?>
49
  </p>
50
 
51
  <?php if ( !hmbkp_shell_exec_available() ) : ?>
52
+ <p>&#10007; <?php printf( __( '%s is disabled which means we have to use the slower PHP fallbacks, you could try contacting your host and asking them to enable it.', 'hmbkp' ), '<code>shell_exec</code>' ); ?>
53
  <?php endif; ?>
54
 
55
  <?php if ( hmbkp_shell_exec_available() ) : ?>
assets/hmbkp.css CHANGED
@@ -7,4 +7,5 @@ tfoot p { margin: 0; font-weight: normal; }
7
  #hmbkp_advanced-options dt { float: left; width: 250px; clear: both; border-top: 1px solid #DFDFDF; padding: 7px 0; }
8
  #hmbkp_advanced-options dd { color: #666; margin-left: 250px; border-top: 1px solid #DFDFDF; padding: 7px 0; }
9
  .hmbkp_manage_backups_row .delete { color: #BC0B0B; }
10
- .hmbkp_manage_backups_row .delete:hover { color: red; }
 
7
  #hmbkp_advanced-options dt { float: left; width: 250px; clear: both; border-top: 1px solid #DFDFDF; padding: 7px 0; }
8
  #hmbkp_advanced-options dd { color: #666; margin-left: 250px; border-top: 1px solid #DFDFDF; padding: 7px 0; }
9
  .hmbkp_manage_backups_row .delete { color: #BC0B0B; }
10
+ .hmbkp_manage_backups_row .delete:hover { color: red; }
11
+ .completed th, .completed td { background-color: #FFFFE0; }
functions/backup.functions.php CHANGED
@@ -44,6 +44,8 @@ function hmbkp_do_backup() {
44
  hmbkp_delete_old_backups();
45
 
46
  delete_option( 'hmbkp_running' );
 
 
47
 
48
  }
49
 
44
  hmbkp_delete_old_backups();
45
 
46
  delete_option( 'hmbkp_running' );
47
+
48
+ update_option( 'hmbkp_complete', true );
49
 
50
  }
51
 
functions/backup.mysql.fallback.functions.php CHANGED
@@ -206,7 +206,7 @@ function hmbkp_backup_mysql_fallback( $path ) {
206
 
207
  global $hmbkp_db_connect;
208
 
209
- $hmbkp_db_connect = @mysql_pconnect( DB_HOST, DB_USER, DB_PASSWORD );
210
 
211
  mysql_select_db( DB_NAME, $hmbkp_db_connect );
212
 
206
 
207
  global $hmbkp_db_connect;
208
 
209
+ $hmbkp_db_connect = mysql_pconnect( DB_HOST, DB_USER, DB_PASSWORD );
210
 
211
  mysql_select_db( DB_NAME, $hmbkp_db_connect );
212
 
functions/core.functions.php CHANGED
@@ -36,17 +36,14 @@ function hmbkp_deactivate() {
36
 
37
  }
38
 
39
-
40
  /**
41
  * Handles anything that needs to be
42
  * done when the plugin is updated
43
  */
44
  function hmbkp_update() {
45
 
46
- global $hmbkp_version;
47
-
48
  // Every update
49
- if ( version_compare( $hmbkp_version, get_option( 'hmbkp_plugin_version' ), '>' ) ) :
50
  delete_transient( 'hmbkp_estimated_filesize' );
51
  delete_option( 'hmbkp_running' );
52
  endif;
@@ -102,7 +99,7 @@ function hmbkp_update() {
102
  endif;
103
 
104
  // Update the stored version
105
- update_option( 'hmbkp_plugin_version', $hmbkp_version );
106
 
107
  }
108
 
36
 
37
  }
38
 
 
39
  /**
40
  * Handles anything that needs to be
41
  * done when the plugin is updated
42
  */
43
  function hmbkp_update() {
44
 
 
 
45
  // Every update
46
+ if ( version_compare( HMBKP_VERSION, get_option( 'hmbkp_plugin_version' ), '>' ) ) :
47
  delete_transient( 'hmbkp_estimated_filesize' );
48
  delete_option( 'hmbkp_running' );
49
  endif;
99
  endif;
100
 
101
  // Update the stored version
102
+ update_option( 'hmbkp_plugin_version', HMBKP_VERSION );
103
 
104
  }
105
 
functions/interface.functions.php CHANGED
@@ -1,15 +1,14 @@
1
  <?php
2
  /**
3
- * hmbkp_get_backup_row function.
4
  *
5
- * @param mixed $file
6
- * @param mixed $alternate
7
  */
8
  function hmbkp_get_backup_row( $file ) {
9
 
10
  $encode = base64_encode( $file['file'] ); ?>
11
 
12
- <tr class="hmbkp_manage_backups_row">
13
 
14
  <th scope="row">
15
  <?php echo date( get_option('date_format'), filemtime( $file['file'] ) ) . ' ' . date( 'H:i', filemtime($file['file'] ) ); ?>
1
  <?php
2
  /**
3
+ * Displays a row in the manage backups table
4
  *
5
+ * @param string $file
 
6
  */
7
  function hmbkp_get_backup_row( $file ) {
8
 
9
  $encode = base64_encode( $file['file'] ); ?>
10
 
11
+ <tr class="hmbkp_manage_backups_row<?php if ( get_option( 'hmbkp_complete' ) ) : ?> completed<?php delete_option( 'hmbkp_complete' ); endif; ?>">
12
 
13
  <th scope="row">
14
  <?php echo date( get_option('date_format'), filemtime( $file['file'] ) ) . ' ' . date( 'H:i', filemtime($file['file'] ) ); ?>
functions/mysql-ping.php CHANGED
@@ -42,10 +42,8 @@ Class wpdb2 Extends wpdb {
42
  endwhile;
43
 
44
  // Ping failed
45
- if ( !$ping ) {
46
-
47
  $this->print_error( 'Attempted to connect for ' . $retry . ' but failed...' );
48
- }
49
 
50
  }
51
 
@@ -66,13 +64,22 @@ Class wpdb2 Extends wpdb {
66
 
67
  }
68
 
69
- // Setup the wpdb2 class
70
- $wpdb2 = new wpdb2( DB_USER, DB_PASSWORD, DB_NAME, DB_HOST );
71
-
72
- // Copy over the $wpdb vars
73
- global $wpdb;
74
- foreach( get_object_vars( $wpdb ) as $k => $v )
75
- if ( is_scalar( $v ) )
76
- $wpdb2->$k = $v;
77
-
78
- $wpdb =& $wpdb2;
 
 
 
 
 
 
 
 
 
42
  endwhile;
43
 
44
  // Ping failed
45
+ if ( !$ping )
 
46
  $this->print_error( 'Attempted to connect for ' . $retry . ' but failed...' );
 
47
 
48
  }
49
 
64
 
65
  }
66
 
67
+ /**
68
+ * If mysql.max_links is 2 or less and we're using the mysqldump fallback
69
+ * then we need the second link for the backup so we can't include
70
+ * mysql_ping.
71
+ */
72
+ if ( ini_get( 'mysql.max_links' > 2 ) && !hmbkp_mysqldump_path() ) :
73
+
74
+ // Setup the wpdb2 class
75
+ $wpdb2 = new wpdb2( DB_USER, DB_PASSWORD, DB_NAME, DB_HOST );
76
+
77
+ // Copy over the $wpdb vars
78
+ global $wpdb;
79
+ foreach( get_object_vars( $wpdb ) as $k => $v )
80
+ if ( is_scalar( $v ) )
81
+ $wpdb2->$k = $v;
82
+
83
+ $wpdb =& $wpdb2;
84
+
85
+ endif;
plugin.php CHANGED
@@ -5,7 +5,7 @@ Plugin Name: BackUpWordPress
5
  Plugin URI: http://humanmade.co.uk/
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: 1.1.3
9
  Author URI: http://humanmade.co.uk/
10
  */
11
 
@@ -33,14 +33,12 @@ define( 'HMBKP_PLUGIN_URL', WP_PLUGIN_URL . '/' . HMBKP_PLUGIN_SLUG );
33
  // Load the admin actions file
34
  function hmbkp_actions() {
35
 
36
- global $hmbkp_version;
37
-
38
  $plugin_data = get_plugin_data( __FILE__ );
39
 
40
- $hmbkp_version = (float) $plugin_data['Version'];
41
 
42
  // Fire the update action
43
- if ( $hmbkp_version > (float) get_option( 'hmbkp_plugin_version' ) )
44
  hmbkp_update();
45
 
46
  require_once( HMBKP_PLUGIN_PATH . '/admin.actions.php' );
@@ -70,6 +68,12 @@ function hmbkp_actions() {
70
  }
71
  add_action( 'admin_init', 'hmbkp_actions' );
72
 
 
 
 
 
 
 
73
  function hmbkp_plugin_row( $plugins ) {
74
 
75
  if ( isset( $plugins[HMBKP_PLUGIN_SLUG . '/plugin.php'] ) )
5
  Plugin URI: http://humanmade.co.uk/
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: 1.1.4
9
  Author URI: http://humanmade.co.uk/
10
  */
11
 
33
  // Load the admin actions file
34
  function hmbkp_actions() {
35
 
 
 
36
  $plugin_data = get_plugin_data( __FILE__ );
37
 
38
+ define( 'HMBKP_VERSION', $plugin_data['Version'] );
39
 
40
  // Fire the update action
41
+ if ( HMBKP_VERSION > get_option( 'hmbkp_plugin_version' ) )
42
  hmbkp_update();
43
 
44
  require_once( HMBKP_PLUGIN_PATH . '/admin.actions.php' );
68
  }
69
  add_action( 'admin_init', 'hmbkp_actions' );
70
 
71
+ /**
72
+ * Hook in an change the plugin description when BackUpWordPress is activated
73
+ *
74
+ * @param array $plugins
75
+ * @return $plugins
76
+ */
77
  function hmbkp_plugin_row( $plugins ) {
78
 
79
  if ( isset( $plugins[HMBKP_PLUGIN_SLUG . '/plugin.php'] ) )
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: willmot, humanmade
3
  Tags: back up, backup, backups
4
  Requires at least: 3.0
5
  Tested up to: 3.1
6
- Stable tag: 1.1.3
7
 
8
  Simple automated backups of your WordPress powered website.
9
 
@@ -27,6 +27,16 @@ Contact support@humanmade.co.uk for help/support.
27
 
28
  == Changelog ==
29
 
 
 
 
 
 
 
 
 
 
 
30
  #### 1.1.3
31
 
32
  * Attempt to re-connect if database connection hits a timeout while a backup is running, should fix issues with the "Back Up Now" button continuing to spin even though the backup is completed.
3
  Tags: back up, backup, backups
4
  Requires at least: 3.0
5
  Tested up to: 3.1
6
+ Stable tag: 1.1.4
7
 
8
  Simple automated backups of your WordPress powered website.
9
 
27
 
28
  == Changelog ==
29
 
30
+ #### 1.1.4
31
+
32
+ * Fix a rare issue where database backups could fail when using the mysqldump PHP fallback if `mysql.max_links` is set to 2 or less.
33
+ * Don't suppress `mysql_connect` errors in the mysqldump PHP fallback.
34
+ * One time highlight of the most recent completed backup when viewing the manage backups page after a successful backup.
35
+ * Fix a spelling error in the `shell_exec` disabled message.
36
+ * Store the BackUpWordPress version as a `Constant` rather than a `Variable`.
37
+ * Don't `(float)` the BackUpWordPress version number, fixes issues with minor versions numbers being truncated.
38
+ * Minor PHPDoc improvements.
39
+
40
  #### 1.1.3
41
 
42
  * Attempt to re-connect if database connection hits a timeout while a backup is running, should fix issues with the "Back Up Now" button continuing to spin even though the backup is completed.