Ticket #36621: 36621.patch
File 36621.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 1878 if ( ! is_array( $tested_paths ) ) { 1880 1879 $tested_paths = array(); 1881 1880 } 1882 1881 1883 if ( ! in_array( $path, $tested_paths, true ) ) { 1882 if ( array_key_exists( $path, $tested_paths ) ) { 1883 $uploads['error'] = $tested_paths[ $path ]; 1884 } else { 1884 1885 if ( ! wp_mkdir_p( $path ) ) { 1885 1886 if ( 0 === strpos( $uploads['basedir'], ABSPATH ) ) { 1886 1887 $error_path = str_replace( ABSPATH, '', $uploads['basedir'] ) . $uploads['subdir']; … … 1889 1890 } 1890 1891 1891 1892 $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 1893 } 1894 1895 $tested_paths[ $path ] = $uploads['error']; 1896 1896 } 1897 1897 } 1898 1898