diff --git a/src/wp-admin/includes/class-wp-filesystem-ftpext.php b/src/wp-admin/includes/class-wp-filesystem-ftpext.php
index 627128fcac..f2e9532f08 100644
|
a
|
b
|
class WP_Filesystem_FTPext extends WP_Filesystem_Base { |
| 409 | 409 | } |
| 410 | 410 | |
| 411 | 411 | /** |
| 412 | | * Checks if a file or directory exists. |
| | 412 | * Checks if a path exists. |
| 413 | 413 | * |
| 414 | 414 | * @since 2.5.0 |
| 415 | 415 | * |
| 416 | | * @param string $file Path to file or directory. |
| 417 | | * @return bool Whether $file exists or not. |
| | 416 | * @param string $path Path to file or directory. |
| | 417 | * @return bool Whether $path exists or not. |
| 418 | 418 | */ |
| 419 | | public function exists( $file ) { |
| 420 | | $list = ftp_nlist( $this->link, $file ); |
| | 419 | public function exists( $path ) { |
| 421 | 420 | |
| 422 | | if ( empty( $list ) && $this->is_dir( $file ) ) { |
| 423 | | return true; // File is an empty directory. |
| | 421 | /** |
| | 422 | * As is_dir tries to change in the dir it implicitly |
| | 423 | * ensures existance of dir. |
| | 424 | */ |
| | 425 | if ( $this->is_dir( $path ) ) { |
| | 426 | return true; |
| 424 | 427 | } |
| | 428 | else { |
| | 429 | |
| | 430 | try { |
| | 431 | /** |
| | 432 | * Check for hidden file |
| | 433 | * |
| | 434 | * @ticket 28013 |
| | 435 | */ |
| | 436 | $basename = basename( $path ); |
| | 437 | if ( substr( $basename, 0, 1 ) === "." ) { |
| | 438 | $path = '-a ' . $path; |
| | 439 | } |
| 425 | 440 | |
| 426 | | return ! empty( $list ); // Empty list = no file, so invert. |
| | 441 | $list = ftp_nlist( $this->link, $path ); |
| | 442 | |
| | 443 | return ! empty( $list ); // Empty list = no file, so invert. |
| | 444 | } |
| | 445 | |
| | 446 | /** |
| | 447 | * If ftp_nlist is not working, try ftp_size |
| | 448 | * |
| | 449 | * @ticket 51170 |
| | 450 | */ |
| | 451 | catch ( Exception $ex ) { |
| | 452 | $size = ftp_size( $this->link, $path ); |
| | 453 | |
| | 454 | return $size > -1; |
| | 455 | } |
| | 456 | } |
| 427 | 457 | } |
| 428 | 458 | |
| 429 | 459 | /** |