Make WordPress Core


Ignore:
Timestamp:
12/15/2015 02:35:26 AM (8 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

File:
1 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
Note: See TracChangeset for help on using the changeset viewer.