BackUpWordPress - Version 1.4

Version Description

Download this release

Release Info

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

Code changes from version 1.3.2 to 1.4

admin.actions.php CHANGED
@@ -1,5 +1,106 @@
1
  <?php
2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  /**
4
  * Delete the backup and then redirect
5
  * back to the backups page
@@ -27,8 +128,16 @@ function hmbkp_request_do_backup() {
27
  if ( !isset( $_GET['action'] ) || $_GET['action'] !== 'hmbkp_backup_now' || hmbkp_is_in_progress() || !hmbkp_possible() )
28
  return false;
29
 
 
 
 
 
 
 
 
 
30
  // Schedule a single backup
31
- wp_schedule_single_event( time(), 'hmbkp_schedule_single_backup_hook' );
32
 
33
  // Remove the once every 60 seconds limitation
34
  delete_transient( 'doing_cron' );
@@ -36,6 +145,8 @@ function hmbkp_request_do_backup() {
36
  // Fire the cron now
37
  spawn_cron();
38
 
 
 
39
  // Redirect back
40
  wp_redirect( remove_query_arg( 'action' ), 303 );
41
  exit;
@@ -116,20 +227,20 @@ add_action( 'wp_ajax_hmbkp_cron_test', 'hmbkp_ajax_cron_test' );
116
  function hmbkp_constant_changes() {
117
 
118
  // Check whether we need to disable the cron
119
- if ( defined( 'HMBKP_DISABLE_AUTOMATIC_BACKUP' ) && HMBKP_DISABLE_AUTOMATIC_BACKUP && wp_next_scheduled( 'hmbkp_schedule_backup_hook' ) )
120
  wp_clear_scheduled_hook( 'hmbkp_schedule_backup_hook' );
121
 
122
  // Or whether we need to re-enable it
123
- if ( ( defined( 'HMBKP_DISABLE_AUTOMATIC_BACKUP' ) && !HMBKP_DISABLE_AUTOMATIC_BACKUP || !defined( 'HMBKP_DISABLE_AUTOMATIC_BACKUP' ) ) && !wp_next_scheduled( 'hmbkp_schedule_backup_hook' ) )
124
- hmbkp_setup_daily_schedule();
125
 
126
  // Allow the time of the daily backup to be changed
127
- if ( defined( 'HMBKP_DAILY_SCHEDULE_TIME' ) && HMBKP_DAILY_SCHEDULE_TIME && wp_next_scheduled( 'hmbkp_schedule_backup_hook' ) != strtotime( HMBKP_DAILY_SCHEDULE_TIME ) && wp_next_scheduled( 'hmbkp_schedule_backup_hook' ) )
128
- hmbkp_setup_daily_schedule();
129
 
130
  // Reset if custom time is removed
131
- if ( ( ( defined( 'HMBKP_DAILY_SCHEDULE_TIME' ) && !HMBKP_DAILY_SCHEDULE_TIME ) || !defined( 'HMBKP_DAILY_SCHEDULE_TIME' ) ) && date( 'H:i', wp_next_scheduled( 'hmbkp_schedule_backup_hook' ) ) != '23:00' && ( defined( 'HMBKP_DISABLE_AUTOMATIC_BACKUP' ) && !HMBKP_DISABLE_AUTOMATIC_BACKUP || !defined( 'HMBKP_DISABLE_AUTOMATIC_BACKUP' ) ) )
132
- hmbkp_setup_daily_schedule();
133
 
134
  // If a custom backup path has been set or changed
135
  if ( defined( 'HMBKP_PATH' ) && HMBKP_PATH && hmbkp_conform_dir( HMBKP_PATH ) != ( $from = hmbkp_conform_dir( get_option( 'hmbkp_path' ) ) ) )
1
  <?php
2
 
3
+ /**
4
+ * hmbkp_option_save function
5
+ *
6
+ * Verify & save all the options set on
7
+ * the backupwordpress advanced options page.
8
+ *
9
+ * Returns array of errors encountered when updating options.
10
+ * If no errors - returns false.
11
+ *
12
+ * Uses $_POST data
13
+ */
14
+ function hmbkp_option_save() {
15
+
16
+ if ( empty( $_POST['hmbkp_options_submit'] ) )
17
+ return;
18
+
19
+ check_admin_referer( 'hmbkp_options', 'hmbkp_options_nonce' );
20
+
21
+ global $hmbkp_errors;
22
+ $hmbkp_errors = new WP_Error;
23
+
24
+ // Disable Automatic backups
25
+ if ( isset( $_POST['hmbkp_automatic'] ) && ! (bool) $_POST['hmbkp_automatic'] ) {
26
+ update_option( 'hmbkp_disable_automatic_backup', 'true' );
27
+ wp_clear_scheduled_hook( 'hmbkp_schedule_backup_hook' );
28
+
29
+ } else {
30
+ delete_option( 'hmbkp_disable_automatic_backup');
31
+
32
+ }
33
+
34
+ // Update schedule frequency settings. Or reset to default of daily.
35
+ if ( isset( $_POST['hmbkp_frequency'] ) && $_POST['hmbkp_frequency'] != 'daily' )
36
+ update_option( 'hmbkp_schedule_frequency', esc_attr( $_POST['hmbkp_frequency'] ) );
37
+
38
+ else
39
+ delete_option( 'hmbkp_schedule_frequency' );
40
+
41
+ // Clear schedule if settings have changed.
42
+ if ( wp_get_schedule( 'hmbkp_schedule_backup_hook' ) != get_option( 'hmbkp_schedule_frequency' ) )
43
+ wp_clear_scheduled_hook( 'hmbkp_schedule_backup_hook' );
44
+
45
+ if ( isset( $_POST['hmbkp_what_to_backup'] ) && $_POST['hmbkp_what_to_backup'] == 'files only' ) {
46
+
47
+ update_option( 'hmbkp_files_only', 'true' );
48
+ delete_option( 'hmbkp_database_only' );
49
+
50
+ } elseif ( isset( $_POST['hmbkp_what_to_backup'] ) && $_POST['hmbkp_what_to_backup'] == 'database only' ) {
51
+
52
+ update_option( 'hmbkp_database_only', 'true' );
53
+ delete_option( 'hmbkp_files_only' );
54
+
55
+ } else {
56
+
57
+ delete_option( 'hmbkp_database_only' );
58
+ delete_option( 'hmbkp_files_only' );
59
+
60
+ }
61
+
62
+ if ( isset( $_POST['hmbkp_backup_number'] ) && $max_backups = intval( $_POST['hmbkp_backup_number'] ) ) {
63
+ update_option( 'hmbkp_max_backups', intval( esc_attr( $_POST['hmbkp_backup_number'] ) ) );
64
+
65
+ } else {
66
+ delete_option( 'hmbkp_max_backups' );
67
+
68
+ // Only error if it is actually empty.
69
+ if ( isset( $_POST['hmbkp_backup_number'] ) )
70
+ $hmbkp_errors->add( 'invalid_no_backups', __( 'You have entered an invalid number of backups.', 'hmbkp' ) );
71
+
72
+ }
73
+
74
+ if ( isset( $_POST['hmbkp_email_address'] ) && !is_email( $_POST['hmbkp_email_address'] ) && !empty( $_POST['hmbkp_email_address'] ) ) {
75
+ $hmbkp_errors->add( 'invalid_email', __( 'You have entered an invalid email address.', 'hmbkp' ) );
76
+
77
+ } elseif( isset( $_POST['hmbkp_email_address'] ) && !empty( $_POST['hmbkp_email_address'] ) ) {
78
+ update_option( 'hmbkp_email_address', $_POST['hmbkp_email_address'] );
79
+
80
+ } else {
81
+ delete_option( 'hmbkp_email_address' );
82
+ }
83
+
84
+ if ( isset( $_POST['hmbkp_excludes'] ) && !empty( $_POST['hmbkp_excludes'] ) ) {
85
+
86
+ update_option( 'hmbkp_excludes', $_POST['hmbkp_excludes'] );
87
+ delete_transient( 'hmbkp_estimated_filesize');
88
+
89
+ } else {
90
+
91
+ delete_option( 'hmbkp_excludes' );
92
+ delete_transient( 'hmbkp_estimated_filesize' );
93
+
94
+ }
95
+
96
+ if ( $hmbkp_errors->get_error_code() )
97
+ return $hmbkp_errors;
98
+
99
+ return true;
100
+
101
+ }
102
+ add_action( 'admin_init', 'hmbkp_option_save', 11 );
103
+
104
  /**
105
  * Delete the backup and then redirect
106
  * back to the backups page
128
  if ( !isset( $_GET['action'] ) || $_GET['action'] !== 'hmbkp_backup_now' || hmbkp_is_in_progress() || !hmbkp_possible() )
129
  return false;
130
 
131
+ // If cron is disabled for manual backups
132
+ if ( ( defined( 'HMBKP_DISABLE_MANUAL_BACKUP_CRON' ) && HMBKP_DISABLE_MANUAL_BACKUP_CRON ) || ( defined( 'DISABLE_WP_CRON' ) && DISABLE_WP_CRON ) ) {
133
+
134
+ hmbkp_do_backup();
135
+
136
+ // If not fire the cron
137
+ } else {
138
+
139
  // Schedule a single backup
140
+ wp_schedule_single_event( time(), 'hmbkp_schedule_single_backup_hook' );
141
 
142
  // Remove the once every 60 seconds limitation
143
  delete_transient( 'doing_cron' );
145
  // Fire the cron now
146
  spawn_cron();
147
 
148
+ }
149
+
150
  // Redirect back
151
  wp_redirect( remove_query_arg( 'action' ), 303 );
152
  exit;
227
  function hmbkp_constant_changes() {
228
 
229
  // Check whether we need to disable the cron
230
+ if ( hmbkp_get_disable_automatic_backup() && wp_next_scheduled( 'hmbkp_schedule_backup_hook' ) )
231
  wp_clear_scheduled_hook( 'hmbkp_schedule_backup_hook' );
232
 
233
  // Or whether we need to re-enable it
234
+ if ( !hmbkp_get_disable_automatic_backup() && !wp_next_scheduled( 'hmbkp_schedule_backup_hook' ) )
235
+ hmbkp_setup_schedule();
236
 
237
  // Allow the time of the daily backup to be changed
238
+ if ( wp_get_schedule( 'hmbkp_schedule_backup_hook' ) != get_option( 'hmbkp_schedule_frequency' ) )
239
+ hmbkp_setup_schedule();
240
 
241
  // Reset if custom time is removed
242
+ if ( ( ( defined( 'HMBKP_DAILY_SCHEDULE_TIME' ) && !HMBKP_DAILY_SCHEDULE_TIME ) || !defined( 'HMBKP_DAILY_SCHEDULE_TIME' ) ) && get_option( 'hmbkp_schedule_frequency' ) == 'daily' && date( 'H:i', wp_next_scheduled( 'hmbkp_schedule_backup_hook' ) ) != '23:00' && !hmbkp_get_disable_automatic_backup() )
243
+ hmbkp_setup_schedule();
244
 
245
  // If a custom backup path has been set or changed
246
  if ( defined( 'HMBKP_PATH' ) && HMBKP_PATH && hmbkp_conform_dir( HMBKP_PATH ) != ( $from = hmbkp_conform_dir( get_option( 'hmbkp_path' ) ) ) )
admin.advanced-options.php CHANGED
@@ -33,9 +33,12 @@
33
  <dt<?php if ( defined( 'HMBKP_EMAIL' ) ) { ?> class="hmbkp_active"<?php } ?>><code>HMBKP_EMAIL</code></dt>
34
  <dd><p><?php printf( __( 'Attempt to email a copy of your backups. Value should be email address to send backups to. Defaults to %s.', 'hmbkp' ), '<code>(bool) false</code>' ); ?><p class="example">e.g. <code>define( 'HMBKP_EMAIL', 'email@example.com' );</code></p></dd>
35
 
36
- <dt<?php if ( defined( 'HMBKP_EXCLUDE' ) ) { ?> class="hmbkp_active"<?php } ?>><code>HMBKP_EXCLUDE</code></dt>
37
  <dd><p><?php _e( 'Comma separated list of files or directories to exclude, the backups directory is automatically excluded.', 'hmbkp' ); ?><p class="example">e.g. <code>define( 'HMBKP_EXCLUDE', '/wp-content/uploads/, /stats/, .svn/, *.txt' );</code></p></dd>
38
 
 
 
 
39
  </dl>
40
 
41
  </div>
33
  <dt<?php if ( defined( 'HMBKP_EMAIL' ) ) { ?> class="hmbkp_active"<?php } ?>><code>HMBKP_EMAIL</code></dt>
34
  <dd><p><?php printf( __( 'Attempt to email a copy of your backups. Value should be email address to send backups to. Defaults to %s.', 'hmbkp' ), '<code>(bool) false</code>' ); ?><p class="example">e.g. <code>define( 'HMBKP_EMAIL', 'email@example.com' );</code></p></dd>
35
 
36
+ <dt<?php if ( hmbkp_get_excludes() ) { ?> class="hmbkp_active"<?php } ?>><code>HMBKP_EXCLUDE</code></dt>
37
  <dd><p><?php _e( 'Comma separated list of files or directories to exclude, the backups directory is automatically excluded.', 'hmbkp' ); ?><p class="example">e.g. <code>define( 'HMBKP_EXCLUDE', '/wp-content/uploads/, /stats/, .svn/, *.txt' );</code></p></dd>
38
 
39
+ <dt<?php if ( defined( 'HMBKP_DISABLE_MANUAL_BACKUP_CRON' ) ) { ?> class="hmbkp_active"<?php } ?>><code>HMBKP_DISABLE_MANUAL_BACKUP_CRON</code></dt>
40
+ <dd><p><?php _e( 'Disable the use of wp-cron for manual backups.', 'hmbkp' ); ?><p class="example">e.g. <code>define( 'HMBKP_DISABLE_MANUAL_BACKUP_CRON', true );</code></p></dd>
41
+
42
  </dl>
43
 
44
  </div>
admin.menus.php CHANGED
@@ -25,15 +25,14 @@ function hmbkp_manage_backups() {
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 );
36
-
37
  /**
38
  * Add Contextual Help to Backups tools page.
39
  *
@@ -49,10 +48,11 @@ add_filter('plugin_action_links', 'hmbkp_plugin_action_link', 10, 2 );
49
  $plugin = plugins_api( 'plugin_information', array( 'slug' => 'backupwordpress' ) );
50
 
51
  // Check if help is for the right version.
52
- if ( version_compare( HMBKP_VERSION, $plugin->version, '!=' ) )
53
  $contextual_help = sprintf( '<p><strong>' . __( 'You are not using the latest stable version of BackUpWordPress', 'hmbkp' ) . '</strong>' . __( ' &mdash; The information below is for version %s. View the readme.txt file for help specific to version %s.', 'hmbkp' ) . '</p>', '<code>' . $plugin->version . '</code>', '<code>' . HMBKP_VERSION . '</code>' );
54
 
55
- $contextual_help .= $plugin->sections['faq'];
 
56
 
57
  endif;
58
 
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 );
 
36
  /**
37
  * Add Contextual Help to Backups tools page.
38
  *
48
  $plugin = plugins_api( 'plugin_information', array( 'slug' => 'backupwordpress' ) );
49
 
50
  // Check if help is for the right version.
51
+ if ( ! empty( $plugin->version ) && version_compare( HMBKP_VERSION, $plugin->version, '!=' ) )
52
  $contextual_help = sprintf( '<p><strong>' . __( 'You are not using the latest stable version of BackUpWordPress', 'hmbkp' ) . '</strong>' . __( ' &mdash; The information below is for version %s. View the readme.txt file for help specific to version %s.', 'hmbkp' ) . '</p>', '<code>' . $plugin->version . '</code>', '<code>' . HMBKP_VERSION . '</code>' );
53
 
54
+ if( ! empty( $plugin->sections['faq'] ) )
55
+ $contextual_help .= $plugin->sections['faq'];
56
 
57
  endif;
58
 
admin.page.php CHANGED
@@ -14,7 +14,7 @@
14
 
15
  <?php endif; ?>
16
 
17
- <a href="#hmbkp_advanced-options" class="add-new-h2 hmbkp_advanced-options-toggle"><?php _e( 'Advanced Options' ); ?></a>
18
 
19
  </h2>
20
 
@@ -30,7 +30,7 @@
30
 
31
  <?php endif; ?>
32
 
33
- <?php include_once( HMBKP_PLUGIN_PATH . '/admin.advanced-options.php' ); ?>
34
 
35
  <p class="howto"><?php printf( __( 'If you need help getting things working you are more than welcome to email us at %s and we\'ll do what we can to help.', 'hmbkp' ), '<a href="mailto:support@humanmade.co.uk">support@humanmade.co.uk</a>' ); ?></p>
36
 
14
 
15
  <?php endif; ?>
16
 
17
+ <a href="#hmbkp_advanced-options" class="add-new-h2 hmbkp_advanced-options-toggle"><?php _e( 'Advanced Options', 'hmbkp' ); ?></a>
18
 
19
  </h2>
20
 
30
 
31
  <?php endif; ?>
32
 
33
+ <?php include_once( HMBKP_PLUGIN_PATH . '/admin.settings.php' ); ?>
34
 
35
  <p class="howto"><?php printf( __( 'If you need help getting things working you are more than welcome to email us at %s and we\'ll do what we can to help.', 'hmbkp' ), '<a href="mailto:support@humanmade.co.uk">support@humanmade.co.uk</a>' ); ?></p>
36
 
admin.settings.php ADDED
@@ -0,0 +1,98 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div id="hmbkp_advanced-options" <?php if ( !hmbkp_get_backups() || !empty( $_POST['hmbkp_options_submit'] ) ) echo ' class="show_form"' ?>>
2
+
3
+ <h4><?php _e( 'Advanced Options', 'hmbkp' ); ?></h4>
4
+
5
+ <p><?php printf( __( 'You can still define %s in your %s to control some settings. A full list of %s can be found in the readme. Defined settings will not be editable below.', 'hmbkp' ), '<code>Constants</code>', '<code>wp-config.php</code>', '<code>Constants</code>' ); ?></p>
6
+
7
+ <form method="post">
8
+
9
+ <?php wp_nonce_field( 'hmbkp_options', 'hmbkp_options_nonce' ); ?>
10
+
11
+ <table class="form-table">
12
+ <tbody>
13
+
14
+ <tr align="top">
15
+
16
+ <th scope="row"><?php _e( 'Automatic Backups', 'hmbkp' ); ?></th>
17
+
18
+ <td>
19
+
20
+ <label for="hmbkp_automatic_on">
21
+ <input name="hmbkp_automatic" type="radio" id="hmbkp_automatic_on" value="1" <?php checked( !hmbkp_get_disable_automatic_backup() ); ?> <?php disabled( defined( 'HMBKP_DISABLE_AUTOMATIC_BACKUP' ) ); ?>>
22
+ <?php _e( 'Backup my site automatically.', 'hmbkp' ); ?>
23
+ </label><br/>
24
+
25
+ <label for="hmbkp_automatic_off">
26
+ <input name="hmbkp_automatic" type="radio" id="hmbkp_automatic_off" value="0" <?php checked( hmbkp_get_disable_automatic_backup() ); ?> <?php disabled( defined( 'HMBKP_DISABLE_AUTOMATIC_BACKUP' ) ); ?>>
27
+ <?php _e( 'No automatic backups.', 'hmbkp' ); ?>
28
+ </label>
29
+
30
+ </td>
31
+
32
+ </tr>
33
+
34
+ <tr align="top">
35
+
36
+ <th scope="row"><label for="hmbkp_frequency"><?php _e( 'Frequency of backups', 'hmbkp' ); ?></label></th>
37
+
38
+ <td>
39
+
40
+ <?php _e( 'Automatic backups will occur', 'hmbkp' ); ?>
41
+
42
+ <select name="hmbkp_frequency" id="hmbkp_frequency">
43
+ <option value="daily" <?php selected( !get_option( 'hmbkp_schedule_frequency' ) ); ?>><?php _e( 'Daily', 'hmbkp' ); ?></option>
44
+ <option value="hmbkp_weekly" <?php selected( get_option( 'hmbkp_schedule_frequency' ), 'hmbkp_weekly' ); ?>><?php _e( 'Weekly', 'hmbkp' ); ?></option>
45
+ <option value="hmbkp_fortnightly" <?php selected( get_option( 'hmbkp_schedule_frequency' ), 'hmbkp_fortnightly' ); ?>><?php _e( 'Fortnightly', 'hmbkp' ); ?></option>
46
+ <option value="hmbkp_monthly" <?php selected( get_option( 'hmbkp_schedule_frequency' ), 'hmbkp_monthly' ); ?>><?php _e( 'Monthly', 'hmbkp' ); ?></option>
47
+ </select>
48
+
49
+ </td>
50
+
51
+ </tr>
52
+
53
+ <tr align="top">
54
+
55
+ <th scope="row"><label for="hmbkp_what_to_backup"><?php _e( 'What to Backup', 'hmbkp' ); ?></label></th>
56
+
57
+ <td>
58
+
59
+ <?php _e( 'Backup my', 'hmbkp' ); ?>
60
+
61
+ <select name="hmbkp_what_to_backup" id="hmbkp_what_to_backup" <?php disabled( defined( 'HMBKP_FILES_ONLY' ) || defined( 'HMBKP_DATABASE_ONLY' ) ); ?>>
62
+ <option value="default" <?php selected( !get_option( 'hmbkp_files_only' ) && !get_option( 'hmbkp_database_only' ) ); ?>><?php _e( 'database &amp; files', 'hmbkp' ); ?></option>
63
+ <option <?php selected( hmbkp_get_database_only() ); ?>><?php _e( 'database only', 'hmbkp' ); ?></option>
64
+ <option <?php selected( hmbkp_get_files_only() ); ?>><?php _e( 'files only', 'hmbkp' ); ?></option>
65
+ </select>
66
+
67
+ </td>
68
+
69
+ </tr>
70
+
71
+ <tr align="top">
72
+ <th scope="row"><label for="hmbkp_backup_number"><?php _e( 'Number of backups', 'hmbkp' ); ?></label></th>
73
+ <td><label for="hmbkp_backup_number"><?php printf( __( 'The last %s backups will be stored on the server.', 'hmbkp' ), '<input type="text" class="small-text ' . ( defined( 'HMBKP_MAX_BACKUPS' ) ? 'disabled' : '' ) . '" value="' . hmbkp_max_backups() . '" id="hmbkp_backup_number" name="hmbkp_backup_number"' . disabled( defined( 'HMBKP_MAX_BACKUPS' ), true, false ) . '>' ); ?></label></td>
74
+ </tr>
75
+
76
+ <tr valign="top">
77
+ <th scope="row"><label for="hmbkp_email_address"><?php _e( 'Email backups', 'hmbkp' ); ?></label></th>
78
+ <td><input name="hmbkp_email_address" type="text" id="hmbkp_email_address" value="<?php echo hmbkp_get_email_address(); ?>" class="regular-text <?php if ( defined( 'HMBKP_EMAIL' ) ) echo 'disabled'; ?>" <?php disabled( defined( 'HMBKP_EMAIL' ) ); ?>> <span class="description"><?php _e( 'A copy of the backup file will be emailed to this address. Disabled if left blank.', 'hmbkp' ); ?></span></td>
79
+ </tr>
80
+
81
+ <tr align="top">
82
+ <th scope="row"><label for="hmbkp_excludes"><?php _e( 'Excludes', 'hmbkp' ); ?></th>
83
+ <td>
84
+ <textarea class="code large-text<?php if ( defined( 'HMBKP_EXCLUDE' ) || hmbkp_get_database_only() ) echo ' disabled' ?>" name="hmbkp_excludes" id="hmbkp_excludes" <?php disabled( defined( 'HMBKP_EXCLUDE' ) || hmbkp_get_database_only() ); ?>><?php echo hmbkp_get_excludes(); ?></textarea>
85
+ <span class="description"><?php _e( 'A comma separated list of file and directory paths that you do <strong>not</strong> want to backup.', 'hmbkp' ); ?></span><br/>
86
+ <?php _e( 'e.g.', 'hmbkp' ); ?> <code>file.php, /directory/, /directory/file.jpg</code>
87
+ </td>
88
+ </tr>
89
+
90
+ </tbody>
91
+
92
+ </table>
93
+
94
+ <p class="submit"><input type="submit" name="hmbkp_options_submit" id="submit" class="button-primary" value="Save Changes"></p>
95
+
96
+ </form>
97
+
98
+ </div>
admin.status.php CHANGED
@@ -1,46 +1,58 @@
 
 
 
 
 
1
  <p>&#10003;
2
 
3
- <?php if ( defined( 'HMBKP_DISABLE_AUTOMATIC_BACKUP' ) && HMBKP_DISABLE_AUTOMATIC_BACKUP && !wp_next_scheduled( 'hmbkp_schedule_backup_hook' ) ) : ?>
4
 
5
  <?php printf( __( 'Automatic backups are %s.', 'hmbkp' ), '<strong>' . __( 'disabled', 'hmbkp' ) . '</strong>' ); ?>
6
 
7
  <?php else :
8
 
9
- if ( ( defined( 'HMBKP_FILES_ONLY' ) && !HMBKP_FILES_ONLY || !defined( 'HMBKP_FILES_ONLY' ) ) && ( defined( 'HMBKP_DATABASE_ONLY' ) && !HMBKP_DATABASE_ONLY || !defined( 'HMBKP_DATABASE_ONLY' ) ) )
10
  $what_to_backup = '<code>' . __( 'database', 'hmbkp' ) . '</code> ' . __( '&amp;', 'hmbkp' ) . ' <code>' . __( 'files', 'hmbkp' ) . '</code>';
11
 
12
- elseif( defined( 'HMBKP_DATABASE_ONLY' ) && HMBKP_DATABASE_ONLY )
13
  $what_to_backup = '<code>' . __( 'database', 'hmbkp' ) . '</code>';
14
 
15
  else
16
  $what_to_backup = '<code>' . __( 'files', 'hmbkp' ) . '</code>'; ?>
17
 
18
- <?php printf( __( 'Your %s will be automatically backed up every day at %s to %s.', 'hmbkp' ), $what_to_backup , '<code title="' . sprintf( __( 'It\'s currently %s on the server.', 'hmbkp' ), date( 'H:i' ) ) . '">' . date( 'H:i', wp_next_scheduled( 'hmbkp_schedule_backup_hook' ) ) . '</code>', '<code>' . hmbkp_path() . '</code>' ); ?>
 
 
 
19
 
20
  <?php endif; ?>
21
 
 
 
22
  <p>&#10003; <span class="hmbkp_estimated-size"><?php printf( __( 'Your site is %s. Backups will be compressed and should be smaller than this.', 'hmbkp' ), get_transient( 'hmbkp_estimated_filesize' ) ? '<code>' . hmbkp_calculate() . '</code>' : '<code class="calculate">' . __( 'Calculating Size...', 'hmbkp' ) . '</code>' ); ?></span></p>
23
 
24
  <?php if ( !hmbkp_shell_exec_available() ) : ?>
25
- <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>' ); ?>
26
  <?php endif; ?>
27
 
28
  <?php if ( hmbkp_shell_exec_available() ) : ?>
29
 
30
- <?php if ( hmbkp_zip_path() && ( defined( 'HMBKP_DATABASE_ONLY' ) && !HMBKP_DATABASE_ONLY || !defined( 'HMBKP_DATABASE_ONLY' ) ) ) : ?>
31
  <p>&#10003; <?php printf( __( 'Your %s will be backed up using %s.', 'hmbkp' ), '<code>' . __( 'files', 'hmbkp' ) . '</code>', '<code>' . hmbkp_zip_path() . '</code>' ); ?></p>
32
  <?php endif; ?>
33
 
34
- <?php if ( hmbkp_mysqldump_path() && ( defined( 'HMBKP_FILES_ONLY' ) && !HMBKP_FILES_ONLY || !defined( 'HMBKP_FILES_ONLY' ) ) ) : ?>
35
  <p>&#10003; <?php printf( __( 'Your %s will be backed up using %s.', 'hmbkp' ), '<code>' . __( 'database', 'hmbkp' ) . '</code>', '<code>' . hmbkp_mysqldump_path() . '</code>' ); ?></p>
36
  <?php endif; ?>
37
 
38
  <?php endif; ?>
39
 
40
- <?php if ( defined( 'HMBKP_EMAIL' ) && HMBKP_EMAIL && is_email( HMBKP_EMAIL ) ) : ?>
41
- <p>&#10003; <?php printf( __( 'A copy of each backup will be emailed to %s.', 'hmbkp' ), '<code>' . HMBKP_EMAIL . '</code>' ); ?></p>
42
  <?php endif; ?>
43
 
44
- <?php if ( ( $valid_excludes = hmbkp_valid_custom_excludes() ) && ( !defined( 'HMBKP_DATABASE_ONLY' ) || ( defined( 'HMBKP_DATABASE_ONLY' ) && !HMBKP_DATABASE_ONLY ) ) ) : ?>
 
 
45
  <p>&#10003; <?php printf( __( 'The following paths will be excluded from your backups %s.', 'hmbkp' ), '<code>' . implode( '</code>, <code>', $valid_excludes ) . '</code>' ); ?></p>
46
  <?php endif; ?>
1
+ <?php // If the form has been submitted, things may have changed.
2
+ if ( ( !empty( $_POST['hmbkp_options_submit'] ) ) && ( !wp_next_scheduled('hmbkp_schedule_backup_hook') || hmbkp_get_disable_automatic_backup() ) ) {
3
+ hmbkp_constant_changes();
4
+ } ?>
5
+
6
  <p>&#10003;
7
 
8
+ <?php if ( hmbkp_get_disable_automatic_backup() && !wp_next_scheduled( 'hmbkp_schedule_backup_hook' ) ) : ?>
9
 
10
  <?php printf( __( 'Automatic backups are %s.', 'hmbkp' ), '<strong>' . __( 'disabled', 'hmbkp' ) . '</strong>' ); ?>
11
 
12
  <?php else :
13
 
14
+ if ( !hmbkp_get_database_only() && !hmbkp_get_files_only() )
15
  $what_to_backup = '<code>' . __( 'database', 'hmbkp' ) . '</code> ' . __( '&amp;', 'hmbkp' ) . ' <code>' . __( 'files', 'hmbkp' ) . '</code>';
16
 
17
+ elseif( hmbkp_get_database_only() )
18
  $what_to_backup = '<code>' . __( 'database', 'hmbkp' ) . '</code>';
19
 
20
  else
21
  $what_to_backup = '<code>' . __( 'files', 'hmbkp' ) . '</code>'; ?>
22
 
23
+ <?php $offset = current_time( 'timestamp' ) - time();
24
+ $schedules = wp_get_schedules();
25
+ $schedule = $schedules[ wp_get_schedule('hmbkp_schedule_backup_hook') ]['display'];
26
+ printf( __( 'Your %s will be automatically backed up <code>%s</code>. The next backup will occur at %s on %s and be saved to %s.', 'hmbkp' ), $what_to_backup , $schedule, '<code>' . date_i18n( get_option( 'time_format' ), wp_next_scheduled( 'hmbkp_schedule_backup_hook' ) + $offset ) . '</code>', '<code title="' . sprintf( __( 'It\'s currently %s', 'hmbkp' ), date_i18n( get_option( 'time_format' ) ) ) . '">' . date_i18n( get_option( 'date_format' ), wp_next_scheduled( 'hmbkp_schedule_backup_hook' ) + $offset ) . '</code>', '<code>' . hmbkp_path() . '</code>' ); ?>
27
 
28
  <?php endif; ?>
29
 
30
+ </p>
31
+
32
  <p>&#10003; <span class="hmbkp_estimated-size"><?php printf( __( 'Your site is %s. Backups will be compressed and should be smaller than this.', 'hmbkp' ), get_transient( 'hmbkp_estimated_filesize' ) ? '<code>' . hmbkp_calculate() . '</code>' : '<code class="calculate">' . __( 'Calculating Size...', 'hmbkp' ) . '</code>' ); ?></span></p>
33
 
34
  <?php if ( !hmbkp_shell_exec_available() ) : ?>
35
+ <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>' ); ?></p>
36
  <?php endif; ?>
37
 
38
  <?php if ( hmbkp_shell_exec_available() ) : ?>
39
 
40
+ <?php if ( hmbkp_zip_path() && !hmbkp_get_database_only() ) : ?>
41
  <p>&#10003; <?php printf( __( 'Your %s will be backed up using %s.', 'hmbkp' ), '<code>' . __( 'files', 'hmbkp' ) . '</code>', '<code>' . hmbkp_zip_path() . '</code>' ); ?></p>
42
  <?php endif; ?>
43
 
44
+ <?php if ( hmbkp_mysqldump_path() && !hmbkp_get_files_only() ) : ?>
45
  <p>&#10003; <?php printf( __( 'Your %s will be backed up using %s.', 'hmbkp' ), '<code>' . __( 'database', 'hmbkp' ) . '</code>', '<code>' . hmbkp_mysqldump_path() . '</code>' ); ?></p>
46
  <?php endif; ?>
47
 
48
  <?php endif; ?>
49
 
50
+ <?php if ( hmbkp_get_email_address() ) : ?>
51
+ <p>&#10003; <?php printf( __( 'A copy of each backup will be emailed to %s.', 'hmbkp' ), '<code>' . hmbkp_get_email_address() . '</code>' ); ?></p>
52
  <?php endif; ?>
53
 
54
+ <?php hmbkp_valid_custom_excludes(); ?>
55
+
56
+ <?php if ( ( $valid_excludes = hmbkp_valid_custom_excludes() ) && !hmbkp_get_database_only() ) : ?>
57
  <p>&#10003; <?php printf( __( 'The following paths will be excluded from your backups %s.', 'hmbkp' ), '<code>' . implode( '</code>, <code>', $valid_excludes ) . '</code>' ); ?></p>
58
  <?php endif; ?>
assets/hmbkp.css CHANGED
@@ -3,6 +3,7 @@
3
  .add-new-h2[disabled="disabled"], add-new-h2[disabled="disabled"]:hover, .add-new-h2[disabled="disabled"]:active, .add-new-h2[disabled="disabled"]:focus { cursor: default; color: #666; }
4
  tfoot p { margin: 0; font-weight: normal; }
5
  #hmbkp_advanced-options { display: none; }
 
6
  #hmbkp_advanced-options dl { overflow: hidden; margin: 20px 0; }
7
  #hmbkp_advanced-options dt { float: left; min-width: 250px; clear: both; padding: 6px; margin: 1px 0; cursor: pointer; }
8
  #hmbkp_advanced-options dd { color: #666; padding: 7px 0 7px 250px; border-top: 1px solid #DFDFDF; margin: 0; cursor: pointer; min-height: 34px; }
3
  .add-new-h2[disabled="disabled"], add-new-h2[disabled="disabled"]:hover, .add-new-h2[disabled="disabled"]:active, .add-new-h2[disabled="disabled"]:focus { cursor: default; color: #666; }
4
  tfoot p { margin: 0; font-weight: normal; }
5
  #hmbkp_advanced-options { display: none; }
6
+ #hmbkp_advanced-options.show_form { display: block; }
7
  #hmbkp_advanced-options dl { overflow: hidden; margin: 20px 0; }
8
  #hmbkp_advanced-options dt { float: left; min-width: 250px; clear: both; padding: 6px; margin: 1px 0; cursor: pointer; }
9
  #hmbkp_advanced-options dd { color: #666; padding: 7px 0 7px 250px; border-top: 1px solid #DFDFDF; margin: 0; cursor: pointer; min-height: 34px; }
assets/hmbkp.js CHANGED
@@ -25,6 +25,11 @@ jQuery( document ).ready( function( $ ) {
25
  $( '.hmbkp_advanced-options-toggle' ).click( function() {
26
  $( '#hmbkp_advanced-options' ).toggle();
27
  } );
 
 
 
 
 
28
 
29
  } );
30
 
25
  $( '.hmbkp_advanced-options-toggle' ).click( function() {
26
  $( '#hmbkp_advanced-options' ).toggle();
27
  } );
28
+
29
+ if( window.location.hash == '#hmbkp_advanced-options' ){
30
+ $( '#hmbkp_advanced-options' ).css( 'display', 'block' );
31
+ }
32
+
33
 
34
  } );
35
 
functions/backup.files.fallback.functions.php CHANGED
@@ -16,11 +16,11 @@ function hmbkp_archive_files_fallback( $path ) {
16
  $archive = new PclZip( $path );
17
 
18
  // Zip up everything
19
- if ( ( defined( 'HMBKP_DATABASE_ONLY' ) && !HMBKP_DATABASE_ONLY ) || !defined( 'HMBKP_DATABASE_ONLY' ) )
20
  $archive->create( ABSPATH, PCLZIP_OPT_REMOVE_PATH, ABSPATH, PCLZIP_CB_PRE_ADD, 'hmbkp_pclzip_exclude' );
21
 
22
  // Only zip up the database
23
- if ( defined( 'HMBKP_DATABASE_ONLY' ) && HMBKP_DATABASE_ONLY )
24
  $archive->create( hmbkp_path() . '/database_' . DB_NAME . '.sql', PCLZIP_OPT_REMOVE_PATH, hmbkp_path() );
25
 
26
  }
@@ -45,7 +45,7 @@ function hmbkp_pclzip_exclude( $event, &$file ) {
45
  // Match everything else past the exclude list
46
  elseif ( preg_match( '(' . $excludes . ')', $file['stored_filename'] ) )
47
  return false;
48
-
49
  // Don't try to add unreadable files.
50
  if ( !is_readable( $file['filename'] ) )
51
  return false;
16
  $archive = new PclZip( $path );
17
 
18
  // Zip up everything
19
+ if ( ! hmbkp_get_database_only() )
20
  $archive->create( ABSPATH, PCLZIP_OPT_REMOVE_PATH, ABSPATH, PCLZIP_CB_PRE_ADD, 'hmbkp_pclzip_exclude' );
21
 
22
  // Only zip up the database
23
+ if ( hmbkp_get_database_only() )
24
  $archive->create( hmbkp_path() . '/database_' . DB_NAME . '.sql', PCLZIP_OPT_REMOVE_PATH, hmbkp_path() );
25
 
26
  }
45
  // Match everything else past the exclude list
46
  elseif ( preg_match( '(' . $excludes . ')', $file['stored_filename'] ) )
47
  return false;
48
+
49
  // Don't try to add unreadable files.
50
  if ( !is_readable( $file['filename'] ) )
51
  return false;
functions/backup.files.functions.php CHANGED
@@ -13,10 +13,10 @@ function hmbkp_archive_files( $path ) {
13
 
14
  // Do we have the path to the zip command
15
  if ( hmbkp_zip_path() ) :
16
-
17
  // Zip up ABSPATH
18
- if ( ( defined( 'HMBKP_DATABASE_ONLY' ) && !HMBKP_DATABASE_ONLY ) || !defined( 'HMBKP_DATABASE_ONLY' ) ) :
19
-
20
  $excludes = ' -x ' . hmbkp_exclude_string( 'zip' );
21
 
22
  shell_exec( 'cd ' . escapeshellarg( ABSPATH ) . ' && ' . escapeshellarg( hmbkp_zip_path() ) . ' -rq ' . escapeshellarg( $path ) . ' ./' . $excludes );
@@ -24,7 +24,7 @@ function hmbkp_archive_files( $path ) {
24
  endif;
25
 
26
  // Add the database dump to the archive
27
- if ( ( defined( 'HMBKP_FILES_ONLY' ) && !HMBKP_FILES_ONLY ) || !defined( 'HMBKP_FILES_ONLY' ) ) :
28
  shell_exec( 'cd ' . escapeshellarg( hmbkp_path() ) . ' && ' . escapeshellarg( hmbkp_zip_path() ) . ' -uq ' . escapeshellarg( $path ) . ' ' . escapeshellarg( 'database_' . DB_NAME . '.sql' ) );
29
  endif;
30
 
@@ -139,8 +139,8 @@ function hmbkp_exclude_string( $context = 'zip' ) {
139
  $excludes = hmbkp_excludes();
140
 
141
  // Add any defined excludes
142
- if ( defined( 'HMBKP_EXCLUDE' ) && HMBKP_EXCLUDE )
143
- $excludes = array_merge( explode( ',', HMBKP_EXCLUDE ), $excludes );
144
 
145
  $excludes = array_map( 'trim', $excludes );
146
 
@@ -212,9 +212,10 @@ function hmbkp_invalid_custom_excludes() {
212
  $invalid_rules = array();
213
 
214
  // Check if any absolute path excludes actually exist
215
- if ( defined( 'HMBKP_EXCLUDE' ) && HMBKP_EXCLUDE )
216
- foreach ( explode( ',', HMBKP_EXCLUDE ) as $rule )
217
- if ( ( $rule = trim( $rule ) ) && in_array( substr( $rule, 0, 1 ), array( '/', '\\' ) ) && !file_exists( $rule ) && !file_exists( ABSPATH . $rule ) && !file_exists( trailingslashit( ABSPATH ) . $rule ) )
 
218
  $invalid_rules[] = $rule;
219
 
220
  return $invalid_rules;
@@ -230,8 +231,12 @@ function hmbkp_valid_custom_excludes() {
230
 
231
  $valid_rules = array();
232
 
233
- if ( defined( 'HMBKP_EXCLUDE' ) && HMBKP_EXCLUDE )
234
- $valid_rules = array_diff( explode( ',', HMBKP_EXCLUDE ), hmbkp_invalid_custom_excludes() );
 
 
 
 
235
 
236
  return array_map( 'trim', $valid_rules );
237
 
13
 
14
  // Do we have the path to the zip command
15
  if ( hmbkp_zip_path() ) :
16
+
17
  // Zip up ABSPATH
18
+ if ( !hmbkp_get_database_only() ) :
19
+
20
  $excludes = ' -x ' . hmbkp_exclude_string( 'zip' );
21
 
22
  shell_exec( 'cd ' . escapeshellarg( ABSPATH ) . ' && ' . escapeshellarg( hmbkp_zip_path() ) . ' -rq ' . escapeshellarg( $path ) . ' ./' . $excludes );
24
  endif;
25
 
26
  // Add the database dump to the archive
27
+ if ( !hmbkp_get_files_only() ) :
28
  shell_exec( 'cd ' . escapeshellarg( hmbkp_path() ) . ' && ' . escapeshellarg( hmbkp_zip_path() ) . ' -uq ' . escapeshellarg( $path ) . ' ' . escapeshellarg( 'database_' . DB_NAME . '.sql' ) );
29
  endif;
30
 
139
  $excludes = hmbkp_excludes();
140
 
141
  // Add any defined excludes
142
+ if ( hmbkp_get_excludes() )
143
+ $excludes = array_merge( explode( ',', hmbkp_get_excludes() ), $excludes );
144
 
145
  $excludes = array_map( 'trim', $excludes );
146
 
212
  $invalid_rules = array();
213
 
214
  // Check if any absolute path excludes actually exist
215
+ if ( $excludes = hmbkp_get_excludes() )
216
+
217
+ foreach ( explode( ',', $excludes ) as $rule )
218
+ if ( ( $rule = trim( $rule ) ) && in_array( substr( $rule, 0, 1 ), array( '/', '\\' ) ) && !file_exists( $rule ) && ! file_exists( ABSPATH . $rule ) && ! file_exists( trailingslashit( ABSPATH ) . $rule ) )
219
  $invalid_rules[] = $rule;
220
 
221
  return $invalid_rules;
231
 
232
  $valid_rules = array();
233
 
234
+ $excludes = hmbkp_get_excludes();
235
+
236
+ if ( ! $excludes )
237
+ array();
238
+
239
+ $valid_rules = array_diff( explode( ',', $excludes ), hmbkp_invalid_custom_excludes() );
240
 
241
  return array_map( 'trim', $valid_rules );
242
 
functions/backup.functions.php CHANGED
@@ -19,31 +19,33 @@ function hmbkp_do_backup() {
19
  // Clean up any mess left by the last backup
20
  hmbkp_cleanup();
21
 
22
- $time_start = date( 'Y-m-d-H-i-s' );
 
23
 
24
  $filename = sanitize_file_name( get_bloginfo( 'name' ) . '.backup.' . $time_start . '.zip' );
25
  $filepath = trailingslashit( hmbkp_path() ) . $filename;
26
 
27
- // Set as running for a max of 1 hour
28
  hmbkp_set_status();
29
-
30
  // Raise the memory limit
31
  @ini_set( 'memory_limit', apply_filters( 'admin_memory_limit', '256M' ) );
32
  @set_time_limit( 0 );
33
-
 
34
  hmbkp_set_status( __( 'Dumping database', 'hmbkp' ) );
35
 
36
  // Backup database
37
- if ( ( defined( 'HMBKP_FILES_ONLY' ) && !HMBKP_FILES_ONLY ) || !defined( 'HMBKP_FILES_ONLY' ) )
38
  hmbkp_backup_mysql();
39
 
40
  hmbkp_set_status( __( 'Creating zip archive', 'hmbkp' ) );
41
-
42
  // Zip everything up
43
  hmbkp_archive_files( $filepath );
44
 
45
  // Delete the database dump file
46
- if ( ( defined( 'HMBKP_FILES_ONLY' ) && !HMBKP_FILES_ONLY ) || !defined( 'HMBKP_FILES_ONLY' ) )
47
  unlink( hmbkp_path() . '/database_' . DB_NAME . '.sql' );
48
 
49
  // Email Backup
@@ -54,7 +56,8 @@ function hmbkp_do_backup() {
54
  // Delete any old backup files
55
  hmbkp_delete_old_backups();
56
 
57
- unlink( hmbkp_path() . '/.backup_running' );
 
58
 
59
  $file = hmbkp_path() . '/.backup_complete';
60
 
@@ -157,7 +160,7 @@ function hmbkp_is_in_progress() {
157
  */
