Ticket #5586: 5586.15.diff
File 5586.15.diff, 3.8 KB (added by , 13 years ago) |
---|
-
wp-admin/includes/class-wp-filesystem-ftpext.php
84 84 $this->permission = $perm; 85 85 } 86 86 87 function find_base_dir($base = '.',$echo = false ) {87 function find_base_dir($base = '.',$echo = false, $loop = false) { 88 88 //Sanitize the Windows path formats, This allows easier conparison and aligns it to FTP output. 89 89 $abspath = str_replace('\\','/',ABSPATH); //windows: Straighten up the paths.. 90 90 if( strpos($abspath, ':') ){ //Windows, Strip out the driveletter … … 98 98 99 99 //Can we see the Current directory as part of the ABSPATH? 100 100 $location = strpos($abspath, $base); 101 if( false !== $location ) {101 if( false !== $location ) { 102 102 $newbase = path_join($base, substr($abspath, $location + strlen($base))); 103 103 104 104 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. … … 126 126 //Lets try that folder: 127 127 $folder = path_join($base, $key); 128 128 if($echo) printf( __('Changing to %s') . '<br/>', $folder ); 129 $ret = $this->find_base_dir( $folder, $echo );129 $ret = $this->find_base_dir( $folder, $echo, $loop); 130 130 if( $ret ) 131 131 return $ret; 132 132 } … … 136 136 if($echo) printf( __('Found %s'), $base . 'wp-settings.php<br/>' ); 137 137 return $base; 138 138 } 139 return false; 139 if( $loop ) 140 return false;//Prevent tihs function looping again. 141 //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. 142 return $this->find_base_dir('/', $echo, true); 140 143 } 141 144 142 145 function get_base_dir($base = '.', $echo = false){ -
wp-admin/includes/class-wp-filesystem-ftpsockets.php
86 86 $this->permission = $perm; 87 87 } 88 88 89 function find_base_dir($base = '.',$echo = false ) {89 function find_base_dir($base = '.',$echo = false, $loop = false) { 90 90 //Sanitize the Windows path formats, This allows easier conparison and aligns it to FTP output. 91 91 $abspath = str_replace('\\','/',ABSPATH); //windows: Straighten up the paths.. 92 92 if( strpos($abspath, ':') ){ //Windows, Strip out the driveletter … … 100 100 101 101 //Can we see the Current directory as part of the ABSPATH? 102 102 $location = strpos($abspath, $base); 103 if( false !== $location ) {103 if( false !== $location ) { 104 104 $newbase = path_join($base, substr($abspath, $location + strlen($base))); 105 105 106 106 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. … … 128 128 //Lets try that folder: 129 129 $folder = path_join($base, $key); 130 130 if($echo) printf( __('Changing to %s') . '<br/>', $folder ); 131 $ret = $this->find_base_dir( $folder, $echo );131 $ret = $this->find_base_dir( $folder, $echo, $loop); 132 132 if( $ret ) 133 133 return $ret; 134 134 } … … 138 138 if($echo) printf( __('Found %s'), $base . 'wp-settings.php<br/>' ); 139 139 return $base; 140 140 } 141 return false; 141 if( $loop ) 142 return false;//Prevent tihs function looping again. 143 //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. 144 return $this->find_base_dir('/', $echo, true); 142 145 } 143 146 144 147 function get_base_dir($base = '.', $echo = false){