diff --git a/wp-admin/includes/schema.php b/wp-admin/includes/schema.php index cc2f08be6..bebbb0a81 100644 --- a/wp-admin/includes/schema.php +++ b/wp-admin/includes/schema.php @@ -189,12 +189,10 @@ function populate_options() { do_action('populate_options'); if ( ini_get('safe_mode') ) { - // Safe mode screws up mkdir(), so we must use a flat structure. + // Safe mode can break mkdir() so use a flat structure by default. $uploads_use_yearmonth_folders = 0; - $upload_path = WP_CONTENT_DIR; } else { $uploads_use_yearmonth_folders = 1; - $upload_path = WP_CONTENT_DIR . '/uploads'; } $options = array( @@ -265,7 +263,7 @@ function populate_options() { // 2.0.1 'uploads_use_yearmonth_folders' => $uploads_use_yearmonth_folders, - 'upload_path' => $upload_path, + 'upload_path' => '', // 2.0.3 'secret' => wp_generate_password(64), diff --git a/wp-admin/options-misc.php b/wp-admin/options-misc.php index 9e2253670..73575a4e8 100644 --- a/wp-admin/options-misc.php +++ b/wp-admin/options-misc.php @@ -30,7 +30,7 @@ include('admin-header.php'); - diff --git a/wp-includes/functions.php b/wp-includes/functions.php index 19ac29c94..5446f3e84 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -2035,16 +2035,20 @@ function wp_upload_dir( $time = null ) { $siteurl = get_option( 'siteurl' ); $upload_path = get_option( 'upload_path' ); $upload_path = trim($upload_path); - if ( empty($upload_path) ) + if ( empty($upload_path) ) { $dir = WP_CONTENT_DIR . '/uploads'; - else + } else { $dir = $upload_path; - - // $dir is absolute, $path is (maybe) relative to ABSPATH - $dir = path_join( ABSPATH, $dir ); + if ( 'wp-content/uploads' == $upload_path ) { + $dir = WP_CONTENT_DIR . '/uploads'; + } elseif ( 0 !== strpos($dir, ABSPATH) ) { + // $dir is absolute, $upload_path is (maybe) relative to ABSPATH + $dir = path_join( ABSPATH, $dir ); + } + } if ( !$url = get_option( 'upload_url_path' ) ) { - if ( empty($upload_path) or ( $upload_path == $dir ) ) + if ( empty($upload_path) || ( 'wp-content/uploads' == $upload_path ) || ( $upload_path == $dir ) ) $url = WP_CONTENT_URL . '/uploads'; else $url = trailingslashit( $siteurl ) . $upload_path;
+ wp-content/uploads'); ?>