Media: Fix deletion of files on Windows.
`wp_delete_file_from_directory()` should always normalize file paths before comparing. Props tonybogdanov, SergeyBiryukov. Fixes #47185. Built from https://develop.svn.wordpress.org/trunk@45352 git-svn-id: http://core.svn.wordpress.org/trunk@45163 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
550bc5cad2
commit
ea8078f73c
|
@ -6282,13 +6282,21 @@ function wp_delete_file( $file ) {
|
|||
*/
|
||||
function wp_delete_file_from_directory( $file, $directory ) {
|
||||
if ( wp_is_stream( $file ) ) {
|
||||
$real_file = wp_normalize_path( $file );
|
||||
$real_directory = wp_normalize_path( $directory );
|
||||
$real_file = $file;
|
||||
$real_directory = $directory;
|
||||
} else {
|
||||
$real_file = realpath( wp_normalize_path( $file ) );
|
||||
$real_directory = realpath( wp_normalize_path( $directory ) );
|
||||
}
|
||||
|
||||
if ( false !== $real_file ) {
|
||||
$real_file = wp_normalize_path( $real_file );
|
||||
}
|
||||
|
||||
if ( false !== $real_directory ) {
|
||||
$real_directory = wp_normalize_path( $real_directory );
|
||||
}
|
||||
|
||||
if ( false === $real_file || false === $real_directory || strpos( $real_file, trailingslashit( $real_directory ) ) !== 0 ) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '5.3-alpha-45350';
|
||||
$wp_version = '5.3-alpha-45352';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue