Ticket #36621: 36621.1.patch
File 36621.1.patch, 1.4 KB (added by , 9 years ago) |
---|
-
src/wp-includes/functions.php
1854 1854 * @return array See above for description. 1855 1855 */ 1856 1856 function wp_upload_dir( $time = null, $create_dir = true, $refresh_cache = false ) { 1857 static $cache = array() ;1857 static $cache = array(), $tested_paths = array(); 1858 1858 1859 1859 $key = sprintf( '%d-%s', get_current_blog_id(), (string) $time ); 1860 1860 … … 1874 1874 1875 1875 if ( $create_dir ) { 1876 1876 $path = $uploads['path']; 1877 $tested_paths = wp_cache_get( 'upload_dir_tested_paths' );1878 1877 1879 if ( ! is_array( $tested_paths ) ) { 1880 $tested_paths = array(); 1881 } 1882 1883 if ( ! in_array( $path, $tested_paths, true ) ) { 1878 if ( array_key_exists( $path, $tested_paths ) ) { 1879 $uploads['error'] = $tested_paths[ $path ]; 1880 } else { 1884 1881 if ( ! wp_mkdir_p( $path ) ) { 1885 1882 if ( 0 === strpos( $uploads['basedir'], ABSPATH ) ) { 1886 1883 $error_path = str_replace( ABSPATH, '', $uploads['basedir'] ) . $uploads['subdir']; … … 1889 1886 } 1890 1887 1891 1888 $uploads['error'] = sprintf( __( 'Unable to create directory %s. Is its parent directory writable by the server?' ), esc_html( $error_path ) ); 1892 } else {1893 $tested_paths[] = $path;1894 wp_cache_set( 'upload_dir_tested_paths', $tested_paths );1895 1889 } 1890 1891 $tested_paths[ $path ] = $uploads['error']; 1896 1892 } 1897 1893 } 1898 1894