BackUpWordPress - Version 1.0.5

Version Description

Download this release

Release Info

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

Code changes from version 1.0.3 to 1.0.5

admin.actions.php CHANGED
@@ -33,8 +33,6 @@ function hmbkp_request_do_backup() {
33
  'created' => time()
34
  );
35
 
36
- update_option( 'hmbkp_running', microtime( true ) );
37
-
38
  wp_schedule_single_event( time(), 'hmbkp_schedule_backup_hook', $options );
39
 
40
  spawn_cron();
33
  'created' => time()
34
  );
35
 
 
 
36
  wp_schedule_single_event( time(), 'hmbkp_schedule_backup_hook', $options );
37
 
38
  spawn_cron();
admin.menus.php CHANGED
@@ -15,4 +15,21 @@ add_action( 'admin_menu', 'hmbkp_admin_menu' );
15
  */
16
  function hmbkp_manage_backups() {
17
  require_once( HMBKP_PLUGIN_PATH . '/admin.page.php' );
18
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
  */
16
  function hmbkp_manage_backups() {
17
  require_once( HMBKP_PLUGIN_PATH . '/admin.page.php' );
18
+ }
19
+
20
+ /**
21
+ * Add a link to the backups page to the plugin action links.
22
+ *
23
+ * @param Array $links
24
+ * @param String $file
25
+ * @return Array $links
26
+ */
27
+ function hmbkp_plugin_action_link( $links, $file ) {
28
+
29
+ if ( strpos( $file, HMBKP_PLUGIN_SLUG ) !== false )
30
+ array_push( $links, '<a href="tools.php?page=' . HMBKP_PLUGIN_SLUG . '">' . __( 'Backups', 'hmbkp' ) . '</a>' );
31
+
32
+ return $links;
33
+
34
+ }
35
+ add_filter('plugin_action_links', 'hmbkp_plugin_action_link', 10, 2 );
admin.page.php CHANGED
@@ -22,8 +22,8 @@
22
  <?php if ( is_dir( hmbkp_path() ) && is_writable( hmbkp_path() ) ) : ?>
23
 
24
  <p>
25
- <?php printf( __( 'Your %s &amp; %s will be automatically backed up every day at %s to %s.', 'hmbkp' ), '<code>' . __( 'database', 'hmbkp' ) . '</code>', '<code>' . __( 'files', 'hmbkp' ) . '</code>', '<code>' . date( 'H:i', wp_next_scheduled( 'hmbkp_schedule_backup_hook', $schedules['default'] ) ) . '</code>', '<code>' . trailingslashit( hmbkp_path() ) . '</code>' ); ?>
26
- <span class="hmbkp_estimated-size"><?php printf( __( 'Each backup will be approximately %s.', 'hmbkp' ), '<code>Calculating Size...</code>' ); ?></span>
27
  </p>
28
 
29
  <?php $backup_archives = hmbkp_get_backups();
@@ -56,34 +56,39 @@
56
 
57
  <?php endif; ?>
58
 
59
- <?php if ( count( $backup_archives ) >= get_option( 'hmbkp_max_backups' ) ) : ?>
60
-
61
- <p class="howto"><?php printf( _n( '* Only the latest backup is saved.', '* Only the latest %d backups are saved.', (int) get_option( 'hmbkp_max_backups' ), 'hmbkp' ) ); ?></p>
62
-
63
- <?php endif; ?>
64
 
65
  <h4><?php _e( 'Compatibility', 'hmbkp' ); ?></h4>
66
 
67
- <?php if ( !hmbkp_zip_path() || !hmbkp_mysqldump_path() ) : ?>
68
  <p><?php _e( 'You can increase the speed and reliability of your backups by resolving the items below. Your backups will still work fine if you don\'t.', 'hmnkp' ); ?></p>
69
  <?php endif; ?>
70
 
71
- <?php if ( !hmbkp_zip_path() ) : ?>
 
 
72
 
73
- <p>&#10007; <?php printf( __( 'We couldn\'t find the %s command on your server.', 'hmbkp' ), '<code>zip</code>' ); ?></p>
74
 
75
- <p><?php printf( __( 'You can fix this by adding %s to your %s file. run %s on your server to find the path or ask your server administrator.', 'hmbkp' ), '<code>' . define( 'HMBKP_ZIP_PATH', __( 'path to the zip command', 'hmbkp' ) ) . '</code>', '<code>wp-config.php</code>', '<code>which zip</code>' ); ?></p>
76
 
77
- <?php else : ?>
 
 
 
78
  <p>&#10003; <?php printf( __( 'Your files are being backed up using the %s command.', 'hmbkp' ), '<code>' . hmbkp_zip_path() . '</code>' ); ?></p>
79
 
80
- <?php endif; ?>
81
 
82
- <?php if ( !hmbkp_mysqldump_path() ) : ?>
83
  <p>&#10007; <?php printf( __( 'We couldn\'t find the %s command on your server.', 'hmbkp' ), '<code>mysqldump</code>' ); ?></p>
84
- <p><?php printf( __( 'You can fix this by adding %s to your %s file. run %s on your server to find the path or ask your server administrator.', 'hmbkp' ), '<code>' . define( 'HMBKP_MYSQLDUMP_PATH', __( 'path to the mysqldump command' ) ) . '</code>', '<code>wp-config.php</code>', '<code>which mysqldump</code>' ); ?></p>
85
- <?php else : ?>
 
86
  <p>&#10003; <?php printf( __( 'Your database is being backed up using the %s command.', 'hmbkp' ), '<code>' . hmbkp_mysqldump_path() . '</code>' ); ?></p>
 
 
 
87
  <?php endif; ?>
88
 
89
  <?php if ( defined( 'HMBKP_PATH' ) && HMBKP_PATH ) :
22
  <?php if ( is_dir( hmbkp_path() ) && is_writable( hmbkp_path() ) ) : ?>
23
 
24
  <p>
25
+ <?php printf( __( 'Your %s &amp; %s will be automatically backed up every day at %s to %s.', 'hmbkp' ), '<code>' . __( 'database', 'hmbkp' ) . '</code>', '<code>' . __( 'files', 'hmbkp' ) . '</code>', '<code>' . date( 'H:i', wp_next_scheduled( 'hmbkp_schedule_backup_hook', $schedules['default'] ) ) . '</code>', '<code>' . trailingslashit( hmbkp_path() ) . '</code>' ); ?>
26
+ <span class="hmbkp_estimated-size"><?php printf( __( 'Each backup will be approximately %s.', 'hmbkp' ), get_transient( 'hmbkp_estimated_filesize' ) ? '<code>' . hmbkp_calculate() . '</code>' : '<code class="calculate">' . __( 'Calculating Size...', 'hmbkp' ) . '</code>' ); ?></span>
27
  </p>
28
 
29
  <?php $backup_archives = hmbkp_get_backups();
56
 
57
  <?php endif; ?>
58
 
59
+ <p class="howto"><?php printf( _n( '* Only the latest backup is saved.', '* Only the latest %d backups are saved.', (int) get_option( 'hmbkp_max_backups' ), 'hmbkp' ), get_option( 'hmbkp_max_backups' ) ); ?></p>
 
 
 
 
60
 
61
  <h4><?php _e( 'Compatibility', 'hmbkp' ); ?></h4>
62
 
63
+ <?php if ( !hmbkp_zip_path() || !hmbkp_mysqldump_path() || !hmbkp_shell_exec_available() ) : ?>
64
  <p><?php _e( 'You can increase the speed and reliability of your backups by resolving the items below. Your backups will still work fine if you don\'t.', 'hmnkp' ); ?></p>
65
  <?php endif; ?>
66
 
67
+ <?php if ( !hmbkp_shell_exec_available() ) : ?>
68
+ <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>' ); ?>
69
+ <?php endif; ?>
70
 
71
+ <?php if ( hmbkp_shell_exec_available() ) : ?>
72
 
73
+ <?php if ( !hmbkp_zip_path() ) : ?>
74
 
75
+ <p>&#10007; <?php printf( __( 'We couldn\'t find the %s command on your server.', 'hmbkp' ), '<code>zip</code>' ); ?></p>
76
+ <p><?php printf( __( 'You can fix this by adding %s to your %s file. run %s on your server to find the path or ask your server administrator.', 'hmbkp' ), '<code>define( "HMBKP_ZIP_PATH", ' . __( 'path to the zip command', 'hmbkp' ) . ' )</code>', '<code>wp-config.php</code>', '<code>which zip</code>' ); ?></p>
77
+
78
+ <?php else : ?>
79
  <p>&#10003; <?php printf( __( 'Your files are being backed up using the %s command.', 'hmbkp' ), '<code>' . hmbkp_zip_path() . '</code>' ); ?></p>
80
 
81
+ <?php endif; ?>
82
 
83
+ <?php if ( !hmbkp_mysqldump_path() ) : ?>
84
  <p>&#10007; <?php printf( __( 'We couldn\'t find the %s command on your server.', 'hmbkp' ), '<code>mysqldump</code>' ); ?></p>
85
+ <p><?php printf( __( 'You can fix this by adding %s to your %s file. run %s on your server to find the path or ask your server administrator.', 'hmbkp' ), '<code>define( "HMBKP_MYSQLDUMP_PATH", ' . __( 'path to the mysqldump command' ) . ' )</code>', '<code>wp-config.php</code>', '<code>which mysqldump</code>' ); ?></p>
86
+
87
+ <?php else : ?>
88
  <p>&#10003; <?php printf( __( 'Your database is being backed up using the %s command.', 'hmbkp' ), '<code>' . hmbkp_mysqldump_path() . '</code>' ); ?></p>
89
+
90
+ <?php endif; ?>
91
+
92
  <?php endif; ?>
93
 
94
  <?php if ( defined( 'HMBKP_PATH' ) && HMBKP_PATH ) :
assets/hmbkp.js CHANGED
@@ -6,8 +6,8 @@ jQuery( document ).ready( function( $ ) {
6
 
7
  $.get( ajaxurl, { 'action' : 'hmbkp_calculate' },
8
  function( data ) {
9
- $( '.hmbkp_estimated-size code' ).removeClass( 'calculating' );
10
- $( '.hmbkp_estimated-size code' ).fadeOut( function() {
11
  $( this ).empty().append( data );
12
  } ).fadeIn();
13
  }
6
 
7
  $.get( ajaxurl, { 'action' : 'hmbkp_calculate' },
8
  function( data ) {
9
+ $( '.hmbkp_estimated-size .calculate' ).removeClass( 'calculating' );
10
+ $( '.hmbkp_estimated-size .calculate' ).fadeOut( function() {
11
  $( this ).empty().append( data );
12
  } ).fadeIn();
13
  }
functions/backup.files.functions.php CHANGED
@@ -113,6 +113,9 @@ function hmbkp_archive_files( $backup_tmp_dir, $backup_filepath ) {
113
  */
114
  function hmbkp_zip_path() {
115
 
 
 
 
116
  $path = '';
117
 
118
  // List of possible zip locations
113
  */
114
  function hmbkp_zip_path() {
115
 
116
+ if ( !hmbkp_shell_exec_available() )
117
+ return false;
118
+
119
  $path = '';
120
 
121
  // List of possible zip locations
functions/backup.functions.php CHANGED
@@ -36,7 +36,7 @@ function hmbkp_do_backup() {
36
  // Delete any old backup files
37
  hmbkp_delete_old_backups( $log );
38
 
39
- $log['logfile'][] = sprintf( __( 'Backup done at %d', 'hmbkp' ), hmbkp_timestamp() );
40
  $log['logfile'][] = sprintf( __( 'Backup was running for %d Seconds', 'hmbkp' ), round( microtime( true ) - $time_start, 2 ) );
41
 
42
  hmbkp_write_log( $log );
@@ -155,7 +155,7 @@ function hmbkp_create_tmp_dir( $log ) {
155
  // Temporary directory name
156
  $backup_tmp_dir = trailingslashit( hmbkp_path() ) . date( 'Y-m-d-H-i-s' );
157
 
158
- $log['logfile'][] = __( 'Backup starting at', 'hmbkp' ) . ' ' . hmbkp_timestamp() ;
159
 
160
  // Create the temp backup directory
161
  if ( !is_dir( $backup_tmp_dir ) ) :
36
  // Delete any old backup files
37
  hmbkp_delete_old_backups( $log );
38
 
39
+ $log['logfile'][] = sprintf( __( 'Backup completed %s', 'hmbkp' ), hmbkp_timestamp() );
40
  $log['logfile'][] = sprintf( __( 'Backup was running for %d Seconds', 'hmbkp' ), round( microtime( true ) - $time_start, 2 ) );
41
 
42
  hmbkp_write_log( $log );
155
  // Temporary directory name
156
  $backup_tmp_dir = trailingslashit( hmbkp_path() ) . date( 'Y-m-d-H-i-s' );
157
 
158
+ $log['logfile'][] = sprintf( __( 'Backup starting at $s', 'hmbkp' ), hmbkp_timestamp() );
159
 
160
  // Create the temp backup directory
161
  if ( !is_dir( $backup_tmp_dir ) ) :
functions/backup.mysql.functions.php CHANGED
@@ -40,6 +40,9 @@ function hmbkp_backup_mysql( $backup_tmp_dir, $log ) {
40
  */
41
  function hmbkp_mysqldump_path() {
42
 
 
 
 
43
  $path = '';
44
 
45
  // List of possible mysqldump locations
40
  */
41
  function hmbkp_mysqldump_path() {
42
 
43
+ if ( !hmbkp_shell_exec_available() )
44
+ return false;
45
+
46
  $path = '';
47
 
48
  // List of possible mysqldump locations
functions/core.functions.php CHANGED
@@ -6,7 +6,9 @@
6
  * @return void
7
  */
8
  function hmbkp_activate() {
 
9
  hmbkp_set_defaults();
 
10
  }
11
 
12
  /**
@@ -33,7 +35,6 @@ function hmbkp_deactivate() {
33
  foreach ( $options as $option )
34
  delete_option( $option );
35
 
36
-
37
  // Clear crons
38
  wp_clear_scheduled_hook( 'hmbkp_schedule_backup_hook' );
39
 
@@ -348,4 +349,20 @@ function hmbkp_calculate() {
348
 
349
  return hmbkp_size_readable( $filesize );
350
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
351
  }
6
  * @return void
7
  */
8
  function hmbkp_activate() {
9
+
10
  hmbkp_set_defaults();
11
+
12
  }
13
 
14
  /**
35
  foreach ( $options as $option )
36
  delete_option( $option );
37
 
 
38
  // Clear crons
39
  wp_clear_scheduled_hook( 'hmbkp_schedule_backup_hook' );
40
 
349
 
350
  return hmbkp_size_readable( $filesize );
351
 
352
+ }
353
+
354
+ /**
355
+ * Check whether shell_exec has been disabled.
356
+ *
357
+ * @return bool
358
+ */
359
+ function hmbkp_shell_exec_available() {
360
+
361
+ $disable_functions = ini_get( 'disable_functions' );
362
+
363
+ if ( strpos( $disable_functions, 'shell_exec' ) !== false )
364
+ return false;
365
+
366
+ return true;
367
+
368
  }
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.
7
  Author: Human Made Limited
8
- Version: 1.0.3
9
  Author URI: http://humanmade.co.uk/
10
  */
11
 
5
  Plugin URI: http://humanmade.co.uk/
6
  Description: Simple automated backups of your WordPress powered website.
7
  Author: Human Made Limited
8
+ Version: 1.0.5
9
  Author URI: http://humanmade.co.uk/
10
  */
11
 
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.0.3
7
 
8
  Simple automated backups of your WordPress powered website.
9
 
@@ -17,9 +17,9 @@ BackUpWordPress will back up your entire site including your database and all yo
17
 
18
  The plugin will try to use the `mysqldump` and `zip` commands via shell if they are available, using these will greatly improve the time it takes to back up your site. You can point the plugin in the right direction by defining `HMBKP_ZIP_PATH` and `HMBKP_MYSQLDUMP_PATH` in your `wp-config.php`.
19
 
20
- == FAQ ==
21
 
22
- Contact hello@humanmade.co.uk for help and support
23
 
24
  == Screenshots ==
25
 
@@ -27,11 +27,23 @@ Contact hello@humanmade.co.uk for help and support
27
 
28
  == Changelog ==
29
 
 
 
 
 
 
 
 
 
 
 
 
 
30
  #### 1.0.3
31
 
32
  Minor bug fix release.
33
 
34
- * Suppress `filesize()` warnings when calculating backup size.
35
  * Plugin should now work when symlinked.
36
  * Remove all options on deactivate, you should now be able to deactivate then activate to fix issues with settings etc. becoming corrupt.
37
  * Call setup_defaults for users who update from backupwordpress 0.4.5 so they get new settings.
3
  Tags: back up, backup, backups
4
  Requires at least: 3.0
5
  Tested up to: 3.1
6
+ Stable tag: 1.0.5
7
 
8
  Simple automated backups of your WordPress powered website.
9
 
17
 
18
  The plugin will try to use the `mysqldump` and `zip` commands via shell if they are available, using these will greatly improve the time it takes to back up your site. You can point the plugin in the right direction by defining `HMBKP_ZIP_PATH` and `HMBKP_MYSQLDUMP_PATH` in your `wp-config.php`.
19
 
20
+ == Frequently Asked Questions ==
21
 
22
+ Contact support@humanmade.co.uk for help/support.
23
 
24
  == Screenshots ==
25
 
27
 
28
  == Changelog ==
29
 
30
+ #### 1.0.5
31
+
32
+ * Don't ajax load estimated backup size if it's already been calculated.
33
+ * Fix time in backup complete log message.
34
+ * Don't mark backup as running until cron has been called, will fix issues with backup showing as running even if cron never fired.
35
+ * Show number of backups saved message.
36
+ * Add a link to the backups page to the plugin action links.
37
+
38
+ #### 1.0.4
39
+
40
+ Don't throw PHP Warnings when `shell_exec` is disabled
41
+
42
  #### 1.0.3
43
 
44
  Minor bug fix release.
45
 
46
+ * Suppress filesize() warnings when calculating backup size.
47
  * Plugin should now work when symlinked.
48
  * Remove all options on deactivate, you should now be able to deactivate then activate to fix issues with settings etc. becoming corrupt.
49
  * Call setup_defaults for users who update from backupwordpress 0.4.5 so they get new settings.