diff --git a/wp-admin/includes/file.php b/wp-admin/includes/file.php
index 993635e460..f04acf625f 100644
a
|
b
|
function _unzip_file_pclzip( $file, $to, $needed_dirs = array() ) { |
1730 | 1730 | * Assumes that WP_Filesystem() has already been called and setup. |
1731 | 1731 | * |
1732 | 1732 | * @since 2.5.0 |
| 1733 | * @since 5.7.0 Add $first_pass parameter. |
1733 | 1734 | * |
1734 | 1735 | * @global WP_Filesystem_Base $wp_filesystem WordPress filesystem subclass. |
1735 | 1736 | * |
1736 | | * @param string $from Source directory. |
1737 | | * @param string $to Destination directory. |
1738 | | * @param string[] $skip_list An array of files/folders to skip copying. |
| 1737 | * @param string $from Source directory. |
| 1738 | * @param string $to Destination directory. |
| 1739 | * @param string[] $skip_list An array of files/folders to skip copying. |
| 1740 | * @param bool $first_pass True on the initial call, but false on subsequent calls. |
1739 | 1741 | * @return true|WP_Error True on success, WP_Error on failure. |
1740 | 1742 | */ |
1741 | | function copy_dir( $from, $to, $skip_list = array() ) { |
| 1743 | function copy_dir( $from, $to, $skip_list = array(), $first_pass = true ) { |
1742 | 1744 | global $wp_filesystem; |
1743 | 1745 | |
1744 | 1746 | $dirlist = $wp_filesystem->dirlist( $from ); |
1745 | 1747 | |
| 1748 | if ( ! $dirlist && $first_pass ) { |
| 1749 | return new WP_Error( 'dirlist_failed_copy_dir', __( 'Directory listing failed.' ), basename( $to ) ); |
| 1750 | } |
| 1751 | |
1746 | 1752 | $from = trailingslashit( $from ); |
1747 | 1753 | $to = trailingslashit( $to ); |
1748 | 1754 | |
… |
… |
function copy_dir( $from, $to, $skip_list = array() ) { |
1776 | 1782 | } |
1777 | 1783 | } |
1778 | 1784 | |
1779 | | $result = copy_dir( $from . $filename, $to . $filename, $sub_skip_list ); |
| 1785 | $result = copy_dir( $from . $filename, $to . $filename, $sub_skip_list, false ); |
1780 | 1786 | if ( is_wp_error( $result ) ) { |
1781 | 1787 | return $result; |
1782 | 1788 | } |