Make WordPress Core

Ticket #19235: 19235.5.diff

File 19235.5.diff, 3.4 KB (added by nacin, 12 years ago)
  • wp-includes/ms-default-constants.php

     
    2828        if ( !defined( 'UPLOADBLOGSDIR' ) )
    2929                define( 'UPLOADBLOGSDIR', 'wp-content/blogs.dir' );
    3030
    31         // The main site in a post-MU network uses wp-content/uploads.
    32         // This used to be handled in wp_upload_dir() by ignoring UPLOADS for this case. Avoid defining it instead.
     31        // Note, the main site in a post-MU network uses wp-content/uploads.
     32        // This is handled in wp_upload_dir() by ignoring UPLOADS for this case.
    3333        if ( ! defined( 'UPLOADS' ) ) {
    34                 if ( ! ( is_main_site() && defined( 'MULTISITE' ) ) )
    35                         define( 'UPLOADS', UPLOADBLOGSDIR . "/{$wpdb->blogid}/files/" );
     34                define( 'UPLOADS', UPLOADBLOGSDIR . "/{$wpdb->blogid}/files/" );
    3635
    3736                // Uploads dir relative to ABSPATH
    3837                if ( 'wp-content/blogs.dir' == UPLOADBLOGSDIR && ! defined( 'BLOGUPLOADDIR' ) )
  • wp-includes/functions.php

     
    15031503                        $url = trailingslashit( $siteurl ) . $upload_path;
    15041504        }
    15051505
    1506         if ( defined( 'UPLOADS' ) ) {
     1506        // Obey the value of UPLOADS. This happens as long as ms-files rewriting is disabled.
     1507        // We also sometimes obey UPLOADS when rewriting is enabled -- see the next block.
     1508        if ( defined( 'UPLOADS' ) && ! ( is_multisite() && get_site_option( 'ms_files_rewriting' ) ) ) {
    15071509                $dir = ABSPATH . UPLOADS;
    15081510                $url = trailingslashit( $siteurl ) . UPLOADS;
    15091511        }
    15101512
    1511         // If multisite (if not the main site in a post-MU network)
    1512         $blog_id = get_current_blog_id();
    1513         if ( is_multisite() && ! ( is_main_site( $blog_id ) && defined( 'MULTISITE' ) ) ) {
     1513        // If multisite (and if not the main site in a post-MU network)
     1514        if ( is_multisite() && ! ( is_main_site() && defined( 'MULTISITE' ) ) ) {
    15141515
    15151516                if ( ! get_site_option( 'ms_files_rewriting' ) ) {
    1516                         // Append sites/%d if we're not on the main site (for post-MU networks). The extra directory
     1517                        // If ms-files rewriting is disabled (networks created post-3.5), it is fairly straightforward:
     1518                        // Append sites/%d if we're not on the main site (for post-MU networks). (The extra directory
    15171519                        // prevents a four-digit ID from conflicting with a year-based directory for the main site.
    15181520                        // But if a MU-era network has disabled ms-files rewriting manually, they don't need the extra
    1519                         // directory, as they never had wp-content/uploads for the main site.
     1521                        // directory, as they never had wp-content/uploads for the main site.)
    15201522
     1523                        $blog_id = get_current_blog_id();
    15211524                        $ms_dir = defined( 'MULTISITE' ) ? '/sites/' : '/';
    15221525                        $dir .= $ms_dir . $blog_id;
    15231526                        $url .= $ms_dir . $blog_id;
    1524                 } elseif ( ! ms_is_switched() ) {
     1527
     1528                } elseif ( defined( 'UPLOADS' ) && ! ms_is_switched() ) {
    15251529                        // Handle the old-form ms-files.php rewriting if the network still has that enabled.
     1530                        // When ms-files rewriting is enabled, then we only listen to UPLOADS when:
     1531                        //   1) we are not on the main site in a post-MU network,
     1532                        //      as wp-content/uploads is used there, and
     1533                        //   2) we are not switched, as ms_upload_constants() hardcodes
     1534                        //      these constants to reflect the original blog ID.
     1535
    15261536                        if ( defined( 'BLOGUPLOADDIR' ) )
    15271537                                $dir = untrailingslashit( BLOGUPLOADDIR );
    15281538                        $url = str_replace( UPLOADS, 'files', $url );