diff --git a/src/wp-admin/includes/class-wp-filesystem-direct.php b/src/wp-admin/includes/class-wp-filesystem-direct.php
index 9b1757cc65..ec646a8bb6 100644
|
a
|
b
|
class WP_Filesystem_Direct extends WP_Filesystem_Base { |
| 332 | 332 | } |
| 333 | 333 | $file = str_replace( '\\', '/', $file ); // for win32, occasional problems deleting files otherwise |
| 334 | 334 | |
| 335 | | if ( 'f' == $type || $this->is_file( $file ) ) { |
| 336 | | return @unlink( $file ); |
| | 335 | if ( 'f' == $type || $this->is_file( $file ) || $this->is_link( $file ) ) { |
| | 336 | // rtrim() needed to remove symlinks successfully. |
| | 337 | return @unlink( rtrim( $file, '/' ) ); |
| 337 | 338 | } |
| 338 | 339 | if ( ! $recursive && $this->is_dir( $file ) ) { |
| 339 | 340 | return @rmdir( $file ); |
| … |
… |
class WP_Filesystem_Direct extends WP_Filesystem_Base { |
| 383 | 384 | return @is_file( $file ); |
| 384 | 385 | } |
| 385 | 386 | |
| | 387 | /** |
| | 388 | * Checks if resource is a symbolic link. |
| | 389 | * |
| | 390 | * @since 5.3.0 |
| | 391 | * |
| | 392 | * @param string $file File path. |
| | 393 | * @return bool Whether $file is a symbolic link. |
| | 394 | */ |
| | 395 | public function is_link( $file ) { |
| | 396 | // Strip trailing slashes, to avoid directory symlinks resolving. |
| | 397 | return @is_link( rtrim( $file, '/' ) ); |
| | 398 | } |
| | 399 | |
| 386 | 400 | /** |
| 387 | 401 | * Checks if resource is a directory. |
| 388 | 402 | * |
| … |
… |
class WP_Filesystem_Direct extends WP_Filesystem_Base { |
| 557 | 571 | * } |
| 558 | 572 | */ |
| 559 | 573 | public function dirlist( $path, $include_hidden = true, $recursive = false ) { |
| 560 | | if ( $this->is_file( $path ) ) { |
| | 574 | if ( $this->is_dir( $path ) && $this->is_link( $path ) ) { |
| | 575 | // Directory is symlink, therefore return no listing. |
| | 576 | return array(); |
| | 577 | } |
| | 578 | elseif ( $this->is_file( $path ) || $this->is_link( $path ) ) { |
| 561 | 579 | $limit_file = basename( $path ); |
| 562 | 580 | $path = dirname( $path ); |
| 563 | 581 | } else { |
| … |
… |
class WP_Filesystem_Direct extends WP_Filesystem_Base { |
| 602 | 620 | $struc['time'] = gmdate( 'h:i:s', $struc['lastmodunix'] ); |
| 603 | 621 | $struc['type'] = $this->is_dir( $path . '/' . $entry ) ? 'd' : 'f'; |
| 604 | 622 | |
| 605 | | if ( 'd' == $struc['type'] ) { |
| | 623 | if ( 'd' == $struc['type'] && ! $this->is_link( $path . '/' . $struc['name'] ) ) { |
| 606 | 624 | if ( $recursive ) { |
| 607 | 625 | $struc['files'] = $this->dirlist( $path . '/' . $struc['name'], $include_hidden, $recursive ); |
| 608 | 626 | } else { |