Version Description
Download this release
Release Info
| Developer | willmot |
| Plugin | |
| Version | 2.4.1 |
| Comparing to | |
| See all releases | |
Code changes from version 2.4 to 2.4.1
- backupwordpress/admin/actions.php +3 -3
- backupwordpress/admin/constants.php +3 -0
- backupwordpress/admin/menu.php +1 -1
- backupwordpress/admin/schedule.php +10 -10
- backupwordpress/classes/schedule.php +41 -56
- backupwordpress/functions/core.php +7 -5
- backupwordpress/functions/interface.php +2 -2
- backupwordpress/plugin.php +4 -1
- backupwordpress/readme.txt +17 -1
- plugin.php +1 -1
- readme.txt +5 -1
- wprp.admin.php +10 -1
- wprp.api.php +1 -1
- wprp.backups.php +5 -1
backupwordpress/admin/actions.php
CHANGED
|
@@ -164,13 +164,13 @@ add_action( 'wp_ajax_hmbkp_calculate', 'hmbkp_ajax_calculate_backup_size' );
|
|
| 164 |
*/
|
| 165 |
function hmbkp_ajax_cron_test() {
|
| 166 |
|
| 167 |
-
$response =
|
| 168 |
|
| 169 |
if ( is_wp_error( $response ) )
|
| 170 |
echo '<div id="hmbkp-warning" class="updated fade"><p><strong>' . __( 'BackUpWordPress has detected a problem.', 'hmbkp' ) . '</strong> ' . sprintf( __( '%1$s is returning a %2$s response which could mean cron jobs aren\'t getting fired properly. BackUpWordPress relies on wp-cron to run scheduled back ups. See the %3$s for more details.', 'hmbkp' ), '<code>wp-cron.php</code>', '<code>' . $response->get_error_message() . '</code>', '<a href="http://wordpress.org/extend/plugins/backupwordpress/faq/">FAQ</a>' ) . '</p></div>';
|
| 171 |
|
| 172 |
-
|
| 173 |
-
echo '<div id="hmbkp-warning" class="updated fade"><p><strong>' . __( 'BackUpWordPress has detected a problem.', 'hmbkp' ) . '</strong> ' . sprintf( __( '%1$s is returning a %2$s response which could mean cron jobs aren\'t getting fired properly. BackUpWordPress relies on wp-cron to run scheduled back ups. See the %3$s for more details.', 'hmbkp' ), '<code>wp-cron.php</code>', '<code>' . $response
|
| 174 |
|
| 175 |
else
|
| 176 |
echo 1;
|
| 164 |
*/
|
| 165 |
function hmbkp_ajax_cron_test() {
|
| 166 |
|
| 167 |
+
$response = wp_remote_head( site_url( 'wp-cron.php' ) );
|
| 168 |
|
| 169 |
if ( is_wp_error( $response ) )
|
| 170 |
echo '<div id="hmbkp-warning" class="updated fade"><p><strong>' . __( 'BackUpWordPress has detected a problem.', 'hmbkp' ) . '</strong> ' . sprintf( __( '%1$s is returning a %2$s response which could mean cron jobs aren\'t getting fired properly. BackUpWordPress relies on wp-cron to run scheduled back ups. See the %3$s for more details.', 'hmbkp' ), '<code>wp-cron.php</code>', '<code>' . $response->get_error_message() . '</code>', '<a href="http://wordpress.org/extend/plugins/backupwordpress/faq/">FAQ</a>' ) . '</p></div>';
|
| 171 |
|
| 172 |
+
elseif ( wp_remote_retrieve_response_code( $response ) != 200 )
|
| 173 |
+
echo '<div id="hmbkp-warning" class="updated fade"><p><strong>' . __( 'BackUpWordPress has detected a problem.', 'hmbkp' ) . '</strong> ' . sprintf( __( '%1$s is returning a %2$s response which could mean cron jobs aren\'t getting fired properly. BackUpWordPress relies on wp-cron to run scheduled back ups. See the %3$s for more details.', 'hmbkp' ), '<code>wp-cron.php</code>', '<code>' . wp_remote_retrieve_response_code( $response ) . ' ' . get_status_header_desc( wp_remote_retrieve_response_code( $response ) ) . '</code>', '<a href="http://wordpress.org/extend/plugins/backupwordpress/faq/">FAQ</a>' ) . '</p></div>';
|
| 174 |
|
| 175 |
else
|
| 176 |
echo 1;
|
backupwordpress/admin/constants.php
CHANGED
|
@@ -25,6 +25,9 @@
|
|
| 25 |
<dt<?php if ( defined( 'HMBKP_ROOT' ) ) { ?> class="hmbkp_active"<?php } ?>><code>HMBKP_ROOT</code></dt>
|
| 26 |
<dd><p><?php printf( __( 'The root directory that is backed up. Defaults to %s.', 'hmbkp' ), '<code>' . HM_Backup::get_home_path() . '</code>' ); ?><p class="example"><?php _e( 'e.g.', 'hmbkp' ); ?> <code>define( 'HMBKP_ROOT', ABSPATH . 'wp/' );</code></p></dd>
|
| 27 |
|
|
|
|
|
|
|
|
|
|
| 28 |
</dl>
|
| 29 |
|
| 30 |
</div>
|
| 25 |
<dt<?php if ( defined( 'HMBKP_ROOT' ) ) { ?> class="hmbkp_active"<?php } ?>><code>HMBKP_ROOT</code></dt>
|
| 26 |
<dd><p><?php printf( __( 'The root directory that is backed up. Defaults to %s.', 'hmbkp' ), '<code>' . HM_Backup::get_home_path() . '</code>' ); ?><p class="example"><?php _e( 'e.g.', 'hmbkp' ); ?> <code>define( 'HMBKP_ROOT', ABSPATH . 'wp/' );</code></p></dd>
|
| 27 |
|
| 28 |
+
<dt<?php if ( defined( 'HMBKP_SCHEDULE_TIME' ) ) { ?> class="hmbkp_active"<?php } ?>><code>HMBKP_SCHEDULE_TIME</code></dt>
|
| 29 |
+
<dd><p><?php printf( __( 'The time that your schedules should run. Defaults to %s.', 'hmbkp' ), '<code>23:00</code>' ); ?><p class="example"><?php _e( 'e.g.', 'hmbkp' ); ?> <code>define( 'HMBKP_SCHEDULE_TIME', '07:30' );</code></p></dd>
|
| 30 |
+
|
| 31 |
</dl>
|
| 32 |
|
| 33 |
</div>
|
backupwordpress/admin/menu.php
CHANGED
|
@@ -73,7 +73,7 @@ function hmbkp_contextual_help() {
|
|
| 73 |
$constants = ob_get_clean();
|
| 74 |
|
| 75 |
get_current_screen()->add_help_tab( array( 'title' => __( 'FAQ', 'hmbkp' ), 'id' => 'hmbkp_faq', 'content' => $warning . $plugin->sections['faq'] ) );
|
| 76 |
-
get_current_screen()->add_help_tab( array( 'title' => __( 'Constants', 'hmbkp' ), 'id' => 'hmbkp_constants', 'content' => $
|
| 77 |
|
| 78 |
get_current_screen()->set_help_sidebar(
|
| 79 |
'<p><strong>' . __( 'For more information:', 'hmbkp' ) . '</strong></p>' .
|
| 73 |
$constants = ob_get_clean();
|
| 74 |
|
| 75 |
get_current_screen()->add_help_tab( array( 'title' => __( 'FAQ', 'hmbkp' ), 'id' => 'hmbkp_faq', 'content' => $warning . $plugin->sections['faq'] ) );
|
| 76 |
+
get_current_screen()->add_help_tab( array( 'title' => __( 'Constants', 'hmbkp' ), 'id' => 'hmbkp_constants', 'content' => $constants ) );
|
| 77 |
|
| 78 |
get_current_screen()->set_help_sidebar(
|
| 79 |
'<p><strong>' . __( 'For more information:', 'hmbkp' ) . '</strong></p>' .
|
backupwordpress/admin/schedule.php
CHANGED
|
@@ -7,30 +7,30 @@ $filesize = $schedule->is_filesize_cached() || isset( $recalculate_filesize ) ?
|
|
| 7 |
$type = strtolower( hmbkp_human_get_type( $schedule->get_type() ) );
|
| 8 |
|
| 9 |
// Backup Time
|
| 10 |
-
$day = date_i18n( 'l', $schedule->get_next_occurrence() );
|
| 11 |
|
| 12 |
-
$next_backup = 'title="' . sprintf( __( 'The next backup will be on %1$s at %2$s', 'hmbkp' ), date_i18n( get_option( 'date_format' ), $schedule->get_next_occurrence() ), date_i18n( get_option( 'time_format' ), $schedule->get_next_occurrence() ) ) . '"';
|
| 13 |
|
| 14 |
// Backup Re-occurrence
|
| 15 |
switch ( $schedule->get_reoccurrence() ) :
|
| 16 |
|
| 17 |
case 'hourly' :
|
| 18 |
|
| 19 |
-
$reoccurrence = date_i18n(
|
| 20 |
|
| 21 |
break;
|
| 22 |
|
| 23 |
case 'daily' :
|
| 24 |
|
| 25 |
-
$reoccurrence = sprintf( __( 'daily at %s', 'hmbkp' ), '<span ' . $next_backup . '>' . date_i18n( get_option( 'time_format' ), $schedule->get_next_occurrence() ) . '</span>' );
|
| 26 |
|
| 27 |
break;
|
| 28 |
|
| 29 |
|
| 30 |
case 'twicedaily' :
|
| 31 |
|
| 32 |
-
$times[] = date_i18n( get_option( 'time_format' ), $schedule->get_next_occurrence() );
|
| 33 |
-
$times[] = date_i18n( get_option( 'time_format' ), strtotime( '+ 12 hours', $schedule->get_next_occurrence() ) );
|
| 34 |
|
| 35 |
sort( $times );
|
| 36 |
|
|
@@ -40,20 +40,20 @@ switch ( $schedule->get_reoccurrence() ) :
|
|
| 40 |
|
| 41 |
case 'weekly' :
|
| 42 |
|
| 43 |
-
$reoccurrence = sprintf( __( 'weekly on %1$s at %2$s', 'hmbkp' ), '<span ' . $next_backup . '>' . $day . '</span>', '<span>' . date_i18n( get_option( 'time_format' ), $schedule->get_next_occurrence() ) . '</span>' );
|
| 44 |
|
| 45 |
break;
|
| 46 |
|
| 47 |
case 'fortnightly' :
|
| 48 |
|
| 49 |
-
$reoccurrence = sprintf( __( 'fortnightly on %1$s at %2$s', 'hmbkp' ), '<span ' . $next_backup . '>' . $day . '</span>', '<span>' . date_i18n( get_option( 'time_format' ), $schedule->get_next_occurrence() ) . '</span>' );
|
| 50 |
|
| 51 |
break;
|
| 52 |
|
| 53 |
|
| 54 |
case 'monthly' :
|
| 55 |
|
| 56 |
-
$reoccurrence = sprintf( __( 'on the %1$s of each month at %2$s', 'hmbkp' ), '<span ' . $next_backup . '>' . date_i18n( 'jS', $schedule->get_next_occurrence() ) . '</span>', '<span>' . date_i18n( get_option( 'time_format' ), $schedule->get_next_occurrence() ) . '</span>' );
|
| 57 |
|
| 58 |
break;
|
| 59 |
|
|
@@ -97,4 +97,4 @@ foreach ( HMBKP_Services::get_services( $schedule ) as $file => $service )
|
|
| 97 |
|
| 98 |
<?php hmbkp_schedule_actions( $schedule ); ?>
|
| 99 |
|
| 100 |
-
</div>
|
| 7 |
$type = strtolower( hmbkp_human_get_type( $schedule->get_type() ) );
|
| 8 |
|
| 9 |
// Backup Time
|
| 10 |
+
$day = date_i18n( 'l', $schedule->get_next_occurrence( false ) );
|
| 11 |
|
| 12 |
+
$next_backup = 'title="' . sprintf( __( 'The next backup will be on %1$s at %2$s', 'hmbkp' ), date_i18n( get_option( 'date_format' ), $schedule->get_next_occurrence( false ) ), date_i18n( get_option( 'time_format' ), $schedule->get_next_occurrence( false ) ) ) . '"';
|
| 13 |
|
| 14 |
// Backup Re-occurrence
|
| 15 |
switch ( $schedule->get_reoccurrence() ) :
|
| 16 |
|
| 17 |
case 'hourly' :
|
| 18 |
|
| 19 |
+
$reoccurrence = date_i18n( 'i', $schedule->get_next_occurrence( false ) ) === '00' ? sprintf( __( 'hourly on the hour', 'hmbkp' ) ) : sprintf( __( 'hourly at %s minutes past the hour', 'hmbkp' ), '<span ' . $next_backup . '>' . str_replace( '0', '', date_i18n( 'i', $schedule->get_next_occurrence( false ) ) ) ) . '</span>';
|
| 20 |
|
| 21 |
break;
|
| 22 |
|
| 23 |
case 'daily' :
|
| 24 |
|
| 25 |
+
$reoccurrence = sprintf( __( 'daily at %s', 'hmbkp' ), '<span ' . $next_backup . '>' . date_i18n( get_option( 'time_format' ), $schedule->get_next_occurrence( false ) ) . '</span>' );
|
| 26 |
|
| 27 |
break;
|
| 28 |
|
| 29 |
|
| 30 |
case 'twicedaily' :
|
| 31 |
|
| 32 |
+
$times[] = date_i18n( get_option( 'time_format' ), $schedule->get_next_occurrence( false ) );
|
| 33 |
+
$times[] = date_i18n( get_option( 'time_format' ), strtotime( '+ 12 hours', $schedule->get_next_occurrence( false ) ) );
|
| 34 |
|
| 35 |
sort( $times );
|
| 36 |
|
| 40 |
|
| 41 |
case 'weekly' :
|
| 42 |
|
| 43 |
+
$reoccurrence = sprintf( __( 'weekly on %1$s at %2$s', 'hmbkp' ), '<span ' . $next_backup . '>' . $day . '</span>', '<span>' . date_i18n( get_option( 'time_format' ), $schedule->get_next_occurrence( false ) ) . '</span>' );
|
| 44 |
|
| 45 |
break;
|
| 46 |
|
| 47 |
case 'fortnightly' :
|
| 48 |
|
| 49 |
+
$reoccurrence = sprintf( __( 'fortnightly on %1$s at %2$s', 'hmbkp' ), '<span ' . $next_backup . '>' . $day . '</span>', '<span>' . date_i18n( get_option( 'time_format' ), $schedule->get_next_occurrence( false ) ) . '</span>' );
|
| 50 |
|
| 51 |
break;
|
| 52 |
|
| 53 |
|
| 54 |
case 'monthly' :
|
| 55 |
|
| 56 |
+
$reoccurrence = sprintf( __( 'on the %1$s of each month at %2$s', 'hmbkp' ), '<span ' . $next_backup . '>' . date_i18n( 'jS', $schedule->get_next_occurrence( false ) ) . '</span>', '<span>' . date_i18n( get_option( 'time_format' ), $schedule->get_next_occurrence( false ) ) . '</span>' );
|
| 57 |
|
| 58 |
break;
|
| 59 |
|
| 97 |
|
| 98 |
<?php hmbkp_schedule_actions( $schedule ); ?>
|
| 99 |
|
| 100 |
+
</div>
|
backupwordpress/classes/schedule.php
CHANGED
|
@@ -48,51 +48,6 @@ class HMBKP_Scheduled_Backup extends HM_Backup {
|
|
| 48 |
*/
|
| 49 |
private $schedule_start_time = 0;
|
| 50 |
|
| 51 |
-
/**
|
| 52 |
-
* Take a file size and return a human readable
|
| 53 |
-
* version
|
| 54 |
-
*
|
| 55 |
-
* @access public
|
| 56 |
-
* @static
|
| 57 |
-
* @param int $size
|
| 58 |
-
* @param string $unit. (default: null)
|
| 59 |
-
* @param string $format. (default: '%01.2f %s')
|
| 60 |
-
* @param bool $si. (default: true)
|
| 61 |
-
* @return int
|
| 62 |
-
*/
|
| 63 |
-
public static function human_filesize( $size, $unit = null, $format = '%01.2f %s', $si = true ) {
|
| 64 |
-
|
| 65 |
-
// Units
|
| 66 |
-
if ( $si === true ) :
|
| 67 |
-
$sizes = array( 'B', 'kB', 'MB', 'GB', 'TB', 'PB' );
|
| 68 |
-
$mod = 1000;
|
| 69 |
-
|
| 70 |
-
else :
|
| 71 |
-
$sizes = array('B', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB');
|
| 72 |
-
$mod = 1024;
|
| 73 |
-
|
| 74 |
-
endif;
|
| 75 |
-
|
| 76 |
-
$ii = count( $sizes ) - 1;
|
| 77 |
-
|
| 78 |
-
// Max unit
|
| 79 |
-
$unit = array_search( (string) $unit, $sizes );
|
| 80 |
-
|
| 81 |
-
if ( is_null( $unit ) || $unit === false )
|
| 82 |
-
$unit = $ii;
|
| 83 |
-
|
| 84 |
-
// Loop
|
| 85 |
-
$i = 0;
|
| 86 |
-
|
| 87 |
-
while ( $unit != $i && $size >= 1024 && $i < $ii ) {
|
| 88 |
-
$size /= $mod;
|
| 89 |
-
$i++;
|
| 90 |
-
}
|
| 91 |
-
|
| 92 |
-
return sprintf( $format, $size, $sizes[$i] );
|
| 93 |
-
|
| 94 |
-
}
|
| 95 |
-
|
| 96 |
/**
|
| 97 |
* Setup the schedule object
|
| 98 |
*
|
|
@@ -141,6 +96,10 @@ class HMBKP_Scheduled_Backup extends HM_Backup {
|
|
| 141 |
// Set the archive filename to site name + schedule slug + date
|
| 142 |
$this->set_archive_filename( implode( '-', array( get_bloginfo( 'name' ), $this->get_id(), $this->get_type(), date( 'Y-m-d-H-i-s', current_time( 'timestamp' ) ) ) ) . '.zip' );
|
| 143 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 144 |
}
|
| 145 |
|
| 146 |
/**
|
|
@@ -365,7 +324,7 @@ class HMBKP_Scheduled_Backup extends HM_Backup {
|
|
| 365 |
|
| 366 |
}
|
| 367 |
|
| 368 |
-
return
|
| 369 |
|
| 370 |
}
|
| 371 |
|
|
@@ -403,15 +362,18 @@ class HMBKP_Scheduled_Backup extends HM_Backup {
|
|
| 403 |
|
| 404 |
if ( ! $this->schedule_start_time ) {
|
| 405 |
|
| 406 |
-
|
| 407 |
-
|
| 408 |
-
|
| 409 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 410 |
|
| 411 |
-
$date -= ( get_option( 'gmt_offset' ) * 3600 );
|
| 412 |
-
|
| 413 |
$this->set_schedule_start_time( $date );
|
| 414 |
}
|
|
|
|
| 415 |
return $this->schedule_start_time;
|
| 416 |
|
| 417 |
}
|
|
@@ -420,7 +382,7 @@ class HMBKP_Scheduled_Backup extends HM_Backup {
|
|
| 420 |
* Set the schedule start time.
|
| 421 |
*
|
| 422 |
* @access public
|
| 423 |
-
* @param int $timestamp
|
| 424 |
* @return void
|
| 425 |
*/
|
| 426 |
public function set_schedule_start_time( $timestamp ) {
|
|
@@ -494,18 +456,33 @@ class HMBKP_Scheduled_Backup extends HM_Backup {
|
|
| 494 |
*
|
| 495 |
* @access public
|
| 496 |
*/
|
| 497 |
-
public function get_next_occurrence() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 498 |
|
| 499 |
-
|
|
|
|
|
|
|
|
|
|
| 500 |
|
| 501 |
}
|
| 502 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 503 |
private function get_schedule_running_path() {
|
| 504 |
return $this->get_path() . '/.schedule-' . $this->get_id() . '-running';
|
| 505 |
}
|
| 506 |
|
| 507 |
/**
|
| 508 |
-
* Schedule the cron
|
| 509 |
*
|
| 510 |
* @access public
|
| 511 |
*/
|
|
@@ -515,8 +492,16 @@ class HMBKP_Scheduled_Backup extends HM_Backup {
|
|
| 515 |
$this->unschedule();
|
| 516 |
|
| 517 |
wp_schedule_event( $this->get_schedule_start_time(), $this->get_reoccurrence(), 'hmbkp_schedule_hook', array( 'id' => $this->get_id() ) );
|
|
|
|
| 518 |
}
|
| 519 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 520 |
public function unschedule() {
|
| 521 |
wp_clear_scheduled_hook( 'hmbkp_schedule_hook', array( 'id' => $this->get_id() ) );
|
| 522 |
}
|
| 48 |
*/
|
| 49 |
private $schedule_start_time = 0;
|
| 50 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 51 |
/**
|
| 52 |
* Setup the schedule object
|
| 53 |
*
|
| 96 |
// Set the archive filename to site name + schedule slug + date
|
| 97 |
$this->set_archive_filename( implode( '-', array( get_bloginfo( 'name' ), $this->get_id(), $this->get_type(), date( 'Y-m-d-H-i-s', current_time( 'timestamp' ) ) ) ) . '.zip' );
|
| 98 |
|
| 99 |
+
// Setup the schedule if it isn't set or TODO if it's changed
|
| 100 |
+
if ( ( ! $this->get_next_occurrence() && in_array( $this->get_reoccurrence(), array_keys( wp_get_schedules() ) ) ) || ( date( get_option( 'time_format' ), strtotime( HMBKP_SCHEDULE_TIME ) - ( get_option( 'gmt_offset' ) * 3600 ) ) !== date( get_option( 'time_format' ), $this->get_next_occurrence() ) ) )
|
| 101 |
+
$this->schedule();
|
| 102 |
+
|
| 103 |
}
|
| 104 |
|
| 105 |
/**
|
| 324 |
|
| 325 |
}
|
| 326 |
|
| 327 |
+
return size_format( $filesize );
|
| 328 |
|
| 329 |
}
|
| 330 |
|
| 362 |
|
| 363 |
if ( ! $this->schedule_start_time ) {
|
| 364 |
|
| 365 |
+
$date = strtotime( HMBKP_SCHEDULE_TIME );
|
| 366 |
+
|
| 367 |
+
// Convert to UTC
|
| 368 |
+
$date -= get_option( 'gmt_offset' ) * 3600;
|
| 369 |
+
|
| 370 |
+
// if the scheduled time already passed today then start at the next interval instead
|
| 371 |
+
if ( $date <= strtotime( 'now' ) )
|
| 372 |
+
$date += $this->get_interval();
|
| 373 |
|
|
|
|
|
|
|
| 374 |
$this->set_schedule_start_time( $date );
|
| 375 |
}
|
| 376 |
+
|
| 377 |
return $this->schedule_start_time;
|
| 378 |
|
| 379 |
}
|
| 382 |
* Set the schedule start time.
|
| 383 |
*
|
| 384 |
* @access public
|
| 385 |
+
* @param int $timestamp in UTC
|
| 386 |
* @return void
|
| 387 |
*/
|
| 388 |
public function set_schedule_start_time( $timestamp ) {
|
| 456 |
*
|
| 457 |
* @access public
|
| 458 |
*/
|
| 459 |
+
public function get_next_occurrence( $gmt = true ) {
|
| 460 |
+
|
| 461 |
+
$time = wp_next_scheduled( 'hmbkp_schedule_hook', array( 'id' => $this->get_id() ) );
|
| 462 |
+
|
| 463 |
+
if ( ! $time )
|
| 464 |
+
$time = 0;
|
| 465 |
|
| 466 |
+
if ( ! $gmt )
|
| 467 |
+
$time += get_option( 'gmt_offset' ) * 3600;
|
| 468 |
+
|
| 469 |
+
return $time;
|
| 470 |
|
| 471 |
}
|
| 472 |
|
| 473 |
+
|
| 474 |
+
/**
|
| 475 |
+
* Get the path to the backup running file that stores the running backup status
|
| 476 |
+
*
|
| 477 |
+
* @access private
|
| 478 |
+
* @return string
|
| 479 |
+
*/
|
| 480 |
private function get_schedule_running_path() {
|
| 481 |
return $this->get_path() . '/.schedule-' . $this->get_id() . '-running';
|
| 482 |
}
|
| 483 |
|
| 484 |
/**
|
| 485 |
+
* Schedule the backup cron
|
| 486 |
*
|
| 487 |
* @access public
|
| 488 |
*/
|
| 492 |
$this->unschedule();
|
| 493 |
|
| 494 |
wp_schedule_event( $this->get_schedule_start_time(), $this->get_reoccurrence(), 'hmbkp_schedule_hook', array( 'id' => $this->get_id() ) );
|
| 495 |
+
|
| 496 |
}
|
| 497 |
|
| 498 |
+
|
| 499 |
+
/**
|
| 500 |
+
* Unschedule the backup cron.
|
| 501 |
+
*
|
| 502 |
+
* @access public
|
| 503 |
+
* @return void
|
| 504 |
+
*/
|
| 505 |
public function unschedule() {
|
| 506 |
wp_clear_scheduled_hook( 'hmbkp_schedule_hook', array( 'id' => $this->get_id() ) );
|
| 507 |
}
|
backupwordpress/functions/core.php
CHANGED
|
@@ -33,9 +33,11 @@ function hmbkp_deactivate() {
|
|
| 33 |
delete_transient( 'hmbkp_running' );
|
| 34 |
delete_transient( 'hmbkp_estimated_filesize' );
|
| 35 |
|
| 36 |
-
// Clear
|
| 37 |
-
|
| 38 |
-
|
|
|
|
|
|
|
| 39 |
|
| 40 |
hmbkp_cleanup();
|
| 41 |
|
|
@@ -87,7 +89,7 @@ function hmbkp_update() {
|
|
| 87 |
}
|
| 88 |
|
| 89 |
// Version 1 to 2
|
| 90 |
-
if ( version_compare
|
| 91 |
|
| 92 |
/**
|
| 93 |
* Setup a backwards compatible schedule
|
|
@@ -139,7 +141,7 @@ function hmbkp_update() {
|
|
| 139 |
$legacy_schedule->save();
|
| 140 |
|
| 141 |
// Remove the legacy options
|
| 142 |
-
foreach ( array( '
|
| 143 |
delete_option( $option_name );
|
| 144 |
|
| 145 |
|
| 33 |
delete_transient( 'hmbkp_running' );
|
| 34 |
delete_transient( 'hmbkp_estimated_filesize' );
|
| 35 |
|
| 36 |
+
// Clear hmbkp crons
|
| 37 |
+
foreach( get_option( 'cron' ) as $cron )
|
| 38 |
+
foreach( (array) $cron as $key => $value )
|
| 39 |
+
if ( strpos( $key, 'hmbkp' ) !== false )
|
| 40 |
+
wp_clear_scheduled_hook( $key );
|
| 41 |
|
| 42 |
hmbkp_cleanup();
|
| 43 |
|
| 89 |
}
|
| 90 |
|
| 91 |
// Version 1 to 2
|
| 92 |
+
if ( version_compare( '2.0' , get_option( 'hmbkp_plugin_version' ), '>' ) ) {
|
| 93 |
|
| 94 |
/**
|
| 95 |
* Setup a backwards compatible schedule
|
| 141 |
$legacy_schedule->save();
|
| 142 |
|
| 143 |
// Remove the legacy options
|
| 144 |
+
foreach ( array( 'hmbkp_database_only', 'hmbkp_files_only', 'hmbkp_max_backups', 'hmbkp_email_address', 'hmbkp_email', 'hmbkp_schedule_frequency', 'hmbkp_disable_automatic_backup' ) as $option_name )
|
| 145 |
delete_option( $option_name );
|
| 146 |
|
| 147 |
|
backupwordpress/functions/interface.php
CHANGED
|
@@ -8,7 +8,7 @@
|
|
| 8 |
function hmbkp_get_backup_row( $file, HMBKP_Scheduled_Backup $schedule ) {
|
| 9 |
|
| 10 |
$encoded_file = urlencode( base64_encode( $file ) );
|
| 11 |
-
$offset =
|
| 12 |
|
| 13 |
<tr class="hmbkp_manage_backups_row<?php if ( file_exists( hmbkp_path() . '/.backup_complete' ) ) : ?> completed<?php unlink( hmbkp_path() . '/.backup_complete' ); endif; ?>">
|
| 14 |
|
|
@@ -17,7 +17,7 @@ function hmbkp_get_backup_row( $file, HMBKP_Scheduled_Backup $schedule ) {
|
|
| 17 |
</th>
|
| 18 |
|
| 19 |
<td class="code">
|
| 20 |
-
<?php echo esc_attr(
|
| 21 |
</td>
|
| 22 |
|
| 23 |
<td><?php echo esc_attr( hmbkp_human_get_type( $file, $schedule ) ); ?></td>
|
| 8 |
function hmbkp_get_backup_row( $file, HMBKP_Scheduled_Backup $schedule ) {
|
| 9 |
|
| 10 |
$encoded_file = urlencode( base64_encode( $file ) );
|
| 11 |
+
$offset = get_option( 'gmt_offset' ) * 3600; ?>
|
| 12 |
|
| 13 |
<tr class="hmbkp_manage_backups_row<?php if ( file_exists( hmbkp_path() . '/.backup_complete' ) ) : ?> completed<?php unlink( hmbkp_path() . '/.backup_complete' ); endif; ?>">
|
| 14 |
|
| 17 |
</th>
|
| 18 |
|
| 19 |
<td class="code">
|
| 20 |
+
<?php echo esc_attr( size_format( @filesize( $file ) ) ); ?>
|
| 21 |
</td>
|
| 22 |
|
| 23 |
<td><?php echo esc_attr( hmbkp_human_get_type( $file, $schedule ) ); ?></td>
|
backupwordpress/plugin.php
CHANGED
|
@@ -5,7 +5,7 @@ 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 → Backups</strong>.
|
| 7 |
Author: Human Made Limited
|
| 8 |
-
Version: 2.0.
|
| 9 |
Author URI: http://hmn.md/
|
| 10 |
*/
|
| 11 |
|
|
@@ -45,6 +45,9 @@ if ( ! defined( 'HMBKP_REQUIRED_WP_VERSION' ) )
|
|
| 45 |
if ( ! defined( 'WP_MAX_MEMORY_LIMIT' ) )
|
| 46 |
define( 'WP_MAX_MEMORY_LIMIT', '256M' );
|
| 47 |
|
|
|
|
|
|
|
|
|
|
| 48 |
// Don't activate on anything less than PHP 5.2.4
|
| 49 |
if ( version_compare( phpversion(), '5.2.4', '<' ) ) {
|
| 50 |
|
| 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 → Backups</strong>.
|
| 7 |
Author: Human Made Limited
|
| 8 |
+
Version: 2.0.6
|
| 9 |
Author URI: http://hmn.md/
|
| 10 |
*/
|
| 11 |
|
| 45 |
if ( ! defined( 'WP_MAX_MEMORY_LIMIT' ) )
|
| 46 |
define( 'WP_MAX_MEMORY_LIMIT', '256M' );
|
| 47 |
|
| 48 |
+
if ( ! defined( 'HMBKP_SCHEDULE_TIME' ) )
|
| 49 |
+
define( 'HMBKP_SCHEDULE_TIME', '11pm' );
|
| 50 |
+
|
| 51 |
// Don't activate on anything less than PHP 5.2.4
|
| 52 |
if ( version_compare( phpversion(), '5.2.4', '<' ) ) {
|
| 53 |
|
backupwordpress/readme.txt
CHANGED
|
@@ -3,7 +3,7 @@ Contributors: humanmade, joehoyle, mattheu, tcrsavage, willmot, cuvelier
|
|
| 3 |
Tags: back up, backup, backups, database, zip, db, files, archive, wp-cli, humanmade
|
| 4 |
Requires at least: 3.3.3
|
| 5 |
Tested up to: 3.5
|
| 6 |
-
Stable tag: 2.0.
|
| 7 |
|
| 8 |
Simple automated back ups of your WordPress powered website.
|
| 9 |
|
|
@@ -103,6 +103,22 @@ You can also tweet <a href="http://twitter.com/humanmadeltd">@humanmadeltd</a> o
|
|
| 103 |
|
| 104 |
== Changelog ==
|
| 105 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 106 |
#### 2.0.4
|
| 107 |
|
| 108 |
* Revert the change to the way the plugin url and path were calculated as it caused regressions on some systems.
|
| 3 |
Tags: back up, backup, backups, database, zip, db, files, archive, wp-cli, humanmade
|
| 4 |
Requires at least: 3.3.3
|
| 5 |
Tested up to: 3.5
|
| 6 |
+
Stable tag: 2.0.6
|
| 7 |
|
| 8 |
Simple automated back ups of your WordPress powered website.
|
| 9 |
|
| 103 |
|
| 104 |
== Changelog ==
|
| 105 |
|
| 106 |
+
#### 2.0.6
|
| 107 |
+
|
| 108 |
+
* Fix possible warning on plugin activation if the sites cron option is empty.
|
| 109 |
+
* Don't show the version warning in the help for Constants as that comes from the current version.
|
| 110 |
+
|
| 111 |
+
#### 2.0.5
|
| 112 |
+
|
| 113 |
+
* Re-setup the cron schedules if they get deleted somehow.
|
| 114 |
+
* Delete all BackUpWordPress cron entries when the plugin is deactivated.
|
| 115 |
+
* Introduce the `HMBKP_SCHEDULE_TIME` constant to allow control over the time schedules run.
|
| 116 |
+
* Make sure the schedule times and times of previous backups are shown in local time.
|
| 117 |
+
* Fix a bug that could cause the legacy backup schedule to be created on every update, not just when going from 1.x to 2.x.
|
| 118 |
+
* Improve the usefulness of the `wp-cron.php` response code check.
|
| 119 |
+
* Use the built in `site_format` function for human readable filesizes instead of defining our own function.
|
| 120 |
+
|
| 121 |
+
|
| 122 |
#### 2.0.4
|
| 123 |
|
| 124 |
* Revert the change to the way the plugin url and path were calculated as it caused regressions on some systems.
|
plugin.php
CHANGED
|
@@ -3,7 +3,7 @@
|
|
| 3 |
/*
|
| 4 |
Plugin Name: WP Remote
|
| 5 |
Description: Manage your WordPress site with <a href="https://wpremote.com/">WP Remote</a>. <strong>Deactivate to clear your API Key.</strong>
|
| 6 |
-
Version: 2.4
|
| 7 |
Author: Human Made Limited
|
| 8 |
Author URI: http://hmn.md/
|
| 9 |
*/
|
| 3 |
/*
|
| 4 |
Plugin Name: WP Remote
|
| 5 |
Description: Manage your WordPress site with <a href="https://wpremote.com/">WP Remote</a>. <strong>Deactivate to clear your API Key.</strong>
|
| 6 |
+
Version: 2.4.1
|
| 7 |
Author: Human Made Limited
|
| 8 |
Author URI: http://hmn.md/
|
| 9 |
*/
|
readme.txt
CHANGED
|
@@ -3,7 +3,7 @@ Contributors: humanmade, joehoyle, mattheu, tcrsavage, willmot
|
|
| 3 |
Tags: wpremote, remote administration, multiple wordpress
|
| 4 |
Requires at least: 2.9
|
| 5 |
Tested up to: 3.5
|
| 6 |
-
Stable tag: 2.4
|
| 7 |
|
| 8 |
WP Remote is a free web app that enables you to easily manage all of your WordPress powered sites from one place.
|
| 9 |
|
|
@@ -31,6 +31,10 @@ You can email us at support@wpremote.com for support.
|
|
| 31 |
|
| 32 |
== Changelog ==
|
| 33 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
#### 2.4
|
| 35 |
|
| 36 |
* Backups are now powered by BackUpWordPress.
|
| 3 |
Tags: wpremote, remote administration, multiple wordpress
|
| 4 |
Requires at least: 2.9
|
| 5 |
Tested up to: 3.5
|
| 6 |
+
Stable tag: 2.4.1
|
| 7 |
|
| 8 |
WP Remote is a free web app that enables you to easily manage all of your WordPress powered sites from one place.
|
| 9 |
|
| 31 |
|
| 32 |
== Changelog ==
|
| 33 |
|
| 34 |
+
#### 2.4.1
|
| 35 |
+
|
| 36 |
+
* Minor bug fixes
|
| 37 |
+
|
| 38 |
#### 2.4
|
| 39 |
|
| 40 |
* Backups are now powered by BackUpWordPress.
|
wprp.admin.php
CHANGED
|
@@ -88,7 +88,16 @@ function wprp_remove_backupwordpress_from_admin_menu() {
|
|
| 88 |
|
| 89 |
global $submenu;
|
| 90 |
|
| 91 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 92 |
unset( $submenu['tools.php'][16] );
|
| 93 |
}
|
| 94 |
add_action( 'admin_menu', 'wprp_remove_backupwordpress_from_admin_menu', 11 );
|
| 88 |
|
| 89 |
global $submenu;
|
| 90 |
|
| 91 |
+
// only remove BackUpWordPress if they didn't have it installed
|
| 92 |
+
$plugins = get_plugins();
|
| 93 |
+
|
| 94 |
+
$has_backupwordpress = false;
|
| 95 |
+
|
| 96 |
+
foreach ( $plugins as $plugin_info )
|
| 97 |
+
if ( $plugin_info['Name'] == 'BackUpWordPress')
|
| 98 |
+
$has_backupwordpress = true;
|
| 99 |
+
|
| 100 |
+
if ( ! $has_backupwordpress && isset( $submenu['tools.php'][16] ) && $submenu['tools.php'][16][2] === 'backupwordpress' )
|
| 101 |
unset( $submenu['tools.php'][16] );
|
| 102 |
}
|
| 103 |
add_action( 'admin_menu', 'wprp_remove_backupwordpress_from_admin_menu', 11 );
|
wprp.api.php
CHANGED
|
@@ -13,7 +13,7 @@ $actions = explode( ',', $_GET['actions'] );
|
|
| 13 |
$actions = array_flip( $actions );
|
| 14 |
|
| 15 |
// Disable error_reporting so they don't break the json request
|
| 16 |
-
error_reporting( 0 );
|
| 17 |
|
| 18 |
// Log in as admin
|
| 19 |
wp_set_current_user( 1 );
|
| 13 |
$actions = array_flip( $actions );
|
| 14 |
|
| 15 |
// Disable error_reporting so they don't break the json request
|
| 16 |
+
//error_reporting( 0 );
|
| 17 |
|
| 18 |
// Log in as admin
|
| 19 |
wp_set_current_user( 1 );
|
wprp.backups.php
CHANGED
|
@@ -67,7 +67,7 @@ class WPRP_Backups {
|
|
| 67 |
public function getEstimatedSize() {
|
| 68 |
|
| 69 |
if ( $size = get_transient( 'hmbkp_schedule_manual_filesize' ) )
|
| 70 |
-
return
|
| 71 |
|
| 72 |
// we dont know the size yet, fire off a remote request to get it for later
|
| 73 |
// it can take some time so we have a small timeout then return "Calculating"
|
|
@@ -251,5 +251,9 @@ function _wprp_get_backups_info() {
|
|
| 251 |
'estimated_size' => WPRP_Backups::getInstance()->getEstimatedSize()
|
| 252 |
);
|
| 253 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 254 |
return $info;
|
| 255 |
}
|
| 67 |
public function getEstimatedSize() {
|
| 68 |
|
| 69 |
if ( $size = get_transient( 'hmbkp_schedule_manual_filesize' ) )
|
| 70 |
+
return size_format( $size, null, '%01u %s' );
|
| 71 |
|
| 72 |
// we dont know the size yet, fire off a remote request to get it for later
|
| 73 |
// it can take some time so we have a small timeout then return "Calculating"
|
| 251 |
'estimated_size' => WPRP_Backups::getInstance()->getEstimatedSize()
|
| 252 |
);
|
| 253 |
|
| 254 |
+
return $info;
|
| 255 |
+
}ize()
|
| 256 |
+
);
|
| 257 |
+
|
| 258 |
return $info;
|
| 259 |
}
|
