Version Description
Download this release
Release Info
| Developer | willmot |
| Plugin | |
| Version | 2.2.1 |
| Comparing to | |
| See all releases | |
Code changes from version 2.2 to 2.2.1
- admin/actions.php +29 -4
- assets/hmbkp.css +1 -1
- assets/hmbkp.js +50 -44
- classes/schedule.php +14 -2
- classes/services.php +4 -4
- hm-backup/hm-backup.php +21 -42
- plugin.php +1 -1
- readme.txt +10 -1
admin/actions.php
CHANGED
|
@@ -47,8 +47,10 @@ function hmbkp_ajax_request_do_backup() {
|
|
| 47 |
if ( empty( $_POST['hmbkp_schedule_id'] ) )
|
| 48 |
exit;
|
| 49 |
|
|
|
|
|
|
|
| 50 |
// We want to display any fatal errors in this ajax request so we can catch them on the other side.
|
| 51 |
-
error_reporting( E_ERROR );
|
| 52 |
@ini_set( 'display_errors', 'On' );
|
| 53 |
@ini_set( 'html_errors', 'Off' );
|
| 54 |
|
|
@@ -64,6 +66,19 @@ function hmbkp_ajax_request_do_backup() {
|
|
| 64 |
|
| 65 |
$schedule->run();
|
| 66 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 67 |
exit;
|
| 68 |
|
| 69 |
}
|
|
@@ -428,9 +443,19 @@ function hmbkp_display_error_and_offer_to_email_it() {
|
|
| 428 |
if ( empty( $_POST['hmbkp_error'] ) )
|
| 429 |
exit;
|
| 430 |
|
| 431 |
-
$error =
|
|
|
|
|
|
|
| 432 |
|
| 433 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 434 |
|
| 435 |
<p><?php _e( 'Here\'s the response from the server:', 'hmbkp' ); ?></p>
|
| 436 |
|
|
@@ -450,7 +475,7 @@ function hmbkp_send_error_via_email() {
|
|
| 450 |
if ( empty( $_POST['hmbkp_error'] ) )
|
| 451 |
exit;
|
| 452 |
|
| 453 |
-
$error =
|
| 454 |
|
| 455 |
wp_mail( 'support@humanmade.co.uk', 'BackUpWordPress Fatal error on ' . parse_url( home_url(), PHP_URL_HOST ), $error, 'From: BackUpWordPress <' . get_bloginfo( 'admin_email' ) . '>' . "\r\n" );
|
| 456 |
|
| 47 |
if ( empty( $_POST['hmbkp_schedule_id'] ) )
|
| 48 |
exit;
|
| 49 |
|
| 50 |
+
//header( 'HTTP/1.1 500 Internal Server Error' );
|
| 51 |
+
|
| 52 |
// We want to display any fatal errors in this ajax request so we can catch them on the other side.
|
| 53 |
+
error_reporting( E_ERROR | E_USER_ERROR | E_CORE_ERROR | E_COMPILE_ERROR | E_RECOVERABLE_ERROR );
|
| 54 |
@ini_set( 'display_errors', 'On' );
|
| 55 |
@ini_set( 'html_errors', 'Off' );
|
| 56 |
|
| 66 |
|
| 67 |
$schedule->run();
|
| 68 |
|
| 69 |
+
$errors = array_merge( $schedule->get_errors(), $schedule->get_warnings() );
|
| 70 |
+
|
| 71 |
+
$error_message = '';
|
| 72 |
+
|
| 73 |
+
foreach ( $errors as $error_set )
|
| 74 |
+
$error_message .= implode( "\n\r", $error_set );
|
| 75 |
+
|
| 76 |
+
if ( $error_message && file_exists( $schedule->get_archive_filepath() ) )
|
| 77 |
+
$error_message .= 'HMBKP_SUCCESS';
|
| 78 |
+
|
| 79 |
+
if ( trim( $error_message ) )
|
| 80 |
+
echo $error_message;
|
| 81 |
+
|
| 82 |
exit;
|
| 83 |
|
| 84 |
}
|
| 443 |
if ( empty( $_POST['hmbkp_error'] ) )
|
| 444 |
exit;
|
| 445 |
|
| 446 |
+
$error = wp_strip_all_tags( stripslashes( $_POST['hmbkp_error'] ) );
|
| 447 |
+
|
| 448 |
+
$error = str_replace( 'HMBKP_SUCCESS', '', $error, $succeeded );
|
| 449 |
|
| 450 |
+
if ( $succeeded ) { ?>
|
| 451 |
+
|
| 452 |
+
<h3><?php _e( 'Your backup completed but with the following errors / warnings', 'hmbkp' ); ?></h3>
|
| 453 |
+
|
| 454 |
+
<?php } else { ?>
|
| 455 |
+
|
| 456 |
+
<h3><?php _e( 'Your backUp failed', 'hmbkp' ); ?></h3>
|
| 457 |
+
|
| 458 |
+
<?php } ?>
|
| 459 |
|
| 460 |
<p><?php _e( 'Here\'s the response from the server:', 'hmbkp' ); ?></p>
|
| 461 |
|
| 475 |
if ( empty( $_POST['hmbkp_error'] ) )
|
| 476 |
exit;
|
| 477 |
|
| 478 |
+
$error = wp_strip_all_tags( $_POST['hmbkp_error'] );
|
| 479 |
|
| 480 |
wp_mail( 'support@humanmade.co.uk', 'BackUpWordPress Fatal error on ' . parse_url( home_url(), PHP_URL_HOST ), $error, 'From: BackUpWordPress <' . get_bloginfo( 'admin_email' ) . '>' . "\r\n" );
|
| 481 |
|
assets/hmbkp.css
CHANGED
|
@@ -86,7 +86,7 @@ table.widefat tbody td { padding: 8px 7px; }
|
|
| 86 |
.hmbkp-edit-schedule-excludes-form td span.reason { color: #CCC; }
|
| 87 |
input[type="datetime-local"] { border-radius: 3px; border-width: 1px; border-style: solid; box-sizing: border-box; border-color: #DFDFDF; background-color: white; }
|
| 88 |
|
| 89 |
-
pre { background-color: #eee; padding: 10px; white-space:
|
| 90 |
|
| 91 |
@media only screen and ( max-width : 321px ) {
|
| 92 |
|
| 86 |
.hmbkp-edit-schedule-excludes-form td span.reason { color: #CCC; }
|
| 87 |
input[type="datetime-local"] { border-radius: 3px; border-width: 1px; border-style: solid; box-sizing: border-box; border-color: #DFDFDF; background-color: white; }
|
| 88 |
|
| 89 |
+
pre { background-color: #eee; padding: 10px; white-space: -moz-pre-wrap; white-space: -o-pre-wrap; white-space: pre-wrap; word-wrap: break-word; }
|
| 90 |
|
| 91 |
@media only screen and ( max-width : 321px ) {
|
| 92 |
|
assets/hmbkp.js
CHANGED
|
@@ -300,73 +300,79 @@ jQuery( document ).ready( function( $ ) {
|
|
| 300 |
|
| 301 |
scheduleId = $( '[data-hmbkp-schedule-id]' ).attr( 'data-hmbkp-schedule-id' );
|
| 302 |
|
| 303 |
-
ajaxRequest = $.post(
|
| 304 |
ajaxurl,
|
| 305 |
-
{ 'action' : 'hmbkp_run_schedule', 'hmbkp_schedule_id' : scheduleId }
|
| 306 |
-
|
| 307 |
|
| 308 |
-
|
| 309 |
-
|
| 310 |
-
|
| 311 |
-
|
| 312 |
|
| 313 |
-
|
| 314 |
-
else {
|
| 315 |
|
| 316 |
-
|
| 317 |
|
| 318 |
-
|
| 319 |
-
|
| 320 |
-
|
| 321 |
-
function( data ) {
|
| 322 |
|
| 323 |
-
|
| 324 |
-
return;
|
| 325 |
|
| 326 |
-
|
| 327 |
-
'maxWidth' : 500,
|
| 328 |
-
'content' : data,
|
| 329 |
-
'modal' : true
|
| 330 |
-
} );
|
| 331 |
|
| 332 |
-
|
| 333 |
-
);
|
| 334 |
|
| 335 |
-
|
| 336 |
|
| 337 |
-
|
|
|
|
|
|
|
| 338 |
|
| 339 |
-
|
|
|
|
| 340 |
|
| 341 |
-
|
| 342 |
|
| 343 |
-
|
| 344 |
-
|
| 345 |
-
|
| 346 |
-
|
| 347 |
-
$.fancybox.close();
|
| 348 |
-
}
|
| 349 |
|
| 350 |
-
|
|
|
|
| 351 |
|
| 352 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 353 |
|
| 354 |
}
|
|
|
|
| 355 |
|
| 356 |
-
|
| 357 |
-
).error( function( data ) {
|
| 358 |
-
location.replace( '//' + location.host + location.pathname + '?page=backupwordpress&action=hmbkp_cancel&reason=broken&hmbkp_schedule_id=' + scheduleId );
|
| 359 |
-
} );
|
| 360 |
|
| 361 |
-
|
| 362 |
-
hmbkpRedirectOnBackupComplete( scheduleId, false )
|
| 363 |
-
}, 1000 );
|
| 364 |
|
| 365 |
e.preventDefault();
|
| 366 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 367 |
} );
|
| 368 |
|
| 369 |
-
}
|
|
|
|
| 370 |
|
| 371 |
function hmbkpRedirectOnBackupComplete( schedule_id, redirect ) {
|
| 372 |
|
|
@@ -375,7 +381,7 @@ function hmbkpRedirectOnBackupComplete( schedule_id, redirect ) {
|
|
| 375 |
{ 'action' : 'hmbkp_is_in_progress', 'hmbkp_schedule_id' : jQuery( '[data-hmbkp-schedule-id]' ).attr( 'data-hmbkp-schedule-id' ) },
|
| 376 |
function( data ) {
|
| 377 |
|
| 378 |
-
if ( data == 0 && redirect === true ) {
|
| 379 |
location.reload( true );
|
| 380 |
|
| 381 |
} else {
|
| 300 |
|
| 301 |
scheduleId = $( '[data-hmbkp-schedule-id]' ).attr( 'data-hmbkp-schedule-id' );
|
| 302 |
|
| 303 |
+
ajaxRequest = $.post(
|
| 304 |
ajaxurl,
|
| 305 |
+
{ 'action' : 'hmbkp_run_schedule', 'hmbkp_schedule_id' : scheduleId }
|
| 306 |
+
).done( function( data ) {
|
| 307 |
|
| 308 |
+
catchResponseAndOfferToEmail( data );
|
| 309 |
+
|
| 310 |
+
// Redirect back on error
|
| 311 |
+
} ).fail( function( jqXHR, textStatus ) {
|
| 312 |
|
| 313 |
+
catchResponseAndOfferToEmail( jqXHR.responseText );
|
|
|
|
| 314 |
|
| 315 |
+
} );
|
| 316 |
|
| 317 |
+
setTimeout( function() {
|
| 318 |
+
hmbkpRedirectOnBackupComplete( scheduleId, false )
|
| 319 |
+
}, 1000 );
|
|
|
|
| 320 |
|
| 321 |
+
e.preventDefault();
|
|
|
|
| 322 |
|
| 323 |
+
} );
|
|
|
|
|
|
|
|
|
|
|
|
|
| 324 |
|
| 325 |
+
} );
|
|
|
|
| 326 |
|
| 327 |
+
function catchResponseAndOfferToEmail( data ) {
|
| 328 |
|
| 329 |
+
// Backup Succeeded
|
| 330 |
+
if ( ! data || data == 0 )
|
| 331 |
+
location.reload( true );
|
| 332 |
|
| 333 |
+
// The backup failed, show the error and offer to have it emailed back
|
| 334 |
+
else {
|
| 335 |
|
| 336 |
+
jQuery( '.hmbkp-schedule-sentence.hmbkp-running' ).removeClass( 'hmbkp-running' ).addClass( 'hmbkp-error' );
|
| 337 |
|
| 338 |
+
jQuery.post(
|
| 339 |
+
ajaxurl,
|
| 340 |
+
{ 'action' : 'hmbkp_backup_error', 'hmbkp_error' : data },
|
| 341 |
+
function( data ) {
|
|
|
|
|
|
|
| 342 |
|
| 343 |
+
if ( ! data || data == 0 )
|
| 344 |
+
return;
|
| 345 |
|
| 346 |
+
jQuery.fancybox( {
|
| 347 |
+
'maxWidth' : 500,
|
| 348 |
+
'content' : data,
|
| 349 |
+
'modal' : true
|
| 350 |
+
} );
|
| 351 |
|
| 352 |
}
|
| 353 |
+
);
|
| 354 |
|
| 355 |
+
}
|
|
|
|
|
|
|
|
|
|
| 356 |
|
| 357 |
+
jQuery( document ).one( 'click', '.hmbkp_send_error_via_email', function( e ) {
|
|
|
|
|
|
|
| 358 |
|
| 359 |
e.preventDefault();
|
| 360 |
|
| 361 |
+
jQuery( this ).addClass( 'hmbkp-ajax-loading' );
|
| 362 |
+
|
| 363 |
+
jQuery.post(
|
| 364 |
+
ajaxurl,
|
| 365 |
+
{ 'action' : 'hmbkp_email_error', 'hmbkp_error' : data },
|
| 366 |
+
function( data ) {
|
| 367 |
+
jQuery.fancybox.close();
|
| 368 |
+
}
|
| 369 |
+
|
| 370 |
+
)
|
| 371 |
+
|
| 372 |
} );
|
| 373 |
|
| 374 |
+
}
|
| 375 |
+
|
| 376 |
|
| 377 |
function hmbkpRedirectOnBackupComplete( schedule_id, redirect ) {
|
| 378 |
|
| 381 |
{ 'action' : 'hmbkp_is_in_progress', 'hmbkp_schedule_id' : jQuery( '[data-hmbkp-schedule-id]' ).attr( 'data-hmbkp-schedule-id' ) },
|
| 382 |
function( data ) {
|
| 383 |
|
| 384 |
+
if ( data == 0 && redirect === true && ! jQuery( '.hmbkp-error' ).size() ) {
|
| 385 |
location.reload( true );
|
| 386 |
|
| 387 |
} else {
|
classes/schedule.php
CHANGED
|
@@ -546,7 +546,9 @@ class HMBKP_Scheduled_Backup extends HM_Backup {
|
|
| 546 |
if ( ! file_exists( $this->get_schedule_running_path() ) )
|
| 547 |
return '';
|
| 548 |
|
| 549 |
-
|
|
|
|
|
|
|
| 550 |
|
| 551 |
}
|
| 552 |
|
|
@@ -561,7 +563,9 @@ class HMBKP_Scheduled_Backup extends HM_Backup {
|
|
| 561 |
if ( ! file_exists( $this->get_schedule_running_path() ) )
|
| 562 |
return '';
|
| 563 |
|
| 564 |
-
|
|
|
|
|
|
|
| 565 |
}
|
| 566 |
|
| 567 |
/**
|
|
@@ -619,6 +623,10 @@ class HMBKP_Scheduled_Backup extends HM_Backup {
|
|
| 619 |
|
| 620 |
$this->set_status( __( 'Finishing Backup', 'hmbkp' ) );
|
| 621 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 622 |
if ( $this->get_errors() ) {
|
| 623 |
|
| 624 |
$file = $this->get_path() . '/.backup_errors';
|
|
@@ -635,6 +643,10 @@ class HMBKP_Scheduled_Backup extends HM_Backup {
|
|
| 635 |
|
| 636 |
}
|
| 637 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 638 |
if ( $this->get_warnings() ) {
|
| 639 |
|
| 640 |
$file = $this->get_path() . '/.backup_warnings';
|
| 546 |
if ( ! file_exists( $this->get_schedule_running_path() ) )
|
| 547 |
return '';
|
| 548 |
|
| 549 |
+
$status = explode( '::', file_get_contents( $this->get_schedule_running_path() ) );
|
| 550 |
+
|
| 551 |
+
return end( $status );
|
| 552 |
|
| 553 |
}
|
| 554 |
|
| 563 |
if ( ! file_exists( $this->get_schedule_running_path() ) )
|
| 564 |
return '';
|
| 565 |
|
| 566 |
+
$backup_running_file = explode( '::', file_get_contents( $this->get_schedule_running_path() ) );
|
| 567 |
+
|
| 568 |
+
return reset( $backup_running_file );
|
| 569 |
}
|
| 570 |
|
| 571 |
/**
|
| 623 |
|
| 624 |
$this->set_status( __( 'Finishing Backup', 'hmbkp' ) );
|
| 625 |
|
| 626 |
+
break;
|
| 627 |
+
|
| 628 |
+
case 'hmbkp_error' :
|
| 629 |
+
|
| 630 |
if ( $this->get_errors() ) {
|
| 631 |
|
| 632 |
$file = $this->get_path() . '/.backup_errors';
|
| 643 |
|
| 644 |
}
|
| 645 |
|
| 646 |
+
break;
|
| 647 |
+
|
| 648 |
+
case 'hmbkp_warning' :
|
| 649 |
+
|
| 650 |
if ( $this->get_warnings() ) {
|
| 651 |
|
| 652 |
$file = $this->get_path() . '/.backup_warnings';
|
classes/services.php
CHANGED
|
@@ -170,7 +170,7 @@ class HMBKP_Services {
|
|
| 170 |
*
|
| 171 |
* @access public
|
| 172 |
*/
|
| 173 |
-
public function get_services( HMBKP_Scheduled_Backup $schedule = null ) {
|
| 174 |
|
| 175 |
if ( is_null( $schedule ) )
|
| 176 |
return self::instance()->services;
|
|
@@ -186,7 +186,7 @@ class HMBKP_Services {
|
|
| 186 |
*
|
| 187 |
* @access public
|
| 188 |
*/
|
| 189 |
-
public function register( $filepath, $classname ) {
|
| 190 |
|
| 191 |
if ( ! file_exists( $filepath ) )
|
| 192 |
throw new Exception( 'Argument 1 for ' . __METHOD__ . ' must be a valid filepath' );
|
|
@@ -200,7 +200,7 @@ class HMBKP_Services {
|
|
| 200 |
*
|
| 201 |
* @access public
|
| 202 |
*/
|
| 203 |
-
public function unregister( $filepath ) {
|
| 204 |
|
| 205 |
if ( ! isset( self::instance()->services[$filepath] ) )
|
| 206 |
throw new Exception( 'Argument 1 for ' . __METHOD__ . ' must be a registered service' );
|
|
@@ -216,7 +216,7 @@ class HMBKP_Services {
|
|
| 216 |
* @param string $class
|
| 217 |
* @return array An array of instantiated classes
|
| 218 |
*/
|
| 219 |
-
private function instantiate( $class ) {
|
| 220 |
|
| 221 |
if ( ! class_exists( $class ) )
|
| 222 |
throw new Exception( 'Argument 1 for ' . __METHOD__ . ' must be a valid class' );
|
| 170 |
*
|
| 171 |
* @access public
|
| 172 |
*/
|
| 173 |
+
public static function get_services( HMBKP_Scheduled_Backup $schedule = null ) {
|
| 174 |
|
| 175 |
if ( is_null( $schedule ) )
|
| 176 |
return self::instance()->services;
|
| 186 |
*
|
| 187 |
* @access public
|
| 188 |
*/
|
| 189 |
+
public static function register( $filepath, $classname ) {
|
| 190 |
|
| 191 |
if ( ! file_exists( $filepath ) )
|
| 192 |
throw new Exception( 'Argument 1 for ' . __METHOD__ . ' must be a valid filepath' );
|
| 200 |
*
|
| 201 |
* @access public
|
| 202 |
*/
|
| 203 |
+
public static function unregister( $filepath ) {
|
| 204 |
|
| 205 |
if ( ! isset( self::instance()->services[$filepath] ) )
|
| 206 |
throw new Exception( 'Argument 1 for ' . __METHOD__ . ' must be a registered service' );
|
| 216 |
* @param string $class
|
| 217 |
* @return array An array of instantiated classes
|
| 218 |
*/
|
| 219 |
+
private static function instantiate( $class ) {
|
| 220 |
|
| 221 |
if ( ! class_exists( $class ) )
|
| 222 |
throw new Exception( 'Argument 1 for ' . __METHOD__ . ' must be a valid class' );
|
hm-backup/hm-backup.php
CHANGED
|
@@ -648,7 +648,9 @@ class HM_Backup {
|
|
| 648 |
|
| 649 |
$this->do_action( 'hmbkp_mysqldump_started' );
|
| 650 |
|
| 651 |
-
$host =
|
|
|
|
|
|
|
| 652 |
$port = strpos( DB_HOST, ':' ) ? end( explode( ':', DB_HOST ) ) : '';
|
| 653 |
|
| 654 |
// Path to the mysqldump executable
|
|
@@ -684,7 +686,10 @@ class HM_Backup {
|
|
| 684 |
$cmd .= ' 2>&1';
|
| 685 |
|
| 686 |
// Store any returned data in an error
|
| 687 |
-
$
|
|
|
|
|
|
|
|
|
|
| 688 |
|
| 689 |
$this->verify_mysqldump();
|
| 690 |
|
|
@@ -777,15 +782,18 @@ class HM_Backup {
|
|
| 777 |
|
| 778 |
// Zip up $this->root with excludes
|
| 779 |
if ( $this->get_type() !== 'database' && $this->exclude_string( 'zip' ) )
|
| 780 |
-
$
|
| 781 |
|
| 782 |
// Zip up $this->root without excludes
|
| 783 |
elseif ( $this->get_type() !== 'database' )
|
| 784 |
-
$
|
| 785 |
|
| 786 |
// Add the database dump to the archive
|
| 787 |
if ( $this->get_type() !== 'file' )
|
| 788 |
-
$
|
|
|
|
|
|
|
|
|
|
| 789 |
|
| 790 |
$this->verify_archive();
|
| 791 |
|
|
@@ -953,10 +961,6 @@ class HM_Backup {
|
|
| 953 |
if ( $this->get_errors( $this->get_archive_method() ) && file_exists( $this->get_archive_filepath() ) )
|
| 954 |
unlink( $this->get_archive_filepath() );
|
| 955 |
|
| 956 |
-
// Warn about unreadable files
|
| 957 |
-
if ( $this->get_unreadable_file_count() )
|
| 958 |
-
$this->warning( $this->get_archive_method(), __( 'The following files are unreadable and couldn\'t be backed up: ', 'hmbkp' ) . implode( ', ', $this->get_unreadable_files() ) );
|
| 959 |
-
|
| 960 |
// If the archive file still exists assume it's good
|
| 961 |
if ( file_exists( $this->get_archive_filepath() ) )
|
| 962 |
return $this->archive_verified = true;
|
|
@@ -979,7 +983,7 @@ class HM_Backup {
|
|
| 979 |
$this->files = array();
|
| 980 |
|
| 981 |
if ( defined( 'RecursiveDirectoryIterator::FOLLOW_SYMLINKS' ) )
|
| 982 |
-
$this->files = new RecursiveIteratorIterator( new
|
| 983 |
|
| 984 |
else
|
| 985 |
$this->files = $this->get_files_fallback( $this->get_root() );
|
|
@@ -1614,6 +1618,8 @@ class HM_Backup {
|
|
| 1614 |
if ( empty( $context ) || empty( $error ) )
|
| 1615 |
return;
|
| 1616 |
|
|
|
|
|
|
|
| 1617 |
$this->errors[$context][$_key = md5( implode( ':' , (array) $error ) )] = $error;
|
| 1618 |
|
| 1619 |
}
|
|
@@ -1669,6 +1675,8 @@ class HM_Backup {
|
|
| 1669 |
if ( empty( $context ) || empty( $warning ) )
|
| 1670 |
return;
|
| 1671 |
|
|
|
|
|
|
|
| 1672 |
$this->warnings[$context][$_key = md5( implode( ':' , (array) $warning ) )] = $warning;
|
| 1673 |
|
| 1674 |
}
|
|
@@ -1689,7 +1697,9 @@ class HM_Backup {
|
|
| 1689 |
|
| 1690 |
$args = func_get_args();
|
| 1691 |
|
| 1692 |
-
|
|
|
|
|
|
|
| 1693 |
|
| 1694 |
return false;
|
| 1695 |
|
|
@@ -1721,35 +1731,4 @@ function hmbkp_pclzip_callback( $event, &$file ) {
|
|
| 1721 |
|
| 1722 |
return true;
|
| 1723 |
|
| 1724 |
-
}
|
| 1725 |
-
|
| 1726 |
-
|
| 1727 |
-
/**
|
| 1728 |
-
* Custom RecursiveDirectoryIterator that catches exceptions in hasChildren
|
| 1729 |
-
*
|
| 1730 |
-
* @extends RecursiveDirectoryIterator
|
| 1731 |
-
*/
|
| 1732 |
-
class HMBKPRecursiveDirectoryIterator extends RecursiveDirectoryIterator {
|
| 1733 |
-
|
| 1734 |
-
|
| 1735 |
-
/**
|
| 1736 |
-
* Replace hasChildren with a version which.
|
| 1737 |
-
*
|
| 1738 |
-
* @access public
|
| 1739 |
-
* @return void
|
| 1740 |
-
*/
|
| 1741 |
-
function hasChildren() {
|
| 1742 |
-
|
| 1743 |
-
try {
|
| 1744 |
-
|
| 1745 |
-
return new HMBKPRecursiveDirectoryIterator( $this->getPathname() );
|
| 1746 |
-
|
| 1747 |
-
} catch( UnexpectedValueException $e ) {
|
| 1748 |
-
|
| 1749 |
-
return new RecursiveArrayIterator( array() );
|
| 1750 |
-
|
| 1751 |
-
}
|
| 1752 |
-
|
| 1753 |
-
}
|
| 1754 |
-
|
| 1755 |
}
|
| 648 |
|
| 649 |
$this->do_action( 'hmbkp_mysqldump_started' );
|
| 650 |
|
| 651 |
+
$host = explode( ':', DB_HOST );
|
| 652 |
+
|
| 653 |
+
$host = reset( $host );
|
| 654 |
$port = strpos( DB_HOST, ':' ) ? end( explode( ':', DB_HOST ) ) : '';
|
| 655 |
|
| 656 |
// Path to the mysqldump executable
|
| 686 |
$cmd .= ' 2>&1';
|
| 687 |
|
| 688 |
// Store any returned data in an error
|
| 689 |
+
$stderr = shell_exec( $cmd );
|
| 690 |
+
|
| 691 |
+
if ( $stderr )
|
| 692 |
+
$this->error( $this->get_mysqldump_method(), $stderr );
|
| 693 |
|
| 694 |
$this->verify_mysqldump();
|
| 695 |
|
| 782 |
|
| 783 |
// Zip up $this->root with excludes
|
| 784 |
if ( $this->get_type() !== 'database' && $this->exclude_string( 'zip' ) )
|
| 785 |
+
$stderr = shell_exec( 'cd ' . escapeshellarg( $this->get_root() ) . ' && ' . escapeshellcmd( $this->get_zip_command_path() ) . ' -rq ' . escapeshellarg( $this->get_archive_filepath() ) . ' ./' . ' -x ' . $this->exclude_string( 'zip' ) . ' 2>&1' );
|
| 786 |
|
| 787 |
// Zip up $this->root without excludes
|
| 788 |
elseif ( $this->get_type() !== 'database' )
|
| 789 |
+
$stderr = shell_exec( 'cd ' . escapeshellarg( $this->get_root() ) . ' && ' . escapeshellcmd( $this->get_zip_command_path() ) . ' -rq ' . escapeshellarg( $this->get_archive_filepath() ) . ' ./' . ' 2>&1' );
|
| 790 |
|
| 791 |
// Add the database dump to the archive
|
| 792 |
if ( $this->get_type() !== 'file' )
|
| 793 |
+
$stderr = shell_exec( 'cd ' . escapeshellarg( $this->get_path() ) . ' && ' . escapeshellcmd( $this->get_zip_command_path() ) . ' -uq ' . escapeshellarg( $this->get_archive_filepath() ) . ' ' . escapeshellarg( $this->get_database_dump_filename() ) . ' 2>&1' );
|
| 794 |
+
|
| 795 |
+
if ( $stderr )
|
| 796 |
+
$this->warning( $this->get_archive_method(), $stderr );
|
| 797 |
|
| 798 |
$this->verify_archive();
|
| 799 |
|
| 961 |
if ( $this->get_errors( $this->get_archive_method() ) && file_exists( $this->get_archive_filepath() ) )
|
| 962 |
unlink( $this->get_archive_filepath() );
|
| 963 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 964 |
// If the archive file still exists assume it's good
|
| 965 |
if ( file_exists( $this->get_archive_filepath() ) )
|
| 966 |
return $this->archive_verified = true;
|
| 983 |
$this->files = array();
|
| 984 |
|
| 985 |
if ( defined( 'RecursiveDirectoryIterator::FOLLOW_SYMLINKS' ) )
|
| 986 |
+
$this->files = new RecursiveIteratorIterator( new RecursiveDirectoryIterator( $this->get_root(), RecursiveDirectoryIterator::FOLLOW_SYMLINKS ), RecursiveIteratorIterator::SELF_FIRST, RecursiveIteratorIterator::CATCH_GET_CHILD );
|
| 987 |
|
| 988 |
else
|
| 989 |
$this->files = $this->get_files_fallback( $this->get_root() );
|
| 1618 |
if ( empty( $context ) || empty( $error ) )
|
| 1619 |
return;
|
| 1620 |
|
| 1621 |
+
$this->do_action( 'hmbkp_error' );
|
| 1622 |
+
|
| 1623 |
$this->errors[$context][$_key = md5( implode( ':' , (array) $error ) )] = $error;
|
| 1624 |
|
| 1625 |
}
|
| 1675 |
if ( empty( $context ) || empty( $warning ) )
|
| 1676 |
return;
|
| 1677 |
|
| 1678 |
+
$this->do_action( 'hmbkp_warning' );
|
| 1679 |
+
|
| 1680 |
$this->warnings[$context][$_key = md5( implode( ':' , (array) $warning ) )] = $warning;
|
| 1681 |
|
| 1682 |
}
|
| 1697 |
|
| 1698 |
$args = func_get_args();
|
| 1699 |
|
| 1700 |
+
array_shift( $args );
|
| 1701 |
+
|
| 1702 |
+
$this->warning( 'php', implode( ', ', array_splice( $args, 0, 3 ) ) );
|
| 1703 |
|
| 1704 |
return false;
|
| 1705 |
|
| 1731 |
|
| 1732 |
return true;
|
| 1733 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1734 |
}
|
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.2
|
| 9 |
Author URI: http://hmn.md/
|
| 10 |
*/
|
| 11 |
|
| 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.2.1
|
| 9 |
Author URI: http://hmn.md/
|
| 10 |
*/
|
| 11 |
|
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.2
|
| 7 |
|
| 8 |
Simple automated back ups of your WordPress powered website.
|
| 9 |
|
|
@@ -103,6 +103,15 @@ You can also tweet <a href="http://twitter.com/humanmadeltd">@humanmadeltd</a> o
|
|
| 103 |
|
| 104 |
== Changelog ==
|
| 105 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 106 |
#### 2.2
|
| 107 |
|
| 108 |
* Don't repeatedly try to create the backups directory in the `uploads` if `uploads` isn't writable.
|
| 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.2.1
|
| 7 |
|
| 8 |
Simple automated back ups of your WordPress powered website.
|
| 9 |
|
| 103 |
|
| 104 |
== Changelog ==
|
| 105 |
|
| 106 |
+
#### 2.2.1
|
| 107 |
+
|
| 108 |
+
* Stop storing a list of unreadable files in the backup warnings as it's too memory intensive.
|
| 109 |
+
* Revert the custom `RecursiveDirectoryIterator` as it caused an infinite loop on some servers.
|
| 110 |
+
* Show all errors and warnings in the popup shown when a manual backup completes.
|
| 111 |
+
* Write the .backup_error and .backup_warning files everytime an error or warning happens instead of waiting until the end of the backups process.
|
| 112 |
+
* Fix a couple of `PHP E_STRICT` notices.
|
| 113 |
+
* Catch more errors during the manual backup process and expose them to the user.
|
| 114 |
+
|
| 115 |
#### 2.2
|
| 116 |
|
| 117 |
* Don't repeatedly try to create the backups directory in the `uploads` if `uploads` isn't writable.
|
