WordPress.org

Make WordPress Core

Ticket #13733: 13733.2.diff

File 13733.2.diff, 1.8 KB (added by wpmuguru, 4 years ago)
  • wp-includes/functions.php

     
    21212121 * @return array See above for description. 
    21222122 */ 
    21232123function wp_upload_dir( $time = null ) { 
    2124         global $switched; 
     2124        global $switched, $blog_id; 
    21252125        $siteurl = get_option( 'siteurl' ); 
    21262126        $upload_path = get_option( 'upload_path' ); 
    21272127        $upload_path = trim($upload_path); 
    2128         $main_override = false; 
     2128        $main_override = defined( 'MULTISITE' ) && is_main_site( $blog_id ); 
    21292129        if ( empty($upload_path) ) { 
    21302130                $dir = WP_CONTENT_DIR . '/uploads'; 
    21312131        } else { 
    21322132                $dir = $upload_path; 
    21332133                if ( 'wp-content/uploads' == $upload_path ) { 
    21342134                        $dir = WP_CONTENT_DIR . '/uploads'; 
    2135                         $main_override = defined( 'MULTISITE' ) && is_main_site(); 
    21362135                } elseif ( 0 !== strpos($dir, ABSPATH) ) { 
    21372136                        // $dir is absolute, $upload_path is (maybe) relative to ABSPATH 
    21382137                        $dir = path_join( ABSPATH, $dir ); 
     
    21462145                        $url = trailingslashit( $siteurl ) . $upload_path; 
    21472146        } 
    21482147 
    2149         if ( defined('UPLOADS') && ( !$main_override || WP_CONTENT_DIR . '/uploads' != ABSPATH . $upload_path ) && ( !isset( $switched ) || $switched === false ) ) { 
     2148        if ( defined('UPLOADS') && !$main_override && ( !isset( $switched ) || $switched === false ) ) { 
    21502149                $dir = ABSPATH . UPLOADS; 
    21512150                $url = trailingslashit( $siteurl ) . UPLOADS; 
    21522151        } 
    21532152 
    2154         if ( is_multisite() && ( !$main_override || WP_CONTENT_DIR . '/uploads' != ABSPATH . $upload_path ) && ( !isset( $switched ) || $switched === false ) ) { 
     2153        if ( is_multisite() && !$main_override && ( !isset( $switched ) || $switched === false ) ) { 
    21552154                if ( defined( 'BLOGUPLOADDIR' ) ) 
    21562155                        $dir = untrailingslashit(BLOGUPLOADDIR); 
    21572156                $url = str_replace( UPLOADS, 'files', $url );