From f0ec4d5a7bae56b675737ee64c9593da34362f4a Mon Sep 17 00:00:00 2001 From: Dion Hulse Date: Wed, 19 Aug 2015 12:37:56 +0000 Subject: [PATCH] Upgrades: When upgrading via FTP, use `LIST -a` to detect if a file exists. `LIST` & `NLST` by default on some servers require the `-a` flag to view hidden files (ie. `.maintenance`) Although we could simply pass the `-a` flag to `NLST`, opting to use `LIST` which we use elsewhere should mean less chance of server incompatibilities. Props jcroucher. Fixes #28013. git-svn-id: https://develop.svn.wordpress.org/trunk@33648 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/includes/class-wp-filesystem-ftpext.php | 2 +- src/wp-admin/includes/class-wp-filesystem-ftpsockets.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/wp-admin/includes/class-wp-filesystem-ftpext.php b/src/wp-admin/includes/class-wp-filesystem-ftpext.php index 62ade49136..9c15a9883b 100644 --- a/src/wp-admin/includes/class-wp-filesystem-ftpext.php +++ b/src/wp-admin/includes/class-wp-filesystem-ftpext.php @@ -282,7 +282,7 @@ class WP_Filesystem_FTPext extends WP_Filesystem_Base { * @return bool */ public function exists($file) { - $list = @ftp_nlist($this->link, $file); + $list = @ftp_rawlist( $this->link, '-a ' . $file ); if ( empty( $list ) && $this->is_dir( $file ) ) { return true; // File is an empty directory. diff --git a/src/wp-admin/includes/class-wp-filesystem-ftpsockets.php b/src/wp-admin/includes/class-wp-filesystem-ftpsockets.php index 1db9dc136a..b8ed10ae22 100644 --- a/src/wp-admin/includes/class-wp-filesystem-ftpsockets.php +++ b/src/wp-admin/includes/class-wp-filesystem-ftpsockets.php @@ -290,7 +290,7 @@ class WP_Filesystem_ftpsockets extends WP_Filesystem_Base { * @return bool */ public function exists( $file ) { - $list = $this->ftp->nlist( $file ); + $list = $this->ftp->rawlist( $file, '-a' ); if ( empty( $list ) && $this->is_dir( $file ) ) { return true; // File is an empty directory.