WordPress.org

Make WordPress Core

Changeset 7369


Ignore:
Timestamp:
03/18/2008 12:13:11 AM (10 years ago)
Author:
ryan
Message:

Basedir location fixes for ftp fs from DD32. see #6245

Location:
trunk/wp-admin/includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/class-wp-filesystem-ftpext.php

    r7335 r7369  
    9696        if( empty( $base ) || '.' == $base ) $base = $this->cwd();
    9797        $base = trailingslashit($base);
    98        
     98
    9999        //Can we see the Current directory as part of the ABSPATH?
    100100        $location = strpos($abspath, $base);
    101101        if( false !== $location ){
    102102            $newbase = path_join($base, substr($abspath, $location + strlen($base)));
    103            
    104             if($echo) printf( __('Changing to %s') . '<br/>', $newbase );
     103
    105104            if( false !== $this->chdir($newbase) ){ //chdir sometimes returns null under certain circumstances, even when its changed correctly, FALSE will be returned if it doesnt change correctly.
    106                 $base = $newbase;
     105                if($echo) printf( __('Changing to %s') . '<br/>', $newbase );
    107106                //Check to see if it exists in that folder.
    108                 if( $this->exists($base . 'wp-settings.php') ){
    109                     if($echo) printf( __('Found %s'),  $base . 'wp-settings.php<br/>' );
    110                     $this->wp_base = $base;
    111                     return $this->wp_base;
     107                if( $this->exists($newbase . 'wp-settings.php') ){
     108                    if($echo) printf( __('Found %s'),  $newbase . 'wp-settings.php<br/>' );
     109                    return $newbase;
    112110                }   
    113111            }
     
    133131                    return $ret;
    134132            }
     133        }
     134        //Only check this as a last resort, to prevent locating the incorrect install. All above proceeedures will fail quickly if this is the right branch to take.
     135        if(isset( $files[ 'wp-settings.php' ]) ){
     136            if($echo) printf( __('Found %s'),  $base . 'wp-settings.php<br/>' );
     137            return $base;
    135138        }
    136139        return false;
  • trunk/wp-admin/includes/class-wp-filesystem-ftpsockets.php

    r7334 r7369  
    9898        if( empty( $base ) || '.' == $base ) $base = $this->cwd();
    9999        $base = trailingslashit($base);
    100        
     100
    101101        //Can we see the Current directory as part of the ABSPATH?
    102102        $location = strpos($abspath, $base);
    103103        if( false !== $location ){
    104104            $newbase = path_join($base, substr($abspath, $location + strlen($base)));
    105            
    106             if($echo) printf( __('Changing to %s') . '<br/>', $newbase );
     105
    107106            if( false !== $this->chdir($newbase) ){ //chdir sometimes returns null under certain circumstances, even when its changed correctly, FALSE will be returned if it doesnt change correctly.
    108                 $base = $newbase;
     107                if($echo) printf( __('Changing to %s') . '<br/>', $newbase );
    109108                //Check to see if it exists in that folder.
    110                 if( $this->exists($base . 'wp-settings.php') ){
    111                     if($echo) printf( __('Found %s'),  $base . 'wp-settings.php<br/>' );
    112                     $this->wp_base = $base;
    113                     return $this->wp_base;
     109                if( $this->exists($newbase . 'wp-settings.php') ){
     110                    if($echo) printf( __('Found %s'),  $newbase . 'wp-settings.php<br/>' );
     111                    return $newbase;
    114112                }   
    115113            }
     
    135133                    return $ret;
    136134            }
     135        }
     136        //Only check this as a last resort, to prevent locating the incorrect install. All above proceeedures will fail quickly if this is the right branch to take.
     137        if(isset( $files[ 'wp-settings.php' ]) ){
     138            if($echo) printf( __('Found %s'),  $base . 'wp-settings.php<br/>' );
     139            return $base;
    137140        }
    138141        return false;
Note: See TracChangeset for help on using the changeset viewer.