Changeset 37286
- Timestamp:
- 04/21/2016 08:17:32 PM (9 years ago)
- Location:
- branches/4.5
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/4.5
-
branches/4.5/src/wp-includes/functions.php
r36925 r37286 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 ); … … 1875 1875 if ( $create_dir ) { 1876 1876 $path = $uploads['path']; 1877 $tested_paths = wp_cache_get( 'upload_dir_tested_paths' ); 1878 1879 if ( ! is_array( $tested_paths ) ) { 1880 $tested_paths = array(); 1881 } 1882 1883 if ( ! in_array( $path, $tested_paths, true ) ) { 1877 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 ) ) { … … 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 }
Note: See TracChangeset
for help on using the changeset viewer.