WordPress.org

Make WordPress Core

Changeset 35944


Ignore:
Timestamp:
12/15/2015 02:35:26 AM (4 years ago)
Author:
dd32
Message:

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

Location:
trunk/src/wp-admin/includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-wp-filesystem-ftpext.php

    r35777 r35944  
    332332     * @return bool
    333333     */
    334     public function exists( $file ) {
    335         $path = dirname( $file );
    336         $filename = basename( $file );
    337 
    338         $file_list = @ftp_nlist( $this->link, '-a ' . $path );
    339         if ( $file_list ) {
    340             $file_list = array_map( 'basename', $file_list );
    341         }
    342 
    343         return $file_list && in_array( $filename, $file_list );
     334    public function exists($file) {
     335        $list = @ftp_nlist($this->link, $file);
     336
     337        if ( empty( $list ) && $this->is_dir( $file ) ) {
     338            return true; // File is an empty directory.
     339        }
     340
     341        return !empty($list); //empty list = no file, so invert.
    344342    }
    345343
  • trunk/src/wp-admin/includes/class-wp-filesystem-ftpsockets.php

    r35942 r35944  
    343343     */
    344344    public function exists( $file ) {
    345         $list = $this->ftp->rawlist( $file, '-a' );
     345        $list = $this->ftp->nlist( $file );
    346346
    347347        if ( empty( $list ) && $this->is_dir( $file ) ) {
Note: See TracChangeset for help on using the changeset viewer.