Version Description
Download this release
Release Info
| Developer | willmot |
| Plugin | |
| Version | 2.1.1 |
| Comparing to | |
| See all releases | |
Code changes from version 2.1 to 2.1.1
- admin/actions.php +3 -3
- admin/schedule.php +1 -1
- assets/hmbkp.js +1 -1
- classes/schedule.php +7 -3
- functions/core.php +4 -3
- functions/interface.php +2 -2
- hm-backup/hm-backup.php +59 -32
- plugin.php +1 -1
- readme.txt +11 -1
admin/actions.php
CHANGED
|
@@ -75,12 +75,14 @@ add_action( 'wp_ajax_hmbkp_run_schedule', 'hmbkp_ajax_request_do_backup' );
|
|
| 75 |
*/
|
| 76 |
function hmbkp_request_download_backup() {
|
| 77 |
|
|
|
|
|
|
|
| 78 |
if ( empty( $_GET['hmbkp_download_backup'] ) || ! check_admin_referer( 'hmbkp-download_backup' ) || ! file_exists( base64_decode( $_GET['hmbkp_download_backup'] ) ) )
|
| 79 |
return;
|
| 80 |
|
| 81 |
$url = str_replace( HM_Backup::conform_dir( HM_Backup::get_home_path() ), home_url(), trailingslashit( dirname( base64_decode( $_GET['hmbkp_download_backup'] ) ) ) ) . urlencode( pathinfo( base64_decode( $_GET['hmbkp_download_backup'] ), PATHINFO_BASENAME ) );
|
| 82 |
|
| 83 |
-
if (
|
| 84 |
|
| 85 |
// Force the .htaccess to be rebuilt
|
| 86 |
if ( file_exists( hmbkp_path() . '/.htaccess' ) )
|
|
@@ -381,8 +383,6 @@ function hmbkp_preview_exclude_rule() {
|
|
| 381 |
|
| 382 |
$schedule->set_excludes( $excludes );
|
| 383 |
|
| 384 |
-
error_log( $schedule->get_excluded_file_count() );
|
| 385 |
-
|
| 386 |
if ( $schedule->get_excluded_file_count() ) { ?>
|
| 387 |
|
| 388 |
<p><?php printf( _n( '%s matches 1 file.', '%1$s matches %2$d files.', $schedule->get_excluded_file_count(), 'hmbkp' ), '<code>' . implode( '</code>, <code>', $excludes ) . '</code>', $schedule->get_excluded_file_count() ); ?></p>
|
| 75 |
*/
|
| 76 |
function hmbkp_request_download_backup() {
|
| 77 |
|
| 78 |
+
global $is_apache;
|
| 79 |
+
|
| 80 |
if ( empty( $_GET['hmbkp_download_backup'] ) || ! check_admin_referer( 'hmbkp-download_backup' ) || ! file_exists( base64_decode( $_GET['hmbkp_download_backup'] ) ) )
|
| 81 |
return;
|
| 82 |
|
| 83 |
$url = str_replace( HM_Backup::conform_dir( HM_Backup::get_home_path() ), home_url(), trailingslashit( dirname( base64_decode( $_GET['hmbkp_download_backup'] ) ) ) ) . urlencode( pathinfo( base64_decode( $_GET['hmbkp_download_backup'] ), PATHINFO_BASENAME ) );
|
| 84 |
|
| 85 |
+
if ( $is_apache ) {
|
| 86 |
|
| 87 |
// Force the .htaccess to be rebuilt
|
| 88 |
if ( file_exists( hmbkp_path() . '/.htaccess' ) )
|
| 383 |
|
| 384 |
$schedule->set_excludes( $excludes );
|
| 385 |
|
|
|
|
|
|
|
| 386 |
if ( $schedule->get_excluded_file_count() ) { ?>
|
| 387 |
|
| 388 |
<p><?php printf( _n( '%s matches 1 file.', '%1$s matches %2$d files.', $schedule->get_excluded_file_count(), 'hmbkp' ), '<code>' . implode( '</code>, <code>', $excludes ) . '</code>', $schedule->get_excluded_file_count() ); ?></p>
|
admin/schedule.php
CHANGED
|
@@ -93,7 +93,7 @@ foreach ( HMBKP_Services::get_services( $schedule ) as $file => $service )
|
|
| 93 |
|
| 94 |
<div class="hmbkp-schedule-sentence<?php if ( $schedule->get_status() ) { ?> hmbkp-running<?php } ?>">
|
| 95 |
|
| 96 |
-
<?php printf( __( 'Backup my %1$s %2$s %3$s, %4$s. %5$s', 'hmbkp' ), $filesize, '<span>' . $type . '</span>', $reoccurrence, $backup_to_keep, implode( '. ', $services ) ); ?>
|
| 97 |
|
| 98 |
<?php hmbkp_schedule_actions( $schedule ); ?>
|
| 99 |
|
| 93 |
|
| 94 |
<div class="hmbkp-schedule-sentence<?php if ( $schedule->get_status() ) { ?> hmbkp-running<?php } ?>">
|
| 95 |
|
| 96 |
+
<?php printf( __( 'Backup my %1$s %2$s %3$s, %4$s. %5$s', 'hmbkp' ), $filesize, '<span>' . $type . '</span>', $reoccurrence, $backup_to_keep, implode( '. ', array_filter( $services ) ) ); ?>
|
| 97 |
|
| 98 |
<?php hmbkp_schedule_actions( $schedule ); ?>
|
| 99 |
|
assets/hmbkp.js
CHANGED
|
@@ -29,7 +29,7 @@ jQuery( document ).ready( function( $ ) {
|
|
| 29 |
|
| 30 |
$( '.hmbkp-tabs' ).tabs();
|
| 31 |
|
| 32 |
-
if ( $(
|
| 33 |
$( '<button type="button" class="button-secondary hmbkp-fancybox-close">' + objectL10n.cancel + '</button></p>' ).appendTo( '.hmbkp-form p.submit' );
|
| 34 |
|
| 35 |
}
|
| 29 |
|
| 30 |
$( '.hmbkp-tabs' ).tabs();
|
| 31 |
|
| 32 |
+
if ( $( ".hmbkp-form p.submit:contains('" + objectL10n.update + "')" ).size() )
|
| 33 |
$( '<button type="button" class="button-secondary hmbkp-fancybox-close">' + objectL10n.cancel + '</button></p>' ).appendTo( '.hmbkp-form p.submit' );
|
| 34 |
|
| 35 |
}
|
classes/schedule.php
CHANGED
|
@@ -94,7 +94,7 @@ class HMBKP_Scheduled_Backup extends HM_Backup {
|
|
| 94 |
$this->set_path( hmbkp_path() );
|
| 95 |
|
| 96 |
// Set the archive filename to site name + schedule slug + date
|
| 97 |
-
$this->set_archive_filename( implode( '-', array( sanitize_title(
|
| 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() ) ) )
|
|
@@ -306,8 +306,12 @@ class HMBKP_Scheduled_Backup extends HM_Backup {
|
|
| 306 |
|
| 307 |
foreach ( $this->get_files() as $file ) {
|
| 308 |
|
| 309 |
-
|
| 310 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 311 |
|
| 312 |
// Excludes
|
| 313 |
if ( $excludes && preg_match( '(' . $excludes . ')', str_ireplace( trailingslashit( $this->get_root() ), '', HM_Backup::conform_dir( $file->getPathname() ) ) ) )
|
| 94 |
$this->set_path( hmbkp_path() );
|
| 95 |
|
| 96 |
// Set the archive filename to site name + schedule slug + date
|
| 97 |
+
$this->set_archive_filename( implode( '-', array( sanitize_title( str_ireplace( array( 'http://', 'https://', 'www' ), '', home_url() ) ), $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() ) ) )
|
| 306 |
|
| 307 |
foreach ( $this->get_files() as $file ) {
|
| 308 |
|
| 309 |
+
// Skip dot files, they should only exist on versions of PHP between 5.2.11 -> 5.3
|
| 310 |
+
if ( method_exists( $file, 'isDot' ) && $file->isDot() )
|
| 311 |
+
continue;
|
| 312 |
+
|
| 313 |
+
if ( ! $file->isReadable() )
|
| 314 |
+
continue;
|
| 315 |
|
| 316 |
// Excludes
|
| 317 |
if ( $excludes && preg_match( '(' . $excludes . ')', str_ireplace( trailingslashit( $this->get_root() ), '', HM_Backup::conform_dir( $file->getPathname() ) ) ) )
|
functions/core.php
CHANGED
|
@@ -261,6 +261,8 @@ function hmbkp_rmdirtree( $dir ) {
|
|
| 261 |
*/
|
| 262 |
function hmbkp_path() {
|
| 263 |
|
|
|
|
|
|
|
| 264 |
$path = get_option( 'hmbkp_path' );
|
| 265 |
|
| 266 |
// Allow the backups path to be defined
|
|
@@ -286,7 +288,7 @@ function hmbkp_path() {
|
|
| 286 |
file_put_contents( $index, '' );
|
| 287 |
|
| 288 |
// Protect the directory with a .htaccess file on Apache servers
|
| 289 |
-
if (
|
| 290 |
|
| 291 |
$htaccess = $path . '/.htaccess';
|
| 292 |
|
|
@@ -299,8 +301,7 @@ function hmbkp_path() {
|
|
| 299 |
$contents[] = '</IfModule>';
|
| 300 |
$contents[] = '';
|
| 301 |
|
| 302 |
-
|
| 303 |
-
insert_with_markers( $htaccess, 'BackUpWordPress', $contents );
|
| 304 |
|
| 305 |
}
|
| 306 |
|
| 261 |
*/
|
| 262 |
function hmbkp_path() {
|
| 263 |
|
| 264 |
+
global $is_apache;
|
| 265 |
+
|
| 266 |
$path = get_option( 'hmbkp_path' );
|
| 267 |
|
| 268 |
// Allow the backups path to be defined
|
| 288 |
file_put_contents( $index, '' );
|
| 289 |
|
| 290 |
// Protect the directory with a .htaccess file on Apache servers
|
| 291 |
+
if ( $is_apache && function_exists( 'insert_with_markers' ) && ! file_exists( $htaccess ) && is_writable( $path ) ) {
|
| 292 |
|
| 293 |
$htaccess = $path . '/.htaccess';
|
| 294 |
|
| 301 |
$contents[] = '</IfModule>';
|
| 302 |
$contents[] = '';
|
| 303 |
|
| 304 |
+
insert_with_markers( $htaccess, 'BackUpWordPress', $contents );
|
|
|
|
| 305 |
|
| 306 |
}
|
| 307 |
|
functions/interface.php
CHANGED
|
@@ -174,8 +174,8 @@ function hmbkp_file_list( HMBKP_Scheduled_Backup $schedule, $excludes = null, $f
|
|
| 174 |
if ( ! is_null( $excludes ) && strpos( $file, str_ireplace( $schedule->get_root(), '', $schedule->get_path() ) ) !== false )
|
| 175 |
continue;
|
| 176 |
|
| 177 |
-
// Skip
|
| 178 |
-
if ( $file
|
| 179 |
continue;
|
| 180 |
|
| 181 |
// Show only unreadable files
|
| 174 |
if ( ! is_null( $excludes ) && strpos( $file, str_ireplace( $schedule->get_root(), '', $schedule->get_path() ) ) !== false )
|
| 175 |
continue;
|
| 176 |
|
| 177 |
+
// Skip dot files, they should only exist on versions of PHP between 5.2.11 -> 5.3
|
| 178 |
+
if ( method_exists( $file, 'isDot' ) && $file->isDot() )
|
| 179 |
continue;
|
| 180 |
|
| 181 |
// Show only unreadable files
|
hm-backup/hm-backup.php
CHANGED
|
@@ -270,7 +270,7 @@ class HM_Backup {
|
|
| 270 |
public function get_archive_filename() {
|
| 271 |
|
| 272 |
if ( empty( $this->archive_filename ) )
|
| 273 |
-
$this->set_archive_filename( implode( '-', array( sanitize_title(
|
| 274 |
|
| 275 |
return $this->archive_filename;
|
| 276 |
|
|
@@ -350,7 +350,7 @@ class HM_Backup {
|
|
| 350 |
public function get_root() {
|
| 351 |
|
| 352 |
if ( empty( $this->root ) )
|
| 353 |
-
$this->set_root(
|
| 354 |
|
| 355 |
return $this->root;
|
| 356 |
|
|
@@ -368,7 +368,7 @@ class HM_Backup {
|
|
| 368 |
if ( empty( $path ) || ! is_string( $path ) || ! is_dir ( $path ) )
|
| 369 |
throw new Exception( 'Invalid root path <code>' . $path . '</code> must be a valid directory path' );
|
| 370 |
|
| 371 |
-
$this->root =
|
| 372 |
|
| 373 |
}
|
| 374 |
|
|
@@ -381,7 +381,7 @@ class HM_Backup {
|
|
| 381 |
public function get_path() {
|
| 382 |
|
| 383 |
if ( empty( $this->path ) )
|
| 384 |
-
$this->set_path(
|
| 385 |
|
| 386 |
return $this->path;
|
| 387 |
|
|
@@ -399,7 +399,7 @@ class HM_Backup {
|
|
| 399 |
if ( empty( $path ) || ! is_string( $path ) )
|
| 400 |
throw new Exception( 'Invalid backup path <code>' . $path . '</code> must be a non empty (string)' );
|
| 401 |
|
| 402 |
-
$this->path =
|
| 403 |
|
| 404 |
}
|
| 405 |
|
|
@@ -511,7 +511,7 @@ class HM_Backup {
|
|
| 511 |
|
| 512 |
// Find the one which works
|
| 513 |
foreach ( $mysqldump_locations as $location )
|
| 514 |
-
if ( is_executable(
|
| 515 |
$this->set_mysqldump_command_path( $location );
|
| 516 |
|
| 517 |
return $this->mysqldump_command_path;
|
|
@@ -572,7 +572,7 @@ class HM_Backup {
|
|
| 572 |
|
| 573 |
// Find the one which works
|
| 574 |
foreach ( $zip_locations as $location )
|
| 575 |
-
if ( is_executable(
|
| 576 |
$this->set_zip_command_path( $location );
|
| 577 |
|
| 578 |
return $this->zip_command_path;
|
|
@@ -817,18 +817,23 @@ class HM_Backup {
|
|
| 817 |
|
| 818 |
foreach ( $this->get_files() as $file ) {
|
| 819 |
|
| 820 |
-
|
| 821 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 822 |
|
| 823 |
// Excludes
|
| 824 |
-
if ( $excludes && preg_match( '(' . $excludes . ')', str_ireplace( trailingslashit( $this->get_root() ), '',
|
| 825 |
continue;
|
| 826 |
|
| 827 |
if ( $file->isDir() )
|
| 828 |
-
$zip->addEmptyDir( trailingslashit( str_ireplace( trailingslashit( $this->get_root() ), '',
|
| 829 |
|
| 830 |
elseif ( $file->isFile() )
|
| 831 |
-
$zip->addFile( $file->getPathname(), str_ireplace( trailingslashit( $this->get_root() ), '',
|
| 832 |
|
| 833 |
if ( ++$files_added % 500 === 0 )
|
| 834 |
if ( ! $zip->close() || ! $zip->open( $this->get_archive_filepath(), ZIPARCHIVE::CREATE ) )
|
|
@@ -947,7 +952,7 @@ class HM_Backup {
|
|
| 947 |
if ( $this->get_errors( $this->get_archive_method() ) )
|
| 948 |
return false;
|
| 949 |
|
| 950 |
-
if ( $this->
|
| 951 |
$this->warning( $this->get_archive_method(), __( 'The following files are unreadable and couldn\'t be backed up: ', 'hmbkp' ) . implode( ', ', $this->get_unreadable_files() ) );
|
| 952 |
|
| 953 |
return $this->archive_verified = true;
|
|
@@ -996,11 +1001,11 @@ class HM_Backup {
|
|
| 996 |
|
| 997 |
while ( $file = readdir( $handle ) ) :
|
| 998 |
|
| 999 |
-
// Ignore current dir and containing dir
|
| 1000 |
if ( $file === '.' || $file === '..' )
|
| 1001 |
continue;
|
| 1002 |
|
| 1003 |
-
$filepath =
|
| 1004 |
$file = str_ireplace( trailingslashit( $this->get_root() ), '', $filepath );
|
| 1005 |
|
| 1006 |
$files[] = new SplFileInfo( $filepath );
|
|
@@ -1031,11 +1036,16 @@ class HM_Backup {
|
|
| 1031 |
|
| 1032 |
foreach ( $this->get_files() as $file ) {
|
| 1033 |
|
| 1034 |
-
|
| 1035 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1036 |
|
| 1037 |
// Excludes
|
| 1038 |
-
if ( $excludes && preg_match( '(' . $excludes . ')', str_ireplace( trailingslashit( $this->get_root() ), '',
|
| 1039 |
continue;
|
| 1040 |
|
| 1041 |
$this->included_files[] = $file;
|
|
@@ -1063,11 +1073,16 @@ class HM_Backup {
|
|
| 1063 |
|
| 1064 |
foreach ( $this->get_files() as $file ) {
|
| 1065 |
|
| 1066 |
-
|
| 1067 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1068 |
|
| 1069 |
// Excludes
|
| 1070 |
-
if ( $excludes && preg_match( '(' . $excludes . ')', str_ireplace( trailingslashit( $this->get_root() ), '',
|
| 1071 |
continue;
|
| 1072 |
|
| 1073 |
$this->included_file_count++;
|
|
@@ -1095,11 +1110,16 @@ class HM_Backup {
|
|
| 1095 |
|
| 1096 |
foreach ( $this->get_files() as $file ) {
|
| 1097 |
|
| 1098 |
-
|
| 1099 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1100 |
|
| 1101 |
// Excludes
|
| 1102 |
-
if ( $excludes && preg_match( '(' . $excludes . ')', str_ireplace( trailingslashit( $this->get_root() ), '',
|
| 1103 |
$this->excluded_files[] = $file;
|
| 1104 |
|
| 1105 |
}
|
|
@@ -1125,11 +1145,16 @@ class HM_Backup {
|
|
| 1125 |
|
| 1126 |
foreach ( $this->get_files() as $file ) {
|
| 1127 |
|
| 1128 |
-
|
| 1129 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1130 |
|
| 1131 |
// Excludes
|
| 1132 |
-
if ( $excludes && preg_match( '(' . $excludes . ')', str_ireplace( trailingslashit( $this->get_root() ), '',
|
| 1133 |
$this->excluded_file_count++;
|
| 1134 |
|
| 1135 |
}
|
|
@@ -1153,8 +1178,9 @@ class HM_Backup {
|
|
| 1153 |
|
| 1154 |
foreach ( $this->get_files() as $file ) {
|
| 1155 |
|
| 1156 |
-
|
| 1157 |
-
|
|
|
|
| 1158 |
|
| 1159 |
if ( ! $file->isReadable() )
|
| 1160 |
$this->unreadable_files[] = $file;
|
|
@@ -1180,8 +1206,9 @@ class HM_Backup {
|
|
| 1180 |
|
| 1181 |
foreach ( $this->get_files() as $file ) {
|
| 1182 |
|
| 1183 |
-
|
| 1184 |
-
|
|
|
|
| 1185 |
|
| 1186 |
if ( ! $file->isReadable() )
|
| 1187 |
$this->get_unreadable_file_count++;
|
|
@@ -1291,7 +1318,7 @@ class HM_Backup {
|
|
| 1291 |
$fragment = true;
|
| 1292 |
|
| 1293 |
// Strip $this->root and conform
|
| 1294 |
-
$rule = str_ireplace( $this->get_root(), '', untrailingslashit(
|
| 1295 |
|
| 1296 |
// Strip the preceeding slash
|
| 1297 |
if ( in_array( substr( $rule, 0, 1 ), array( '\\', '/' ) ) )
|
| 270 |
public function get_archive_filename() {
|
| 271 |
|
| 272 |
if ( empty( $this->archive_filename ) )
|
| 273 |
+
$this->set_archive_filename( implode( '-', array( sanitize_title( str_ireplace( array( 'http://', 'https://', 'www' ), '', home_url() ) ), 'backup', date( 'Y-m-d-H-i-s', current_time( 'timestamp' ) ) ) ) . '.zip' );
|
| 274 |
|
| 275 |
return $this->archive_filename;
|
| 276 |
|
| 350 |
public function get_root() {
|
| 351 |
|
| 352 |
if ( empty( $this->root ) )
|
| 353 |
+
$this->set_root( self::conform_dir( self::get_home_path() ) );
|
| 354 |
|
| 355 |
return $this->root;
|
| 356 |
|
| 368 |
if ( empty( $path ) || ! is_string( $path ) || ! is_dir ( $path ) )
|
| 369 |
throw new Exception( 'Invalid root path <code>' . $path . '</code> must be a valid directory path' );
|
| 370 |
|
| 371 |
+
$this->root = self::conform_dir( $path );
|
| 372 |
|
| 373 |
}
|
| 374 |
|
| 381 |
public function get_path() {
|
| 382 |
|
| 383 |
if ( empty( $this->path ) )
|
| 384 |
+
$this->set_path( self::conform_dir( hmbkp_path_default() ) );
|
| 385 |
|
| 386 |
return $this->path;
|
| 387 |
|
| 399 |
if ( empty( $path ) || ! is_string( $path ) )
|
| 400 |
throw new Exception( 'Invalid backup path <code>' . $path . '</code> must be a non empty (string)' );
|
| 401 |
|
| 402 |
+
$this->path = self::conform_dir( $path );
|
| 403 |
|
| 404 |
}
|
| 405 |
|
| 511 |
|
| 512 |
// Find the one which works
|
| 513 |
foreach ( $mysqldump_locations as $location )
|
| 514 |
+
if ( is_executable( self::conform_dir( $location ) ) )
|
| 515 |
$this->set_mysqldump_command_path( $location );
|
| 516 |
|
| 517 |
return $this->mysqldump_command_path;
|
| 572 |
|
| 573 |
// Find the one which works
|
| 574 |
foreach ( $zip_locations as $location )
|
| 575 |
+
if ( is_executable( self::conform_dir( $location ) ) )
|
| 576 |
$this->set_zip_command_path( $location );
|
| 577 |
|
| 578 |
return $this->zip_command_path;
|
| 817 |
|
| 818 |
foreach ( $this->get_files() as $file ) {
|
| 819 |
|
| 820 |
+
// Skip dot files, they should only exist on versions of PHP between 5.2.11 -> 5.3
|
| 821 |
+
if ( method_exists( $file, 'isDot' ) && $file->isDot() )
|
| 822 |
+
continue;
|
| 823 |
+
|
| 824 |
+
// Skip unreadable files
|
| 825 |
+
if ( ! $file->isReadable() )
|
| 826 |
+
continue;
|
| 827 |
|
| 828 |
// Excludes
|
| 829 |
+
if ( $excludes && preg_match( '(' . $excludes . ')', str_ireplace( trailingslashit( $this->get_root() ), '', self::conform_dir( $file->getPathname() ) ) ) )
|
| 830 |
continue;
|
| 831 |
|
| 832 |
if ( $file->isDir() )
|
| 833 |
+
$zip->addEmptyDir( trailingslashit( str_ireplace( trailingslashit( $this->get_root() ), '', self::conform_dir( $file->getPathname() ) ) ) );
|
| 834 |
|
| 835 |
elseif ( $file->isFile() )
|
| 836 |
+
$zip->addFile( $file->getPathname(), str_ireplace( trailingslashit( $this->get_root() ), '', self::conform_dir( $file->getPathname() ) ) );
|
| 837 |
|
| 838 |
if ( ++$files_added % 500 === 0 )
|
| 839 |
if ( ! $zip->close() || ! $zip->open( $this->get_archive_filepath(), ZIPARCHIVE::CREATE ) )
|
| 952 |
if ( $this->get_errors( $this->get_archive_method() ) )
|
| 953 |
return false;
|
| 954 |
|
| 955 |
+
if ( $this->get_unreadable_file_count() )
|
| 956 |
$this->warning( $this->get_archive_method(), __( 'The following files are unreadable and couldn\'t be backed up: ', 'hmbkp' ) . implode( ', ', $this->get_unreadable_files() ) );
|
| 957 |
|
| 958 |
return $this->archive_verified = true;
|
| 1001 |
|
| 1002 |
while ( $file = readdir( $handle ) ) :
|
| 1003 |
|
| 1004 |
+
// Ignore current dir and containing dir
|
| 1005 |
if ( $file === '.' || $file === '..' )
|
| 1006 |
continue;
|
| 1007 |
|
| 1008 |
+
$filepath = self::conform_dir( trailingslashit( $dir ) . $file );
|
| 1009 |
$file = str_ireplace( trailingslashit( $this->get_root() ), '', $filepath );
|
| 1010 |
|
| 1011 |
$files[] = new SplFileInfo( $filepath );
|
| 1036 |
|
| 1037 |
foreach ( $this->get_files() as $file ) {
|
| 1038 |
|
| 1039 |
+
// Skip dot files, they should only exist on versions of PHP between 5.2.11 -> 5.3
|
| 1040 |
+
if ( method_exists( $file, 'isDot' ) && $file->isDot() )
|
| 1041 |
+
continue;
|
| 1042 |
+
|
| 1043 |
+
// Skip unreadable files
|
| 1044 |
+
if ( ! $file->isReadable() )
|
| 1045 |
+
continue;
|
| 1046 |
|
| 1047 |
// Excludes
|
| 1048 |
+
if ( $excludes && preg_match( '(' . $excludes . ')', str_ireplace( trailingslashit( $this->get_root() ), '', self::conform_dir( $file->getPathname() ) ) ) )
|
| 1049 |
continue;
|
| 1050 |
|
| 1051 |
$this->included_files[] = $file;
|
| 1073 |
|
| 1074 |
foreach ( $this->get_files() as $file ) {
|
| 1075 |
|
| 1076 |
+
// Skip dot files, they should only exist on versions of PHP between 5.2.11 -> 5.3
|
| 1077 |
+
if ( method_exists( $file, 'isDot' ) && $file->isDot() )
|
| 1078 |
+
continue;
|
| 1079 |
+
|
| 1080 |
+
// Skip unreadable files
|
| 1081 |
+
if ( ! $file->isReadable() )
|
| 1082 |
+
continue;
|
| 1083 |
|
| 1084 |
// Excludes
|
| 1085 |
+
if ( $excludes && preg_match( '(' . $excludes . ')', str_ireplace( trailingslashit( $this->get_root() ), '', self::conform_dir( $file->getPathname() ) ) ) )
|
| 1086 |
continue;
|
| 1087 |
|
| 1088 |
$this->included_file_count++;
|
| 1110 |
|
| 1111 |
foreach ( $this->get_files() as $file ) {
|
| 1112 |
|
| 1113 |
+
// Skip dot files, they should only exist on versions of PHP between 5.2.11 -> 5.3
|
| 1114 |
+
if ( method_exists( $file, 'isDot' ) && $file->isDot() )
|
| 1115 |
+
continue;
|
| 1116 |
+
|
| 1117 |
+
// Skip unreadable files
|
| 1118 |
+
if ( ! $file->isReadable() )
|
| 1119 |
+
continue;
|
| 1120 |
|
| 1121 |
// Excludes
|
| 1122 |
+
if ( $excludes && preg_match( '(' . $excludes . ')', str_ireplace( trailingslashit( $this->get_root() ), '', self::conform_dir( $file->getPathname() ) ) ) )
|
| 1123 |
$this->excluded_files[] = $file;
|
| 1124 |
|
| 1125 |
}
|
| 1145 |
|
| 1146 |
foreach ( $this->get_files() as $file ) {
|
| 1147 |
|
| 1148 |
+
// Skip dot files, they should only exist on versions of PHP between 5.2.11 -> 5.3
|
| 1149 |
+
if ( method_exists( $file, 'isDot' ) && $file->isDot() )
|
| 1150 |
+
continue;
|
| 1151 |
+
|
| 1152 |
+
// Skip unreadable files
|
| 1153 |
+
if ( ! $file->isReadable() )
|
| 1154 |
+
continue;
|
| 1155 |
|
| 1156 |
// Excludes
|
| 1157 |
+
if ( $excludes && preg_match( '(' . $excludes . ')', str_ireplace( trailingslashit( $this->get_root() ), '', self::conform_dir( $file->getPathname() ) ) ) )
|
| 1158 |
$this->excluded_file_count++;
|
| 1159 |
|
| 1160 |
}
|
| 1178 |
|
| 1179 |
foreach ( $this->get_files() as $file ) {
|
| 1180 |
|
| 1181 |
+
// Skip dot files, they should only exist on versions of PHP between 5.2.11 -> 5.3
|
| 1182 |
+
if ( method_exists( $file, 'isDot' ) && $file->isDot() )
|
| 1183 |
+
continue;
|
| 1184 |
|
| 1185 |
if ( ! $file->isReadable() )
|
| 1186 |
$this->unreadable_files[] = $file;
|
| 1206 |
|
| 1207 |
foreach ( $this->get_files() as $file ) {
|
| 1208 |
|
| 1209 |
+
// Skip dot files, they should only exist on versions of PHP between 5.2.11 -> 5.3
|
| 1210 |
+
if ( method_exists( $file, 'isDot' ) && $file->isDot() )
|
| 1211 |
+
continue;
|
| 1212 |
|
| 1213 |
if ( ! $file->isReadable() )
|
| 1214 |
$this->get_unreadable_file_count++;
|
| 1318 |
$fragment = true;
|
| 1319 |
|
| 1320 |
// Strip $this->root and conform
|
| 1321 |
+
$rule = str_ireplace( $this->get_root(), '', untrailingslashit( self::conform_dir( $rule ) ) );
|
| 1322 |
|
| 1323 |
// Strip the preceeding slash
|
| 1324 |
if ( in_array( substr( $rule, 0, 1 ), array( '\\', '/' ) ) )
|
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.1
|
| 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.1.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.1
|
| 7 |
|
| 8 |
Simple automated back ups of your WordPress powered website.
|
| 9 |
|
|
@@ -103,6 +103,16 @@ You can also tweet <a href="http://twitter.com/humanmadeltd">@humanmadeltd</a> o
|
|
| 103 |
|
| 104 |
== Changelog ==
|
| 105 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 106 |
#### 2.1
|
| 107 |
|
| 108 |
* Stop blocking people with `safe_mode = On` from using the plugin, instead just show a warning.
|
| 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.1.1
|
| 7 |
|
| 8 |
Simple automated back ups of your WordPress powered website.
|
| 9 |
|
| 103 |
|
| 104 |
== Changelog ==
|
| 105 |
|
| 106 |
+
#### 2.1.1
|
| 107 |
+
|
| 108 |
+
* Fix a possible fatal error when a backup schedule is instantiated outside of wp-admin.
|
| 109 |
+
* Don't use functions from misc.php as loading it too early can cause fatal errors.
|
| 110 |
+
* Don't hardcode an English string in the JS, use the translated string instead.
|
| 111 |
+
* Properly skip dot files, should fix fatal errors on systems with `open_basedir` restrictions.
|
| 112 |
+
* Don't call `apache_mod_loaded` as it caused wierd DNS issue on some sites, use `global $is_apache` instead.
|
| 113 |
+
* Fix a possible double full stop at the end of the schedule sentence.
|
| 114 |
+
* Minor code cleanup.
|
| 115 |
+
|
| 116 |
#### 2.1
|
| 117 |
|
| 118 |
* Stop blocking people with `safe_mode = On` from using the plugin, instead just show a warning.
|
