WordPress.org

Make WordPress Core

Changeset 22106


Ignore:
Timestamp:
10/03/2012 06:57:36 PM (6 years ago)
Author:
nacin
Message:

Pass the current blog id to is_main_site() in wp_upload_dir(), because is_main_site() without arguments does not respond correctly on switch. see #19235.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/functions.php

    r22094 r22106  
    15101510
    15111511    // If multisite (if not the main site in a post-MU network)
    1512     if ( is_multisite() && ! ( is_main_site() && defined( 'MULTISITE' ) ) ) {
     1512    $blog_id = get_current_blog_id();
     1513    if ( is_multisite() && ! ( is_main_site( $blog_id ) && defined( 'MULTISITE' ) ) ) {
    15131514
    15141515        if ( ! get_site_option( 'ms_files_rewriting' ) ) {
    15151516            // Append sites/%d if we're not on the main site (for post-MU networks). The extra directory
    1516             // prevents a four-digit ID from conflict with a year-based directory for the main site.
    1517             // If a MU-era network disables ms-files rewriting manually, they don't need the extra
     1517            // prevents a four-digit ID from conflicting with a year-based directory for the main site.
     1518            // But if a MU-era network has disabled ms-files rewriting manually, they don't need the extra
    15181519            // directory, as they never had wp-content/uploads for the main site.
    15191520
    1520             if ( defined( 'MULTISITE' ) )
    1521                 $ms_dir = '/sites/' . get_current_blog_id();
    1522             else
    1523                 $ms_dir = '/' . get_current_blog_id();
    1524 
    1525             $dir .= $ms_dir;
    1526             $url .= $ms_dir;
     1521            $ms_dir = defined( 'MULTISITE' ) ? '/sites/' : '/';
     1522            $dir .= $ms_dir . $blog_id;
     1523            $url .= $ms_dir . $blog_id;
    15271524        } elseif ( ! ms_is_switched() ) {
    15281525            // Handle the old-form ms-files.php rewriting if the network still has that enabled.
Note: See TracChangeset for help on using the changeset viewer.