mirror of
https://github.com/WordPress/WordPress.git
synced 2025-01-22 16:21:26 +01:00
In wp_upload_dir()
do not cache error from wp_mkdir_p()
when a directory cannot be created. Keep trying to create the dirs. This happens mostly in file upload context.
See #34359. Built from https://develop.svn.wordpress.org/trunk@36628 git-svn-id: http://core.svn.wordpress.org/trunk@36595 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
3d68488ff6
commit
d7b56a13d9
@ -1875,9 +1875,7 @@ function wp_upload_dir( $time = null, $create_dir = true, $refresh_cache = false
|
||||
$tested_paths = array();
|
||||
}
|
||||
|
||||
if ( array_key_exists( $path, $tested_paths ) ) {
|
||||
$uploads['error'] = $tested_paths[ $path ];
|
||||
} else {
|
||||
if ( ! in_array( $path, $tested_paths, true ) ) {
|
||||
if ( ! wp_mkdir_p( $path ) ) {
|
||||
if ( 0 === strpos( $uploads['basedir'], ABSPATH ) ) {
|
||||
$error_path = str_replace( ABSPATH, '', $uploads['basedir'] ) . $uploads['subdir'];
|
||||
@ -1886,10 +1884,10 @@ function wp_upload_dir( $time = null, $create_dir = true, $refresh_cache = false
|
||||
}
|
||||
|
||||
$uploads['error'] = sprintf( __( 'Unable to create directory %s. Is its parent directory writable by the server?' ), esc_html( $error_path ) );
|
||||
} else {
|
||||
$tested_paths[] = $path;
|
||||
wp_cache_set( 'upload_dir_tested_paths', $tested_paths );
|
||||
}
|
||||
|
||||
$tested_paths[ $path ] = $uploads['error'];
|
||||
wp_cache_set( 'upload_dir_tested_paths', $tested_paths );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.5-alpha-36627';
|
||||
$wp_version = '4.5-alpha-36628';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
Loading…
Reference in New Issue
Block a user