From a44134a96da06d33219f41b1189c6ed5126056bf Mon Sep 17 00:00:00 2001 From: Dion Hulse Date: Tue, 15 Dec 2015 02:37:26 +0000 Subject: [PATCH] Filesystem: Revert [33648] and [34733] unfortunately these have caused issues for some servers, while fixing it for others. See #28013 Fixes #34976 for the 4.4 branch Fixes #34976 for the 4.4 branch Built from https://develop.svn.wordpress.org/branches/4.4@35945 git-svn-id: http://core.svn.wordpress.org/branches/4.4@35909 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/class-wp-filesystem-ftpext.php | 12 +++++------- wp-admin/includes/class-wp-filesystem-ftpsockets.php | 2 +- wp-includes/version.php | 2 +- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/wp-admin/includes/class-wp-filesystem-ftpext.php b/wp-admin/includes/class-wp-filesystem-ftpext.php index 38536a0ea9..0a90b9cb30 100644 --- a/wp-admin/includes/class-wp-filesystem-ftpext.php +++ b/wp-admin/includes/class-wp-filesystem-ftpext.php @@ -326,16 +326,14 @@ class WP_Filesystem_FTPext extends WP_Filesystem_Base { * @param string $file * @return bool */ - public function exists( $file ) { - $path = dirname( $file ); - $filename = basename( $file ); + public function exists($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. } /** diff --git a/wp-admin/includes/class-wp-filesystem-ftpsockets.php b/wp-admin/includes/class-wp-filesystem-ftpsockets.php index 29ac7888ab..31f2257356 100644 --- a/wp-admin/includes/class-wp-filesystem-ftpsockets.php +++ b/wp-admin/includes/class-wp-filesystem-ftpsockets.php @@ -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. diff --git a/wp-includes/version.php b/wp-includes/version.php index 48fcc1075c..880aabfed6 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.4.1-alpha-35936'; +$wp_version = '4.4.1-alpha-35945'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.