mirror of
git://develop.git.wordpress.org/
synced 2025-02-12 10:50:25 +01:00
Upgrade/Install: Provide dirpath in error messages when _unzip_file_pclzip()
cannot create directories.
This changeset ensures the directory path is provided in error messages when `_unzip_file_pclzip()` is unable to create a directory. This removes `substr()` which was returning an empty string in some use cases. Props gunterer, SergeyBiryukov, n8finch, peterwilsoncc, audrasjb, rsiddharth, costdev , desrosj, mukesh27. Fixes #54477. git-svn-id: https://develop.svn.wordpress.org/trunk@54442 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
0d9ba6cb1a
commit
308a2fc31f
@ -1707,7 +1707,7 @@ function _unzip_file_ziparchive( $file, $to, $needed_dirs = array() ) {
|
||||
foreach ( $needed_dirs as $_dir ) {
|
||||
// Only check to see if the Dir exists upon creation failure. Less I/O this way.
|
||||
if ( ! $wp_filesystem->mkdir( $_dir, FS_CHMOD_DIR ) && ! $wp_filesystem->is_dir( $_dir ) ) {
|
||||
return new WP_Error( 'mkdir_failed_ziparchive', __( 'Could not create directory.' ), substr( $_dir, strlen( $to ) ) );
|
||||
return new WP_Error( 'mkdir_failed_ziparchive', __( 'Could not create directory.' ), $_dir );
|
||||
}
|
||||
}
|
||||
unset( $needed_dirs );
|
||||
@ -1848,7 +1848,7 @@ function _unzip_file_pclzip( $file, $to, $needed_dirs = array() ) {
|
||||
foreach ( $needed_dirs as $_dir ) {
|
||||
// Only check to see if the dir exists upon creation failure. Less I/O this way.
|
||||
if ( ! $wp_filesystem->mkdir( $_dir, FS_CHMOD_DIR ) && ! $wp_filesystem->is_dir( $_dir ) ) {
|
||||
return new WP_Error( 'mkdir_failed_pclzip', __( 'Could not create directory.' ), substr( $_dir, strlen( $to ) ) );
|
||||
return new WP_Error( 'mkdir_failed_pclzip', __( 'Could not create directory.' ), $_dir );
|
||||
}
|
||||
}
|
||||
unset( $needed_dirs );
|
||||
|
Loading…
x
Reference in New Issue
Block a user