Filesystem: Revert [33648] and [34733] unfortunately these have caused issues for some servers, while fixing it for others.

See #28013

Fixes #34976 for trunk
Fixes #34976 for trunk


git-svn-id: https://develop.svn.wordpress.org/trunk@35944 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Dion Hulse 2015-12-15 02:35:26 +00:00
parent d33deeeb74
commit 5564545ea8
2 changed files with 6 additions and 8 deletions

View File

@ -332,15 +332,13 @@ class WP_Filesystem_FTPext extends WP_Filesystem_Base {
* @return bool
*/
public function exists($file) {
$path = dirname( $file );
$filename = basename( $file );
$list = @ftp_nlist($this->link, $file);
$file_list = @ftp_nlist( $this->link, '-a ' . $path );
if ( $file_list ) {
$file_list = array_map( 'basename', $file_list );
if ( empty( $list ) && $this->is_dir( $file ) ) {
return true; // File is an empty directory.
}
return $file_list && in_array( $filename, $file_list );
return !empty($list); //empty list = no file, so invert.
}
/**

View File

@ -342,7 +342,7 @@ class WP_Filesystem_ftpsockets extends WP_Filesystem_Base {
* @return bool
*/
public function exists( $file ) {
$list = $this->ftp->rawlist( $file, '-a' );
$list = $this->ftp->nlist( $file );
if ( empty( $list ) && $this->is_dir( $file ) ) {
return true; // File is an empty directory.