Changeset 54816
- Timestamp:
- 11/11/2022 04:02:41 PM (2 years ago)
- Location:
- branches/6.1
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/6.1
-
branches/6.1/src/wp-admin/includes/class-wp-filesystem-ftpext.php
r53898 r54816 413 413 * 414 414 * @since 2.5.0 415 * @since 6.1.0 Uses WP_Filesystem_FTPext::is_dir() to check for directory existence416 * and ftp_rawlist() to check for file existence.417 415 * 418 416 * @param string $path Path to file or directory. … … 420 418 */ 421 419 public function exists( $path ) { 422 if ( $this->is_dir( $path ) ) { 423 return true; 424 } 425 426 return ! empty( ftp_rawlist( $this->link, $path ) ); 420 $list = ftp_nlist( $this->link, $path ); 421 422 if ( empty( $list ) && $this->is_dir( $path ) ) { 423 return true; // File is an empty directory. 424 } 425 426 return ! empty( $list ); // Empty list = no file, so invert. 427 427 } 428 428 -
branches/6.1/src/wp-admin/includes/class-wp-filesystem-ftpsockets.php
r53872 r54816 415 415 * 416 416 * @since 2.5.0 417 * @since 6.1.0 Uses WP_Filesystem_ftpsockets::is_dir() to check for directory existence418 * and file size to check for file existence.419 417 * 420 418 * @param string $path Path to file or directory. … … 422 420 */ 423 421 public function exists( $path ) { 424 if ( $this->is_dir( $path ) ) { 425 return true; 426 } 427 428 return is_numeric( $this->size( $path ) ); 422 $list = $this->ftp->nlist( $path ); 423 424 if ( empty( $list ) && $this->is_dir( $path ) ) { 425 return true; // File is an empty directory. 426 } 427 428 return ! empty( $list ); // Empty list = no file, so invert. 429 // Return $this->ftp->is_exists($file); has issues with ABOR+426 responses on the ncFTPd server. 429 430 } 430 431
Note: See TracChangeset
for help on using the changeset viewer.