FTP find_base_dir fixes from DD32. see #5586
git-svn-id: https://develop.svn.wordpress.org/trunk@7443 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
7c3a60b224
commit
90571b05c1
@ -84,7 +84,7 @@ class WP_Filesystem_FTPext{
|
||||
$this->permission = $perm;
|
||||
}
|
||||
|
||||
function find_base_dir($base = '.',$echo = false) {
|
||||
function find_base_dir($base = '.',$echo = false, $loop = false) {
|
||||
//Sanitize the Windows path formats, This allows easier conparison and aligns it to FTP output.
|
||||
$abspath = str_replace('\\','/',ABSPATH); //windows: Straighten up the paths..
|
||||
if( strpos($abspath, ':') ){ //Windows, Strip out the driveletter
|
||||
@ -126,7 +126,7 @@ class WP_Filesystem_FTPext{
|
||||
//Lets try that folder:
|
||||
$folder = path_join($base, $key);
|
||||
if($echo) printf( __('Changing to %s') . '<br/>', $folder );
|
||||
$ret = $this->find_base_dir( $folder, $echo);
|
||||
$ret = $this->find_base_dir( $folder, $echo, $loop);
|
||||
if( $ret )
|
||||
return $ret;
|
||||
}
|
||||
@ -136,7 +136,10 @@ class WP_Filesystem_FTPext{
|
||||
if($echo) printf( __('Found %s'), $base . 'wp-settings.php<br/>' );
|
||||
return $base;
|
||||
}
|
||||
return false;
|
||||
if( $loop )
|
||||
return false;//Prevent tihs function looping again.
|
||||
//As an extra last resort, Change back to / if the folder wasnt found. This comes into effect when the CWD is /home/user/ but WP is at /var/www/.... mainly dedicated setups.
|
||||
return $this->find_base_dir('/', $echo, true);
|
||||
}
|
||||
|
||||
function get_base_dir($base = '.', $echo = false){
|
||||
|
@ -86,7 +86,7 @@ class WP_Filesystem_ftpsockets{
|
||||
$this->permission = $perm;
|
||||
}
|
||||
|
||||
function find_base_dir($base = '.',$echo = false) {
|
||||
function find_base_dir($base = '.',$echo = false, $loop = false) {
|
||||
//Sanitize the Windows path formats, This allows easier conparison and aligns it to FTP output.
|
||||
$abspath = str_replace('\\','/',ABSPATH); //windows: Straighten up the paths..
|
||||
if( strpos($abspath, ':') ){ //Windows, Strip out the driveletter
|
||||
@ -128,7 +128,7 @@ class WP_Filesystem_ftpsockets{
|
||||
//Lets try that folder:
|
||||
$folder = path_join($base, $key);
|
||||
if($echo) printf( __('Changing to %s') . '<br/>', $folder );
|
||||
$ret = $this->find_base_dir( $folder, $echo);
|
||||
$ret = $this->find_base_dir( $folder, $echo, $loop);
|
||||
if( $ret )
|
||||
return $ret;
|
||||
}
|
||||
@ -138,7 +138,10 @@ class WP_Filesystem_ftpsockets{
|
||||
if($echo) printf( __('Found %s'), $base . 'wp-settings.php<br/>' );
|
||||
return $base;
|
||||
}
|
||||
return false;
|
||||
if( $loop )
|
||||
return false;//Prevent tihs function looping again.
|
||||
//As an extra last resort, Change back to / if the folder wasnt found. This comes into effect when the CWD is /home/user/ but WP is at /var/www/.... mainly dedicated setups.
|
||||
return $this->find_base_dir('/', $echo, true);
|
||||
}
|
||||
|
||||
function get_base_dir($base = '.', $echo = false){
|
||||
|
Loading…
Reference in New Issue
Block a user