Filesystem API: Return correct error data from `copy_dir()` if the directory listing failed.

The `::dirlist()` method is run on the `$from` directory, so `basename( $from )` is the correct thing to pass to the `WP_Error` object.

Follow-up to [50149].

Props afragen, costdev, pravinparmar2404.
Fixes #57907.
Built from https://develop.svn.wordpress.org/trunk@55538


git-svn-id: http://core.svn.wordpress.org/trunk@55050 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2023-03-11 11:34:24 +00:00
parent fe32dc4241
commit 8d7d99289d
2 changed files with 2 additions and 2 deletions

View File

@ -1904,7 +1904,7 @@ function copy_dir( $from, $to, $skip_list = array() ) {
$dirlist = $wp_filesystem->dirlist( $from ); $dirlist = $wp_filesystem->dirlist( $from );
if ( false === $dirlist ) { if ( false === $dirlist ) {
return new WP_Error( 'dirlist_failed_copy_dir', __( 'Directory listing failed.' ), basename( $to ) ); return new WP_Error( 'dirlist_failed_copy_dir', __( 'Directory listing failed.' ), basename( $from ) );
} }
$from = trailingslashit( $from ); $from = trailingslashit( $from );

View File

@ -16,7 +16,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '6.3-alpha-55537'; $wp_version = '6.3-alpha-55538';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.