Changeset 730732
- Timestamp:
- 06/24/2013 09:01:35 AM (13 years ago)
- File:
-
- 1 edited
-
wponlinebackup/trunk/include/files.php (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wponlinebackup/trunk/include/files.php
r724954 r730732 90 90 /*private*/ function Normalise_Path( $path ) 91 91 { 92 // Use realpath if we can - if we don't have executable permissions on all folders this can return false, but we should allow that 93 // On Windows it can sometimes also return false and in that case without even reporting an error 94 if ( ( $new_path = @realpath( $path ) ) !== false ) 95 $path = $new_path; 96 92 97 // Strip duplicate slashes and turn any backslashes into forward slashes 93 98 return preg_replace( '#[/\\\\]+#', '/', $path ); … … 100 105 $counter = 0; 101 106 102 // Resolve the root path - no need to Normalise_Path orig_root since it is only used in the Log_Event below when we fail to resolve it and we Normalise it there103 $ orig_root = preg_replace( '#(?:\\\\|/)$#', '', ABSPATH );107 // First strip any trailing slashes as we don't want them 108 $root = preg_replace( '#(?:\\\\|/)$#', '', ABSPATH ); 104 109 105 110 // Just check we can access the WordPress path 106 if ( ( $ root = @realpath( $orig_root ) ) === false ) {111 if ( ( $d = @opendir( $root ) ) === false ) { 107 112 108 113 $ret = OBFW_Tidy_Exception(); … … 111 116 WPONLINEBACKUP_EVENT_ERROR, 112 117 // For consistency, normalise the root before placing it in the error message 113 sprintf( __( 'Skipping filesystem backup due to an error: Could not access %s. %s' , 'wponlinebackup' ), WPOnlineBackup_Functions::UTF8_Validate( $this->Normalise_Path( $ orig_root ) ), $ret )118 sprintf( __( 'Skipping filesystem backup due to an error: Could not access %s. %s' , 'wponlinebackup' ), WPOnlineBackup_Functions::UTF8_Validate( $this->Normalise_Path( $root ) ), $ret ) 114 119 ); 115 120 … … 118 123 119 124 } 125 126 @closedir( $d ); 120 127 121 128 // Normalise the root path - along with excludes these are the only inputs that will have directory separators in them - everywhere else we build the path ourselves with a single forward slash so will never need to normalise anywhere else … … 461 468 462 469 // Check we can access the parent folder first... 463 if ( @realpath( $this->job['root']) === false ) {470 if ( ( $d = @opendir( $this->job['root'] ) ) === false ) { 464 471 465 472 // OK, can't access parent folder, report an error and try with filesystem_upone disabled … … 471 478 472 479 } 480 481 @closedir( $d ); 473 482 474 483 } else {
Note: See TracChangeset
for help on using the changeset viewer.