Ticket #19235: 19235.5.diff
File 19235.5.diff, 3.4 KB (added by , 12 years ago) |
---|
-
wp-includes/ms-default-constants.php
28 28 if ( !defined( 'UPLOADBLOGSDIR' ) ) 29 29 define( 'UPLOADBLOGSDIR', 'wp-content/blogs.dir' ); 30 30 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. 33 33 if ( ! defined( 'UPLOADS' ) ) { 34 if ( ! ( is_main_site() && defined( 'MULTISITE' ) ) ) 35 define( 'UPLOADS', UPLOADBLOGSDIR . "/{$wpdb->blogid}/files/" ); 34 define( 'UPLOADS', UPLOADBLOGSDIR . "/{$wpdb->blogid}/files/" ); 36 35 37 36 // Uploads dir relative to ABSPATH 38 37 if ( 'wp-content/blogs.dir' == UPLOADBLOGSDIR && ! defined( 'BLOGUPLOADDIR' ) ) -
wp-includes/functions.php
1503 1503 $url = trailingslashit( $siteurl ) . $upload_path; 1504 1504 } 1505 1505 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' ) ) ) { 1507 1509 $dir = ABSPATH . UPLOADS; 1508 1510 $url = trailingslashit( $siteurl ) . UPLOADS; 1509 1511 } 1510 1512 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' ) ) ) { 1514 1515 1515 1516 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 1517 1519 // prevents a four-digit ID from conflicting with a year-based directory for the main site. 1518 1520 // 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.) 1520 1522 1523 $blog_id = get_current_blog_id(); 1521 1524 $ms_dir = defined( 'MULTISITE' ) ? '/sites/' : '/'; 1522 1525 $dir .= $ms_dir . $blog_id; 1523 1526 $url .= $ms_dir . $blog_id; 1524 } elseif ( ! ms_is_switched() ) { 1527 1528 } elseif ( defined( 'UPLOADS' ) && ! ms_is_switched() ) { 1525 1529 // 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 1526 1536 if ( defined( 'BLOGUPLOADDIR' ) ) 1527 1537 $dir = untrailingslashit( BLOGUPLOADDIR ); 1528 1538 $url = str_replace( UPLOADS, 'files', $url );