Filesystem API: Attempt to create directory in `copy_dir()`.
Adds a check to the start of `copy_dir()` that the destination directory exists and attempts to create it if it does not. An error is returned if the directory can not be created, either due to a permissions error or the parent directory not existing. Props caraffande, costdev, zunaid321. Fixes #41855. Built from https://develop.svn.wordpress.org/trunk@55938 git-svn-id: http://core.svn.wordpress.org/trunk@55450 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
2d2791b5be
commit
3d94d17402
|
@ -1910,6 +1910,14 @@ function copy_dir( $from, $to, $skip_list = array() ) {
|
|||
$from = trailingslashit( $from );
|
||||
$to = trailingslashit( $to );
|
||||
|
||||
if ( ! $wp_filesystem->exists( $to ) && ! $wp_filesystem->mkdir( $to ) ) {
|
||||
return new WP_Error(
|
||||
'mkdir_destination_failed_copy_dir',
|
||||
__( 'Could not create the destination directory.' ),
|
||||
basename( $to )
|
||||
);
|
||||
}
|
||||
|
||||
foreach ( (array) $dirlist as $filename => $fileinfo ) {
|
||||
if ( in_array( $filename, $skip_list, true ) ) {
|
||||
continue;
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '6.3-alpha-55937';
|
||||
$wp_version = '6.3-alpha-55938';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue