Plugin Directory

Changeset 730732


Ignore:
Timestamp:
06/24/2013 09:01:35 AM (13 years ago)
Author:
Driskell
Message:

Update

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wponlinebackup/trunk/include/files.php

    r724954 r730732  
    9090    /*private*/ function Normalise_Path( $path )
    9191    {
     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
    9297        // Strip duplicate slashes and turn any backslashes into forward slashes
    9398        return preg_replace( '#[/\\\\]+#', '/', $path );
     
    100105        $counter = 0;
    101106
    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 there
    103         $orig_root = preg_replace( '#(?:\\\\|/)$#', '', ABSPATH );
     107        // First strip any trailing slashes as we don't want them
     108        $root = preg_replace( '#(?:\\\\|/)$#', '', ABSPATH );
    104109
    105110        // Just check we can access the WordPress path
    106         if ( ( $root = @realpath( $orig_root ) ) === false ) {
     111        if ( ( $d = @opendir( $root ) ) === false ) {
    107112
    108113            $ret = OBFW_Tidy_Exception();
     
    111116                WPONLINEBACKUP_EVENT_ERROR,
    112117                // 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 )
    114119            );
    115120
     
    118123
    119124        }
     125
     126        @closedir( $d );
    120127
    121128        // 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
     
    461468
    462469                // Check we can access the parent folder first...
    463                 if ( @realpath( $this->job['root'] ) === false ) {
     470                if ( ( $d = @opendir( $this->job['root'] ) ) === false ) {
    464471
    465472                    // OK, can't access parent folder, report an error and try with filesystem_upone disabled
     
    471478
    472479                }
     480
     481                @closedir( $d );
    473482
    474483            } else {
Note: See TracChangeset for help on using the changeset viewer.