158
  function hmbkp_email_backup( $file ) {
159
 
160
- if ( !defined('HMBKP_EMAIL' ) || !HMBKP_EMAIL || !is_email( HMBKP_EMAIL ) )
161
  return;
162
 
163
  // Raise the memory and time limit
@@ -172,7 +175,7 @@ function hmbkp_email_backup( $file ) {
172
  $headers = 'From: BackUpWordPress <' . get_bloginfo( 'admin_email' ) . '>' . "\r\n";
173
 
174
  // Try to send the email
175
- $sent = wp_mail( HMBKP_EMAIL, $subject, $message, $headers, $file );
176
 
177
  // If it failed- Try to send a download link - The file was probably too large.
178
  if ( !$sent ) :
@@ -180,7 +183,7 @@ function hmbkp_email_backup( $file ) {
180
  $subject = sprintf( __( 'Backup of %s', 'hmbkp' ), $domain );
181
  $message = sprintf( __( "BackUpWordPress has completed a backup of your site %s.\n\nUnfortunately the backup file was too large to attach to this email.\n\nYou can download the backup file by clicking the link below:\n\n%s\n\nKind Regards\n\n The Happy BackUpWordPress Backup Emailing Robot", 'hmbkp' ), get_bloginfo( 'url' ), $download );
182
 
183
- $sent = wp_mail( HMBKP_EMAIL, $subject, $message, $headers );
184
 
185
  endif;
186
 
@@ -225,4 +228,4 @@ function hmbkp_get_status() {
225
 
226
  return file_get_contents( hmbkp_path() .'/.backup_running' );
227
 
228
- }
19
  // Clean up any mess left by the last backup
20
  hmbkp_cleanup();
21
 
22
+ $offset = current_time( 'timestamp' ) - time();
23
+ $time_start = date( 'Y-m-d-H-i-s', time() + $offset );
24
 
25
  $filename = sanitize_file_name( get_bloginfo( 'name' ) . '.backup.' . $time_start . '.zip' );
26
  $filepath = trailingslashit( hmbkp_path() ) . $filename;
27
 
28
+ // Set as running
29
  hmbkp_set_status();
30
+
31
  // Raise the memory limit
32
  @ini_set( 'memory_limit', apply_filters( 'admin_memory_limit', '256M' ) );
33
  @set_time_limit( 0 );
34
+
35
+ // Set running status
36
  hmbkp_set_status( __( 'Dumping database', 'hmbkp' ) );
37
 
38
  // Backup database
39
+ if ( !hmbkp_get_files_only() )
40
  hmbkp_backup_mysql();
41
 
42
  hmbkp_set_status( __( 'Creating zip archive', 'hmbkp' ) );
43
+
44
  // Zip everything up
45
  hmbkp_archive_files( $filepath );
46
 
47
  // Delete the database dump file
48
+ if ( file_exists( hmbkp_path() . '/database_' . DB_NAME . '.sql' ) )
49
  unlink( hmbkp_path() . '/database_' . DB_NAME . '.sql' );
50
 
51
  // Email Backup
56
  // Delete any old backup files
57
  hmbkp_delete_old_backups();
58
 
59
+ if ( file_exists( hmbkp_path() . '/.backup_running' ) )
60
+ unlink( hmbkp_path() . '/.backup_running' );
61
 
62
  $file = hmbkp_path() . '/.backup_complete';
63
 
160
  */
161
  function hmbkp_email_backup( $file ) {
162
 
163
+ if ( !hmbkp_get_email_address() )
164
  return;
165
 
166
  // Raise the memory and time limit
175
  $headers = 'From: BackUpWordPress <' . get_bloginfo( 'admin_email' ) . '>' . "\r\n";
176
 
177
  // Try to send the email
178
+ $sent = wp_mail( hmbkp_get_email_address(), $subject, $message, $headers, $file );
179
 
180
  // If it failed- Try to send a download link - The file was probably too large.
181
  if ( !$sent ) :
183
  $subject = sprintf( __( 'Backup of %s', 'hmbkp' ), $domain );
184
  $message = sprintf( __( "BackUpWordPress has completed a backup of your site %s.\n\nUnfortunately the backup file was too large to attach to this email.\n\nYou can download the backup file by clicking the link below:\n\n%s\n\nKind Regards\n\n The Happy BackUpWordPress Backup Emailing Robot", 'hmbkp' ), get_bloginfo( 'url' ), $download );
185
 
186
+ $sent = wp_mail( hmbkp_get_email_address(), $subject, $message, $headers );
187
 
188
  endif;
189
 
228
 
229
  return file_get_contents( hmbkp_path() .'/.backup_running' );
230
 
231
+ }
functions/core.functions.php CHANGED
@@ -7,7 +7,7 @@ function hmbkp_activate() {
7
 
8
  hmbkp_deactivate();
9
 
10
- hmbkp_setup_daily_schedule();
11
 
12
  }
13
 
@@ -27,7 +27,10 @@ function hmbkp_deactivate() {
27
  'hmbkp_running',
28
  'hmbkp_status',
29
  'hmbkp_complete',
30
- 'hmbkp_email_error'
 
 
 
31
  );
32
 
33
  foreach ( $options as $option )
@@ -120,15 +123,6 @@ function hmbkp_update() {
120
 
121
  }
122
 
123
- /**
124
- * Simply wrapper function for creating timestamps
125
- *
126
- * @return timestamp
127
- */
128
- function hmbkp_timestamp() {
129
- return date( get_option( 'date_format' ) ) . ' ' . date( 'H:i:s' );
130
- }
131
-
132
  /**
133
  * Sanitize a directory path
134
  *
@@ -199,17 +193,21 @@ function hmbkp_size_readable( $size, $unit = null, $retstring = '%01.2f %s', $si
199
  /**
200
  * Add daily as a cron schedule choice
201
  *
 
202
  * @param array $recc
203
  * @return array $recc
204
  */
205
  function hmbkp_more_reccurences( $recc ) {
206
 
207
  $hmbkp_reccurrences = array(
208
- 'hmbkp_daily' => array( 'interval' => 86400, 'display' => 'every day' )
 
 
209
  );
210
 
211
  return array_merge( $recc, $hmbkp_reccurrences );
212
  }
 
213
 
214
  /**
215
  * Send a flie to the browser for download
@@ -368,7 +366,7 @@ function hmbkp_calculate() {
368
  $filesize = 0;
369
 
370
  // Don't include database if files only
371
- if ( ( defined( 'HMBKP_FILES_ONLY' ) && !HMBKP_FILES_ONLY ) || !defined( 'HMBKP_FILES_ONLY' ) ) :
372
 
373
  global $wpdb;
374
 
@@ -379,7 +377,7 @@ function hmbkp_calculate() {
379
 
380
  endif;
381
 
382
- if ( ( defined( 'HMBKP_DATABASE_ONLY' ) && !HMBKP_DATABASE_ONLY ) || !defined( 'HMBKP_DATABASE_ONLY' ) ) :
383
 
384
  // Get rid of any cached filesizes
385
  clearstatcache();
@@ -426,7 +424,7 @@ function hmbkp_is_safe_mode_active() {
426
 
427
  $safe_mode = ini_get( 'safe_mode' );
428
 
429
- if ( $safe_mode && $safe_mode != 'off' && $safe_mode != 'Off' )
430
  return true;
431
 
432
  return false;
@@ -452,14 +450,22 @@ function hmbkp_total_filesize() {
452
 
453
  }
454
 
 
455
  /**
456
- * Setup the daily backup schedule
 
 
 
 
457
  */
458
- function hmbkp_setup_daily_schedule() {
459
 
460
  // Clear any old schedules
461
  wp_clear_scheduled_hook( 'hmbkp_schedule_backup_hook' );
462
 
 
 
 
463
  // Default to 11 in the evening
464
  $time = '23:00';
465
 
@@ -467,10 +473,24 @@ function hmbkp_setup_daily_schedule() {
467
  if ( defined( 'HMBKP_DAILY_SCHEDULE_TIME' ) && HMBKP_DAILY_SCHEDULE_TIME )
468
  $time = HMBKP_DAILY_SCHEDULE_TIME;
469
 
470
- if ( time() > strtotime( $time ) )
471
- $time = 'tomorrow ' . $time;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
472
 
473
- wp_schedule_event( strtotime( $time ), 'hmbkp_daily', 'hmbkp_schedule_backup_hook' );
474
  }
475
 
476
  /**
@@ -502,8 +522,13 @@ function hmbkp_path() {
502
  // Secure the directory with a .htaccess file
503
  $htaccess = $path . '/.htaccess';
504
 
 
 
 
 
 
505
  if ( !file_exists( $htaccess ) && is_writable( $path ) && require_once( ABSPATH . '/wp-admin/includes/misc.php' ) )
506
- insert_with_markers( $htaccess, 'BackUpWordPress', array( 'deny from all' ) );
507
 
508
  return hmbkp_conform_dir( $path );
509
  }
@@ -561,10 +586,103 @@ function hmbkp_max_backups() {
561
  if ( defined( 'HMBKP_MAX_BACKUPS' ) && is_numeric( HMBKP_MAX_BACKUPS ) )
562
  return (int) HMBKP_MAX_BACKUPS;
563
 
 
 
 
564
  return 10;
565
 
566
  }
567
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
568
  /**
569
  * Check if a backup is possible with regards to file
570
  * permissions etc.
7
 
8
  hmbkp_deactivate();
9
 
10
+ hmbkp_setup_schedule();
11
 
12
  }
13
 
27
  'hmbkp_running',
28
  'hmbkp_status',
29
  'hmbkp_complete',
30
+ 'hmbkp_email_error',
31
+ 'hmbkp_email_address',
32
+ 'hmbkp_schedule_frequency',
33
+ 'hmbkp_excludes'
34
  );
35
 
36
  foreach ( $options as $option )
123
 
124
  }
125
 
 
 
 
 
 
 
 
 
 
126
  /**
127
  * Sanitize a directory path
128
  *
193
  /**
194
  * Add daily as a cron schedule choice
195
  *
196
+ * @todo can we not use the built in schedules
197
  * @param array $recc
198
  * @return array $recc
199
  */
200
  function hmbkp_more_reccurences( $recc ) {
201
 
202
  $hmbkp_reccurrences = array(
203
+ 'hmbkp_weekly' => array( 'interval' => 604800, 'display' => 'every week' ),
204
+ 'hmbkp_fortnightly' => array( 'interval' => 1209600, 'display' => 'once a fortnight' ),
205
+ 'hmbkp_monthly' => array( 'interval' => 2629743.83 , 'display' => 'once a month' )
206
  );
207
 
208
  return array_merge( $recc, $hmbkp_reccurrences );
209
  }
210
+ add_filter( 'cron_schedules', 'hmbkp_more_reccurences' );
211
 
212
  /**
213
  * Send a flie to the browser for download
366
  $filesize = 0;
367
 
368
  // Don't include database if files only
369
+ if ( ! hmbkp_get_files_only() ) :
370
 
371
  global $wpdb;
372
 
377
 
378
  endif;
379
 
380
+ if ( ! hmbkp_get_database_only() ) :
381
 
382
  // Get rid of any cached filesizes
383
  clearstatcache();
424
 
425
  $safe_mode = ini_get( 'safe_mode' );
426
 
427
+ if ( $safe_mode && strtolower( $safe_mode ) != 'off' )
428
  return true;
429
 
430
  return false;
450
 
451
  }
452
 
453
+
454
  /**
455
+ * Set Up the shedule.
456
+ * This should runn according to the Frequency defined, or set in the option.
457
+ *
458
+ * @access public
459
+ * @return void
460
  */
461
+ function hmbkp_setup_schedule() {
462
 
463
  // Clear any old schedules
464
  wp_clear_scheduled_hook( 'hmbkp_schedule_backup_hook' );
465
 
466
+ if( hmbkp_get_disable_automatic_backup() )
467
+ return;
468
+
469
  // Default to 11 in the evening
470
  $time = '23:00';
471
 
473
  if ( defined( 'HMBKP_DAILY_SCHEDULE_TIME' ) && HMBKP_DAILY_SCHEDULE_TIME )
474
  $time = HMBKP_DAILY_SCHEDULE_TIME;
475
 
476
+ $offset = current_time( 'timestamp' ) - time();
477
+ $scheduletime_UTC = strtotime( $time ) - $offset;
478
+
479
+ if( defined( 'HMBKP_SCHEDULE_FREQUENCY' ) && HMBKP_SCHEDULE_FREQUENCY )
480
+ $schedule_frequency = HMBKP_SCHEDULE_FREQUENCY;
481
+ elseif( get_option('hmbkp_schedule_frequency') )
482
+ $schedule_frequency = get_option('hmbkp_schedule_frequency');
483
+ else
484
+ $schedule_frequency = 'daily';
485
+
486
+ // Advance by the interval. (except daily, when it will only happen if shcheduled time is in the past. )
487
+ if( $schedule_frequency != 'daily' || $schedule_frequency == 'daily' && $scheduletime_UTC < time() ) {
488
+ $interval = wp_get_schedules('hmbkp_schedule_backup_hook');
489
+ $interval = $interval[ $schedule_frequency ]['interval'];
490
+ $scheduletime_UTC = $scheduletime_UTC + $interval;
491
+ }
492
 
493
+ wp_schedule_event( $scheduletime_UTC, $schedule_frequency, 'hmbkp_schedule_backup_hook' );
494
  }
495
 
496
  /**
522
  // Secure the directory with a .htaccess file
523
  $htaccess = $path . '/.htaccess';
524
 
525
+ $contents[] = '# ' . __( 'This .htaccess file ensures that other people cannot download your backup files.', 'hmbkp' );
526
+ $contents[] = '';
527
+ $contents[] = 'deny from all';
528
+ $contents[] = '';
529
+
530
  if ( !file_exists( $htaccess ) && is_writable( $path ) && require_once( ABSPATH . '/wp-admin/includes/misc.php' ) )
531
+ insert_with_markers( $htaccess, 'BackUpWordPress', $contents );
532
 
533
  return hmbkp_conform_dir( $path );
534
  }
586
  if ( defined( 'HMBKP_MAX_BACKUPS' ) && is_numeric( HMBKP_MAX_BACKUPS ) )
587
  return (int) HMBKP_MAX_BACKUPS;
588
 
589
+ if ( get_option( 'hmbkp_max_backups' ) )
590
+ return (int) get_option( 'hmbkp_max_backups', 10 );
591
+
592
  return 10;
593
 
594
  }
595
 
596
+ /**
597
+ * Whether to only backup files
598
+ *
599
+ * @return bool
600
+ */
601
+ function hmbkp_get_files_only() {
602
+
603
+ if ( defined( 'HMBKP_FILES_ONLY' ) && HMBKP_FILES_ONLY )
604
+ return true;
605
+
606
+ if ( get_option( 'hmbkp_files_only' ) )
607
+ return true;
608
+
609
+ return false;
610
+ }
611
+
612
+ /**
613
+ * Whether to only backup the database
614
+ *
615
+ * @return bool
616
+ */
617
+ function hmbkp_get_database_only() {
618
+
619
+ if ( defined( 'HMBKP_DATABASE_ONLY' ) && HMBKP_DATABASE_ONLY )
620
+ return true;
621
+
622
+ if ( get_option( 'hmbkp_database_only' ) )
623
+ return true;
624
+
625
+ return false;
626
+
627
+ }
628
+
629
+ /**
630
+ * Returns defined email address or email address saved in options.
631
+ * If none set, return false.
632
+ */
633
+
634
+ function hmbkp_get_email_address() {
635
+
636
+ if ( defined( 'HMBKP_EMAIL' ) && HMBKP_EMAIL )
637
+ $email = HMBKP_EMAIL;
638
+
639
+ elseif ( get_option( 'hmbkp_email_address' ) )
640
+ $email = get_option( 'hmbkp_email_address' );
641
+
642
+ else
643
+ return false;
644
+
645
+ if ( is_email( $email ) )
646
+ return $email;
647
+
648
+ return false;
649
+
650
+ }
651
+
652
+ /**
653
+ * Are automatic backups disabled
654
+ *
655
+ * @return bool
656
+ */
657
+ function hmbkp_get_disable_automatic_backup() {
658
+
659
+ if ( defined( 'HMBKP_DISABLE_AUTOMATIC_BACKUP' ) && HMBKP_DISABLE_AUTOMATIC_BACKUP )
660
+ return true;
661
+
662
+ if ( get_option( 'hmbkp_disable_automatic_backup' ) )
663
+ return true;
664
+
665
+ return false;
666
+
667
+ }
668
+
669
+ /**
670
+ * Get the list of excludes
671
+ *
672
+ * @return bool
673
+ */
674
+ function hmbkp_get_excludes() {
675
+
676
+ if ( defined( 'HMBKP_EXCLUDE' ) && HMBKP_EXCLUDE )
677
+ return HMBKP_EXCLUDE;
678
+
679
+ if ( get_option( 'hmbkp_excludes' ) )
680
+ return get_option( 'hmbkp_excludes' );
681
+
682
+ return false;
683
+
684
+ }
685
+
686
  /**
687
  * Check if a backup is possible with regards to file
688
  * permissions etc.
functions/interface.functions.php CHANGED
@@ -6,12 +6,15 @@
6
  */
7
  function hmbkp_get_backup_row( $file ) {
8
 
9
- $encode = base64_encode( $file ); ?>
 
 
 
10
 
11
  <tr class="hmbkp_manage_backups_row<?php if ( file_exists( hmbkp_path() . '/.backup_complete' ) ) : ?> completed<?php unlink( hmbkp_path() . '/.backup_complete' ); endif; ?>">
12
 
13
  <th scope="row">
14
- <?php echo date( get_option('date_format'), filemtime( $file ) ) . ' ' . date( 'H:i', filemtime($file ) ); ?>
15
  </th>
16
 
17
  <td>
@@ -37,6 +40,24 @@ function hmbkp_get_backup_row( $file ) {
37
  */
38
  function hmbkp_admin_notices() {
39
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40
  // If the backups directory doesn't exist and can't be automatically created
41
  if ( !is_dir( hmbkp_path() ) ) :
42
 
@@ -72,7 +93,7 @@ function hmbkp_admin_notices() {
72
  endif;
73
 
74
  // If both HMBKP_FILES_ONLY & HMBKP_DATABASE_ONLY are defined at the same time
75
- if ( defined( 'HMBKP_FILES_ONLY' ) && HMBKP_FILES_ONLY && defined( 'HMBKP_DATABASE_ONLY' ) && HMBKP_DATABASE_ONLY ) :
76
 
77
  function hmbkp_nothing_to_backup_warning() {
78
  echo '<div id="hmbkp-warning" class="updated fade"><p><strong>' . __( 'BackUpWordPress has detected a problem.', 'hmbkp' ) . '</strong> ' . sprintf( __( 'You have both %s and %s defined so there isn\'t anything to back up.', 'hmbkp' ), '<code>HMBKP_DATABASE_ONLY</code>', '<code>HMBKP_FILES_ONLY</code>' ) . '</p></div>';
6
  */
7
  function hmbkp_get_backup_row( $file ) {
8
 
9
+ $encode = base64_encode( $file );
10
+ $offset = current_time( 'timestamp' ) - time();
11
+
12
+ ?>
13
 
14
  <tr class="hmbkp_manage_backups_row<?php if ( file_exists( hmbkp_path() . '/.backup_complete' ) ) : ?> completed<?php unlink( hmbkp_path() . '/.backup_complete' ); endif; ?>">
15
 
16
  <th scope="row">
17
+ <?php echo date_i18n( get_option( 'date_format' ) . ' - ' . get_option( 'time_format' ), filemtime( $file ) + $offset ); ?>
18
  </th>
19
 
20
  <td>
40
  */
41
  function hmbkp_admin_notices() {
42
 
43
+ // If the form has been submitted, display un updated notification
44
+ // Display notifications for any errors in the advanced options form.
45
+ if( !empty( $_POST['hmbkp_options_submit'] ) ) :
46
+
47
+ function hmbkp_advanced_options_saved() {
48
+ echo '<div id="setting-error-settings_updated" class="updated settings-error"><p><strong>Settings saved.</strong></p></div>';
49
+
50
+ global $hmbkp_errors;
51
+ if ( !empty( $hmbkp_errors ) && $hmbkp_errors->get_error_code() ) {
52
+ foreach( $hmbkp_errors->get_error_messages() as $hmbkp_error ) {
53
+ echo '<div class="error"><p>' . $hmbkp_error . '</p></div>';
54
+ }
55
+ }
56
+ }
57
+ add_action( 'admin_notices', 'hmbkp_advanced_options_saved' );
58
+
59
+ endif;
60
+
61
  // If the backups directory doesn't exist and can't be automatically created
62
  if ( !is_dir( hmbkp_path() ) ) :
63
 
93
  endif;
94
 
95
  // If both HMBKP_FILES_ONLY & HMBKP_DATABASE_ONLY are defined at the same time
96
+ if ( hmbkp_get_files_only() && hmbkp_get_database_only() ) :
97
 
98
  function hmbkp_nothing_to_backup_warning() {
99
  echo '<div id="hmbkp-warning" class="updated fade"><p><strong>' . __( 'BackUpWordPress has detected a problem.', 'hmbkp' ) . '</strong> ' . sprintf( __( 'You have both %s and %s defined so there isn\'t anything to back up.', 'hmbkp' ), '<code>HMBKP_DATABASE_ONLY</code>', '<code>HMBKP_FILES_ONLY</code>' ) . '</p></div>';
languages/hmbkp-ru_RU.mo ADDED
Binary file
languages/hmbkp-ru_RU.po ADDED
@@ -0,0 +1,384 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (C) 2010
2
+ # This file is distributed under the same license as the package.
3
+ # Valera Ryaboshapko <valera@creator.su>, 2011.
4
+ #
5
+ msgid ""
6
+ msgstr ""
7
+ "Project-Id-Version: BackUpWordPress\n"
8
+ "Report-Msgid-Bugs-To: http://wordpress.org/tag/backupwordpress\n"
9
+ "Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2)\n"
10
+ "POT-Creation-Date: 2011-07-11 15:40:57+00:00\n"
11
+ "MIME-Version: 1.0\n"
12
+ "Content-Type: text/plain; charset=UTF-8\n"
13
+ "Content-Transfer-Encoding: UTF-8\n"
14
+ "PO-Revision-Date: 2011-10-06 10:26+0400\n"
15
+ "Last-Translator: Valera Ryaboshapko <valera@creator.su>\n"
16
+ "Language-Team: ru_RU < >\n"
17
+
18
+ #: admin.actions.php:101 functions/interface.functions.php:68
19
+ #: functions/interface.functions.php:78 functions/interface.functions.php:88
20
+ #: functions/interface.functions.php:98 functions/interface.functions.php:108
21
+ #: functions/interface.functions.php:118 functions/interface.functions.php:128
22
+ msgid "BackUpWordPress has detected a problem."
23
+ msgstr "BackUpWordPress обнаружил проблему."
24
+
25
+ #: admin.actions.php:101
26
+ msgid ""
27
+ "%s is returning a %s response which could mean cron jobs aren't getting "
28
+ "fired properly. BackUpWordPress relies on wp-cron to run back ups in a "
29
+ "separate process."
30
+ msgstr ""
31
+ "&s вернул &s, что может означать неправильное удаление задания cron. "
32
+ "BackUpWordPress использует wp-cron для запуска резервного копирования "
33
+ "отдельным процессом."
34
+
35
+ #: admin.backups-table.php:13
36
+ msgid "1 backup completed"
37
+ msgid_plural "%d backups completed"
38
+ msgstr[0] "%s резервная копия готова"
39
+ msgstr[1] "%s резервные копии готовы"
40
+ msgstr[2] "%s резервных копий готово"
41
+
42
+ #: admin.backups-table.php:14
43
+ msgid "Size"
44
+ msgstr "Размер"
45
+
46
+ #: admin.backups-table.php:15
47
+ msgid "Actions"
48
+ msgstr "Действия"
49
+
50
+ #: admin.backups-table.php:21
51
+ msgid "Only the most recent backup will be saved"
52
+ msgid_plural "The %d most recent backups will be saved"
53
+ msgstr[0] "%d последняя копия будет сохранена"
54
+ msgstr[1] "%d последние копии будут сохранены"
55
+ msgstr[2] "%d последних копий будут сохранены"
56
+
57
+ #: admin.backups-table.php:22
58
+ msgid "Total %s"
59
+ msgstr "Всего %s"
60
+
61
+ #: functions/backup.functions.php:34
62
+ msgid "Dumping database"
63
+ msgstr "Копирование базы данных"
64
+
65
+ #: functions/backup.functions.php:40
66
+ msgid "Creating zip archive"
67
+ msgstr "Создание zip-архива"
68
+
69
+ #: functions/backup.functions.php:52
70
+ msgid "Removing old backups"
71
+ msgstr "Удаление старых копий"
72
+
73
+ #: functions/backup.functions.php:167 functions/backup.functions.php:177
74
+ msgid "Backup of %s"
75
+ msgstr "Копирование %s"
76
+
77
+ #: functions/backup.functions.php:168
78
+ msgid ""
79
+ "BackUpWordPress has completed a backup of your site %s.\n"
80
+ "\n"
81
+ "The backup file should be attached to this email.\n"
82
+ "\n"
83
+ "You can also download the backup file by clicking the link below:\n"
84
+ "\n"
85
+ "%s\n"
86
+ "\n"
87
+ "Kind Regards\n"
88
+ "\n"
89
+ " The Happy BackUpWordPress Backup Emailing Robot"
90
+ msgstr ""
91
+ "BackUpWordpress закончил резервировать ваш сайт %s.\n"
92
+ "\n"
93
+ "Файл с резервной копией должен быть прикреплён к этому письму.\n"
94
+ "\n"
95
+ "Так же вы можете скачать его по данной ссылке:"
96
+ "\n"
97
+ "%s\n"
98
+ "\n"
99
+ "С наилучшими пожеланиями,\n"
100
+ "\n"
101
+ "Почовый робот BackUpWordPress."
102
+
103
+ #: functions/backup.functions.php:178
104
+ msgid ""
105
+ "BackUpWordPress has completed a backup of your site %s.\n"
106
+ "\n"
107
+ "Unfortunately the backup file was too large to attach to this email.\n"
108
+ "\n"
109
+ "You can download the backup file by clicking the link below:\n"
110
+ "\n"
111
+ "%s\n"
112
+ "\n"
113
+ "Kind Regards\n"
114
+ "\n"
115
+ " The Happy BackUpWordPress Backup Emailing Robot"
116
+ msgstr ""
117
+ "BackUpWordpress закончил резервировать ваш сайт %s.\n"
118
+ "\n"
119
+ "К сожалению, файл резервной копии оказался слишком велик для прикрепления его к этому письму..\n"
120
+ "\n"
121
+ " Скачать его можно по данной ссылке:\n"
122
+ "\n"
123
+ "%s\n"
124
+ "\n"
125
+ "С наилучшими пожеланиями,\n"
126
+ "\n"
127
+ "Почовый робот BackUpWordPress."
128
+
129
+ #: functions/interface.functions.php:23
130
+ msgid "Download"
131
+ msgstr "Скачать"
132
+
133
+ #: functions/interface.functions.php:24
134
+ msgid "Delete"
135
+ msgstr "Удалить"
136
+
137
+ #: functions/interface.functions.php:46 functions/interface.functions.php:58
138
+ msgid "BackUpWordPress is almost ready."
139
+ msgstr "BackUpWordPress почти готов."
140
+
141
+ #: functions/interface.functions.php:46
142
+ msgid ""
143
+ "The backups directory can't be created because your %s directory isn't "
144
+ "writable, run %s or %s or create the folder yourself."
145
+ msgstr ""
146
+ "Папка резервных копий не может быть создана, т.&nbsp;к. папка %s"
147
+ "не доступна для записи. Выполните %s или %s, или создайте папку вручную."
148
+
149
+ #: functions/interface.functions.php:58
150
+ msgid ""
151
+ "Your backups directory isn't writable. run %s or %s or set the permissions "
152
+ "yourself."
153
+ msgstr ""
154
+ "Папка для резервных копий недоступна для записи. Выполните %s или %s, или "
155
+ "установите права вручную."
156
+
157
+ #: functions/interface.functions.php:68
158
+ msgid ""
159
+ " %s is running in %s. Please contact your host and ask them to disable %s."
160
+ msgstr ""
161
+ "%s выполняется в %s. Пожалуйста, свяжитесь с администрацией своего хостинга и попросите отключить %s."
162
+
163
+ #: functions/interface.functions.php:78
164
+ msgid "You have both %s and %s defined so there isn't anything to back up."
165
+ msgstr "Вы запретили резервные копии и %s, и %s, так что делать нечего."
166
+
167
+ #: functions/interface.functions.php:88
168
+ msgid "%s is not a valid email address."
169
+ msgstr "E-mail адрес %s не действителен."
170
+
171
+ #: functions/interface.functions.php:98
172
+ msgid "The last backup email failed to send."
173
+ msgstr "Предыдущий e-mail с резервной копией не был отправлен."
174
+
175
+ #: functions/interface.functions.php:108
176
+ msgid ""
177
+ "Your custom backups directory %s doesn't exist and can't be created, your "
178
+ "backups will be saved to %s instead."
179
+ msgstr ""
180
+ "Заданная вами папка для резервных копий %s не существует и не может быть создана, поэтому "
181
+ "они будут сохранены в %s."
182
+
183
+ #: functions/interface.functions.php:118
184
+ msgid ""
185
+ "Your custom backups directory %s isn't writable, new backups will be saved "
186
+ "to %s instead."
187
+ msgstr ""
188
+ "Заданная вами папка для резервных копий %s недоступна для записи, "
189
+ "поэтому они будут сохранены в %s."
190
+
191
+ #: functions/interface.functions.php:128
192
+ msgid ""
193
+ "You have defined a custom exclude list but the following paths don't exist "
194
+ "%s, are you sure you entered them correctly?"
195
+ msgstr ""
196
+ "Вы задали список папок и файлов для исключения из резервной копии, но путь %s не существует. "
197
+ "Вы уверены, что задали его правильно?"
198
+
199
+ #: admin.status.php:5
200
+ msgid "Automatic backups are %s."
201
+ msgstr "Автоматическое резервное копирование %s."
202
+
203
+ #: admin.status.php:5
204
+ msgid "disabled"
205
+ msgstr "отключено"
206
+
207
+ #: admin.status.php:10 admin.status.php:13 admin.status.php:35
208
+ #: admin.advanced-options.php:13 admin.advanced-options.php:16
209
+ #: admin.advanced-options.php:25 admin.advanced-options.php:28
210
+ msgid "database"
211
+ msgstr "баз данных"
212
+
213
+ #: admin.status.php:10
214
+ msgid "&amp;"
215
+ msgstr "и"
216
+
217
+ #: admin.status.php:10 admin.status.php:16 admin.status.php:31
218
+ #: admin.advanced-options.php:16 admin.advanced-options.php:25
219
+ #: admin.advanced-options.php:28
220
+ msgid "files"
221
+ msgstr "файлов"
222
+
223
+ #: admin.status.php:18
224
+ msgid "Your %s will be automatically backed up every day at %s to %s."
225
+ msgstr "Резервное копирование ваших %s будет проходить ежедневно в %s в папку %s."
226
+
227
+ #: admin.status.php:18
228
+ msgid "It's currently %s on the server."
229
+ msgstr "На сервере сейчас %s."
230
+
231
+ #: admin.status.php:22
232
+ msgid ""
233
+ "Your site is %s. Backups will be compressed and should be smaller than this."
234
+ msgstr ""
235
+ "Ваш сайт занимает %s. Резервные копии будут сжаты и займут меньше места. "
236
+
237
+ #: admin.status.php:22
238
+ msgid "Calculating Size..."
239
+ msgstr "Вычисление размера…"
240
+
241
+ #: admin.status.php:25
242
+ msgid ""
243
+ "%s is disabled which means we have to use the slower PHP fallbacks, you "
244
+ "could try contacting your host and asking them to enable it."
245
+ msgstr ""
246
+ "%s отключен. Это значит, что будут использованы более медленные команды PHP. "
247
+ "Вы можете обратиться к администрации своего хостинга с просьбой включить эту функцию. "
248
+
249
+ #: admin.status.php:31 admin.status.php:35
250
+ msgid "Your %s will be backed up using %s."
251
+ msgstr "Ваши %s будут зарезервированы с помощью %s."
252
+
253
+ #: admin.status.php:41
254
+ msgid "A copy of each backup will be emailed to %s."
255
+ msgstr "Каждая резервная копия будет отправляться на адрес %s."
256
+
257
+ #: admin.status.php:45
258
+ msgid "The following paths will be excluded from your backups %s."
259
+ msgstr "Эти файлы и папки будут исключены из резервных копий: %s"
260
+
261
+ #: admin.page.php:7 admin.menus.php:8
262
+ msgid "Manage Backups"
263
+ msgstr "Управление резервным копированием"
264
+
265
+ #: admin.page.php:13 admin.page.php:16
266
+ msgid "Back Up Now"
267
+ msgstr "Сделать копию"
268
+
269
+ #: admin.page.php:20 admin.advanced-options.php:3
270
+ msgid "Advanced Options"
271
+ msgstr "Дополнительные опции"
272
+
273
+ #: admin.page.php:32
274
+ msgid ""
275
+ "You need to fix the issues detailed above before BackUpWordPress can start."
276
+ msgstr ""
277
+ "Исправьте ошибки, приведённые выше, прежде чем BackUpWordPress сможет начать работу."
278
+
279
+ #: admin.page.php:38
280
+ msgid ""
281
+ "If you need help getting things working you are more than welcome to email "
282
+ "us at %s and we'll do what we can to help."
283
+ msgstr ""
284
+ "Если вам требуется помощь в том, чтобы заставить всё это работать, непременно пишите нам на %s, "
285
+ "и мы сделаем всё, что в наших силах."
286
+
287
+ #: admin.menus.php:8 admin.menus.php:30
288
+ msgid "Backups"
289
+ msgstr "Резервные копии"
290
+
291
+ #: admin.menus.php:53
292
+ msgid "You are not using the latest stable version of BackUpWordPress"
293
+ msgstr "Ваша версия BackUpWordPress устарела."
294
+
295
+ #: admin.menus.php:53
296
+ msgid ""
297
+ " &mdash; The information below is for version %s. View the readme.txt file "
298
+ "for help specific to version %s."
299
+ msgstr ""
300
+ "&mdash; Информация ниже актуальна для версии %s. Особенности версии %s смотрите в файле readme.txt"
301
+
302
+ #: plugin.php:42
303
+ msgid "BackUpWordPress requires WordPress version %s."
304
+ msgstr "Для работы BackUpWordPress требуется Wordpress версии %s."
305
+
306
+ #: admin.advanced-options.php:5
307
+ msgid ""
308
+ "You can %s any of the following %s in your %s to control advanced options. "
309
+ "%s. Defined %s will be highlighted."
310
+ msgstr ""
311
+ "Вы можете %s любую из приведённых %s в вашем %s, чтобы включить дополнительный опции. "
312
+ "%s. Заданные %s будут подсвечены."
313
+
314
+ #: admin.advanced-options.php:5
315
+ msgid "The Codex can help"
316
+ msgstr "Подробности смотрите в Кодексе"
317
+
318
+ #: admin.advanced-options.php:10
319
+ msgid ""
320
+ "The path to folder you would like to store your backup files in, defaults to "
321
+ "%s."
322
+ msgstr ""
323
+ "Путь к папке, где вы хотите хранить ваши резервные копии. "
324
+ "По умолчанию это %s."
325
+
326
+ #: admin.advanced-options.php:13
327
+ msgid ""
328
+ "The path to your %s executable. Will be used for the %s part of the back up "
329
+ "if available."
330
+ msgstr ""
331
+ "Путь к исполняемому файлу %s. Он будет использован для копирования %s, "
332
+ "если доступен."
333
+
334
+ #: admin.advanced-options.php:16
335
+ msgid ""
336
+ "The path to your %s executable. Will be used to zip up your %s and %s if "
337
+ "available."
338
+ msgstr ""
339
+ "Путь к исполняемому файлу %s. Он будет использован для сжатия %s и %s, "
340
+ "если доступен."
341
+
342
+ #: admin.advanced-options.php:19
343
+ msgid ""
344
+ "Completely disables the automatic back up. You can still back up using the "
345
+ "\"Back Up Now\" button. Defaults to %s."
346
+ msgstr ""
347
+ "Полный запрет на автоматическое резервное копирование. Однако, ручное копирование "
348
+ "кнопкой \"Сделать копию\" будет доступно. Значение по умолчанию %s."
349
+
350
+ #: admin.advanced-options.php:22
351
+ msgid ""
352
+ "Number of backups to keep, older backups will be deleted automatically when "
353
+ "a new backup is completed. Detaults to %s."
354
+ msgstr ""
355
+ "Количество хранимых резервных копий. Более старые копии будут удалены автоматически "
356
+ "после создания новой. Значение по умолчанию %s."
357
+
358
+ #: admin.advanced-options.php:25 admin.advanced-options.php:28
359
+ msgid "Backup %s only, your %s will %s be backed up. Defaults to %s."
360
+ msgstr "Делать копии только %s, но не %s, которые %s будут включены в резервную копию. Значение по умолчанию %s."
361
+
362
+ #: admin.advanced-options.php:25 admin.advanced-options.php:28
363
+ msgid "not"
364
+ msgstr "не"
365
+
366
+ #: admin.advanced-options.php:31
367
+ msgid "The time that the daily back up should run. Defaults to %s."
368
+ msgstr "Время запуска ежедневного резервного копирования. Значение по умолчанию %s."
369
+
370
+ #: admin.advanced-options.php:34
371
+ msgid ""
372
+ "Attempt to email a copy of your backups. Value should be email address to "
373
+ "send backups to. Defaults to %s."
374
+ msgstr ""
375
+ "Попытаться отправить резервную копию на e-mail. Значением должен быть e-mail адрес. "
376
+ "Значение по умолчанию %s."
377
+
378
+ #: admin.advanced-options.php:37
379
+ msgid ""
380
+ "Comma separated list of files or directories to exclude, the backups "
381
+ "directory is automatically excluded."
382
+ msgstr ""
383
+ "Список файлов и папок, которые нужно исключить из резервной копии, разделённый запятыми. "
384
+ "Папка с предыдущими резервными копиями исключается автоматически. "
plugin.php CHANGED
@@ -2,11 +2,11 @@
2
 
3
  /*
4
  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.3.2
9
- Author URI: http://humanmade.co.uk/
10
  */
11
 
12
  /* Copyright 2011 Human Made Limited (email : hello@humanmade.co.uk)
@@ -31,7 +31,7 @@ define( 'HMBKP_PLUGIN_PATH', WP_PLUGIN_DIR . '/' . HMBKP_PLUGIN_SLUG );
31
  define( 'HMBKP_PLUGIN_URL', WP_PLUGIN_URL . '/' . HMBKP_PLUGIN_SLUG );
32
  define( 'HMBKP_REQUIRED_WP_VERSION', '3.1' );
33
 
34
- // Don't activate on anything less than PHP5
35
  if ( version_compare( phpversion(), '5.2.4', '<' ) ) {
36
 
37
  require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
@@ -96,9 +96,6 @@ require_once( HMBKP_PLUGIN_PATH . '/functions/backup.files.fallback.functions.ph
96
  add_action( 'activate_' . HMBKP_PLUGIN_SLUG . '/plugin.php', 'hmbkp_activate' );
97
  add_action( 'deactivate_' . HMBKP_PLUGIN_SLUG . '/plugin.php', 'hmbkp_deactivate' );
98
 
99
- // Add more cron schedules
100
- add_filter( 'cron_schedules', 'hmbkp_more_reccurences' );
101
-
102
  // Cron hook for backups
103
  add_action( 'hmbkp_schedule_backup_hook', 'hmbkp_do_backup' );
104
  add_action( 'hmbkp_schedule_single_backup_hook', 'hmbkp_do_backup' );
2
 
3
  /*
4
  Plugin Name: BackUpWordPress
5
+ Plugin URI: http://hmn.md/backupwordpress/
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.4 beta
9
+ Author URI: http://hmn.md/
10
  */
11
 
12
  /* Copyright 2011 Human Made Limited (email : hello@humanmade.co.uk)
31
  define( 'HMBKP_PLUGIN_URL', WP_PLUGIN_URL . '/' . HMBKP_PLUGIN_SLUG );
32
  define( 'HMBKP_REQUIRED_WP_VERSION', '3.1' );
33
 
34
+ // Don't activate on anything less than PHP 5.2.4
35
  if ( version_compare( phpversion(), '5.2.4', '<' ) ) {
36
 
37
  require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
96
  add_action( 'activate_' . HMBKP_PLUGIN_SLUG . '/plugin.php', 'hmbkp_activate' );
97
  add_action( 'deactivate_' . HMBKP_PLUGIN_SLUG . '/plugin.php', 'hmbkp_deactivate' );
98
 
 
 
 
99
  // Cron hook for backups
100
  add_action( 'hmbkp_schedule_backup_hook', 'hmbkp_do_backup' );
101
  add_action( 'hmbkp_schedule_single_backup_hook', 'hmbkp_do_backup' );
readme.txt CHANGED
@@ -1,9 +1,9 @@
1
  === BackUpWordPress ===
2
- Contributors: willmot, mattheu, joehoyle, humanmade
3
  Tags: back up, backup, backups, database, zip, db, files, archive, humanmade
4
  Requires at least: 3.1
5
  Tested up to: 3.2.1
6
- Stable tag: 1.3.2
7
 
8
  Simple automated back ups of your WordPress powered website.
9
 
@@ -18,9 +18,16 @@ BackUpWordPress will back up your entire site including your database and all yo
18
  * Works in low memory, "shared host" environments.
19
  * Option to have each backup file emailed to you.
20
  * Works on Linux & Windows Server.
21
- * Control advanced options by defining any of the optional `Constants`.
22
  * Exclude files and folders from your back ups.
 
23
  * Good support should you need help.
 
 
 
 
 
 
 
24
 
25
  == Installation ==
26
 
@@ -42,17 +49,6 @@ Backups are stored on your server in `wp-content/backups`, you can change the di
42
 
43
  You need to download the latest backup file either by clicking download on the backups page or via `FTP`. `Unzip` the files and upload all the files to your server overwriting your site. You can then import the database using your hosts database management tool (likely `phpMyAdmin`).
44
 
45
- **How do I change BackUpWordPress options?**
46
-
47
- A list of available options can be found on the Backups page in the admin. Click the Advanced Options button to see all the options.
48
-
49
- To set an option you define a `Constant` in your `wp-config.php` file see the following links for help defining `Constants` and editing your `wp-config.php` file:
50
-
51
- * http://php.net/manual/en/language.constants.php
52
- * http://codex.wordpress.org/Editing_wp-config.php
53
-
54
- For example: to set the number of backups stored to 3 add `define( 'HMBKP_MAX_BACKUPS', 3 );` to your `wp-config.php` file.
55
-
56
  **Does BackUpWordPress back up the backups directory?**
57
 
58
  No.
@@ -65,9 +61,9 @@ BackUpWordPress stores the last 10 backups by default.
65
 
66
  General support questions should be posted in the <a href="http://wordpress.org/tags/backupwordpress?forum_id=10">WordPress support forums, tagged with backupwordpress.</a>
67
 
68
- For development issues, feature requests or anybody wishing to help out with development checkout <a href="https://github.com/humanmade/HM-Portfolio">BackUpWordPress on GitHub.</a>
69
 
70
- You can also twitter <a href="http://twitter.com/humanmadeltd">@humanmadeltd</a> or email support@humanmade.co.uk for further help/support.
71
 
72
  == Screenshots ==
73
 
@@ -75,6 +71,15 @@ You can also twitter <a href="http://twitter.com/humanmadeltd">@humanmadeltd</a>
75
 
76
  == Changelog ==
77
 
 
 
 
 
 
 
 
 
 
78
  #### 1.3.2
79
 
80
  * Spanish translation
@@ -83,11 +88,10 @@ You can also twitter <a href="http://twitter.com/humanmadeltd">@humanmadeltd</a>
83
  * Silently ignore unreadable files / folders
84
  * Make sure binary data is properly exported when doing a mysqldump
85
  * Use 303 instead of 302 when redirecting in the admin.
86
- * Don't set_time_limit inside a loop
87
  * Use WordPress 3.2 style buttons
88
  * Don't pass an empty password to mysqldump
89
 
90
-
91
  #### 1.3.1
92
 
93
  * Check for PHP version. Deactivate plugin if running on PHP version 4.
1
  === BackUpWordPress ===
2
+ Contributors: humanmade, joehoyle, mattheu, tcrsavage, willmot
3
  Tags: back up, backup, backups, database, zip, db, files, archive, humanmade
4
  Requires at least: 3.1
5
  Tested up to: 3.2.1
6
+ Stable tag: 1.4
7
 
8
  Simple automated back ups of your WordPress powered website.
9
 
18
  * Works in low memory, "shared host" environments.
19
  * Option to have each backup file emailed to you.
20
  * Works on Linux & Windows Server.
 
21
  * Exclude files and folders from your back ups.
22
+ * Control advanced options by defining any of the optional `Constants`.
23
  * Good support should you need help.
24
+ * Spanish & Russian translations.
25
+
26
+ = Help develop this plugin =
27
+
28
+ The BackUpWordPress plugin is hosted github, if you want to help out with development or testing then head over to https://github.com/humanmade/backupwordpress/.
29
+
30
+ We'd also love help translating the plugin into more languages, if you can help then please contact support@humanmade.co.uk or send us a pull request.
31
 
32
  == Installation ==
33
 
49
 
50
  You need to download the latest backup file either by clicking download on the backups page or via `FTP`. `Unzip` the files and upload all the files to your server overwriting your site. You can then import the database using your hosts database management tool (likely `phpMyAdmin`).
51
 
 
 
 
 
 
 
 
 
 
 
 
52
  **Does BackUpWordPress back up the backups directory?**
53
 
54
  No.
61
 
62
  General support questions should be posted in the <a href="http://wordpress.org/tags/backupwordpress?forum_id=10">WordPress support forums, tagged with backupwordpress.</a>
63
 
64
+ For development issues, feature requests or anybody wishing to help out with development checkout <a href="https://github.com/humanmade/backupwordpress/">BackUpWordPress on GitHub.</a>
65
 
66
+ You can also tweet <a href="http://twitter.com/humanmadeltd">@humanmadeltd</a> or email support@humanmade.co.uk for further help/support.
67
 
68
  == Screenshots ==
69
 
71
 
72
  == Changelog ==
73
 
74
+ #### 1.4
75
+
76
+ * Most options can now be set on the backups page, all options can still be set by defining them as `Constants`.
77
+ * Russian translation, props valericus.
78
+ * All dates are now translatable.
79
+ * Fixed some strings which weren't translatable.
80
+ * New Constant `HMBKP_DISABLE_MANUAL_BACKUP_CRON` which enable you to disable the use of `wp_cron` for manual backups.
81
+ * Manual backups now work if `DISABLE_WP_CRON` is defined as `true`.
82
+
83
  #### 1.3.2
84
 
85
  * Spanish translation
88
  * Silently ignore unreadable files / folders
89
  * Make sure binary data is properly exported when doing a mysqldump
90
  * Use 303 instead of 302 when redirecting in the admin.
91
+ * Don't `set_time_limit` inside a loop
92
  * Use WordPress 3.2 style buttons
93
  * Don't pass an empty password to mysqldump
94
 
 
95
  #### 1.3.1
96
 
97
  * Check for PHP version. Deactivate plugin if running on PHP version 4.
screenshot-1.png CHANGED
Binary file