From 4ea9f012967e480e119f625c2071d3fee659bccf Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Tue, 18 Sep 2012 18:07:18 +0000 Subject: [PATCH] Account for the old 'main override' in wp_upload_dir() for the main site in a post-MU network by declining to define the UPLOADS constant. Fixes uploads on the main site of a post-MU network that uses ms-files rewriting. see #19235. git-svn-id: http://core.svn.wordpress.org/trunk@21892 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/ms-default-constants.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/wp-includes/ms-default-constants.php b/wp-includes/ms-default-constants.php index d2a2c27500..56cd1315e8 100644 --- a/wp-includes/ms-default-constants.php +++ b/wp-includes/ms-default-constants.php @@ -24,15 +24,17 @@ function ms_upload_constants() { if ( ! get_site_option( 'ms_files_rewriting' ) ) return; - /** @since 3.0.0 */ // Base uploads dir relative to ABSPATH if ( !defined( 'UPLOADBLOGSDIR' ) ) define( 'UPLOADBLOGSDIR', 'wp-content/blogs.dir' ); - /** @since 3.0.0 */ - if ( !defined( 'UPLOADS' ) ) { + // The main site in a post-MU network uses wp-content/uploads. + // This used to be handled in wp_upload_dir() by ignoring UPLOADS for this case. Avoid defining it instead. + if ( ! defined( 'UPLOADS' ) ) { + if ( ! ( is_main_site() && defined( 'MULTISITE' ) ) ) + define( 'UPLOADS', UPLOADBLOGSDIR . "/{$wpdb->blogid}/files/" ); + // Uploads dir relative to ABSPATH - define( 'UPLOADS', UPLOADBLOGSDIR . "/{$wpdb->blogid}/files/" ); if ( 'wp-content/blogs.dir' == UPLOADBLOGSDIR && ! defined( 'BLOGUPLOADDIR' ) ) define( 'BLOGUPLOADDIR', WP_CONTENT_DIR . "/blogs.dir/{$wpdb->blogid}/files/" ); }