WordPress.org

Make WordPress Core

Ticket #12549: 12549.diff

File 12549.diff, 1.6 KB (added by wpmuguru, 5 years ago)
  • wp-includes/functions.php

     
    21172117        $siteurl = get_option( 'siteurl' ); 
    21182118        $upload_path = get_option( 'upload_path' ); 
    21192119        $upload_path = trim($upload_path); 
     2120        $main_override = false; 
    21202121        if ( empty($upload_path) ) { 
    21212122                $dir = WP_CONTENT_DIR . '/uploads'; 
    21222123        } else { 
    21232124                $dir = $upload_path; 
    21242125                if ( 'wp-content/uploads' == $upload_path ) { 
    21252126                        $dir = WP_CONTENT_DIR . '/uploads'; 
     2127                        $main_override = defined( 'MULTISITE' ); 
    21262128                } elseif ( 0 !== strpos($dir, ABSPATH) ) { 
    21272129                        // $dir is absolute, $upload_path is (maybe) relative to ABSPATH 
    21282130                        $dir = path_join( ABSPATH, $dir ); 
     
    21362138                        $url = trailingslashit( $siteurl ) . $upload_path; 
    21372139        } 
    21382140 
    2139         if ( defined('UPLOADS') && ( WP_CONTENT_DIR . '/uploads' != ABSPATH . $upload_path ) && ( !isset( $switched ) || $switched === false ) ) { 
     2141        if ( defined('UPLOADS') && ( !$main_override || WP_CONTENT_DIR . '/uploads' != ABSPATH . $upload_path ) && ( !isset( $switched ) || $switched === false ) ) { 
    21402142                $dir = ABSPATH . UPLOADS; 
    21412143                $url = trailingslashit( $siteurl ) . UPLOADS; 
    21422144        } 
    21432145 
    2144         if ( is_multisite() && ( WP_CONTENT_DIR . '/uploads' != ABSPATH . $upload_path ) && ( !isset( $switched ) || $switched === false ) ) { 
     2146        if ( is_multisite() && ( !$main_override || WP_CONTENT_DIR . '/uploads' != ABSPATH . $upload_path ) && ( !isset( $switched ) || $switched === false ) ) { 
    21452147                if ( defined( 'BLOGUPLOADDIR' ) ) 
    21462148                        $dir = untrailingslashit(BLOGUPLOADDIR); 
    21472149                $url = str_replace( UPLOADS, 'files', $url );