Changeset 22222
- Timestamp:
- 10/12/2012 10:05:02 PM (12 years ago)
- Location:
- trunk/wp-includes
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/functions.php
r22108 r22222 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. 1520 1521 $ms_dir = defined( 'MULTISITE' ) ? '/sites/' : '/'; 1522 $dir .= $ms_dir . $blog_id; 1523 $url .= $ms_dir . $blog_id; 1524 } elseif ( ! ms_is_switched() ) { 1521 // directory, as they never had wp-content/uploads for the main site.) 1522 1523 if ( defined( 'MULTISITE' ) ) 1524 $ms_dir = '/sites/' . get_current_blog_id(); 1525 else 1526 $ms_dir = '/' . get_current_blog_id(); 1527 1528 $dir .= $ms_dir; 1529 $url .= $ms_dir; 1530 1531 } elseif ( defined( 'UPLOADS' ) && ! ms_is_switched() ) { 1525 1532 // Handle the old-form ms-files.php rewriting if the network still has that enabled. 1533 // When ms-files rewriting is enabled, then we only listen to UPLOADS when: 1534 // 1) we are not on the main site in a post-MU network, 1535 // as wp-content/uploads is used there, and 1536 // 2) we are not switched, as ms_upload_constants() hardcodes 1537 // these constants to reflect the original blog ID. 1538 1526 1539 if ( defined( 'BLOGUPLOADDIR' ) ) 1527 1540 $dir = untrailingslashit( BLOGUPLOADDIR ); -
trunk/wp-includes/ms-default-constants.php
r21892 r22222 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
Note: See TracChangeset
for help on using the changeset viewer.