WP_Filesystem: Correct a rare case where the FTP directory will be detected incorrectly when the final path token exists higher in the chain, for example /x/x/Z/x/Z/ would be detected as /x/x/Z/. Fixes #20934
git-svn-id: http://core.svn.wordpress.org/trunk@21221 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
02192b7f71
commit
6c6d746637
|
@ -193,12 +193,13 @@ class WP_Filesystem_Base {
|
|||
$folder = untrailingslashit($folder);
|
||||
|
||||
$folder_parts = explode('/', $folder);
|
||||
$last_path = $folder_parts[ count($folder_parts) - 1 ];
|
||||
$last_index = array_pop( array_keys( $folder_parts ) );
|
||||
$last_path = $folder_parts[ $last_index ];
|
||||
|
||||
$files = $this->dirlist( $base );
|
||||
|
||||
foreach ( $folder_parts as $key ) {
|
||||
if ( $key == $last_path )
|
||||
foreach ( $folder_parts as $index => $key ) {
|
||||
if ( $index == $last_index )
|
||||
continue; //We want this to be caught by the next code block.
|
||||
|
||||
//Working from /home/ to /user/ to /wordpress/ see if that file exists within the current folder,
|
||||
|
|
Loading…
Reference in New Issue