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.
git-svn-id: http://core.svn.wordpress.org/trunk@22106 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
4cbc20ada1
commit
8451f7e987
|
@ -1509,21 +1509,18 @@ function wp_upload_dir( $time = null ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// If multisite (if not the main site in a post-MU network)
|
// If multisite (if not the main site in a post-MU network)
|
||||||
if ( is_multisite() && ! ( is_main_site() && defined( 'MULTISITE' ) ) ) {
|
$blog_id = get_current_blog_id();
|
||||||
|
if ( is_multisite() && ! ( is_main_site( $blog_id ) && defined( 'MULTISITE' ) ) ) {
|
||||||
|
|
||||||
if ( ! get_site_option( 'ms_files_rewriting' ) ) {
|
if ( ! get_site_option( 'ms_files_rewriting' ) ) {
|
||||||
// Append sites/%d if we're not on the main site (for post-MU networks). The extra directory
|
// Append sites/%d if we're not on the main site (for post-MU networks). The extra directory
|
||||||
// prevents a four-digit ID from conflict with a year-based directory for the main site.
|
// prevents a four-digit ID from conflicting with a year-based directory for the main site.
|
||||||
// If a MU-era network disables ms-files rewriting manually, they don't need the extra
|
// But if a MU-era network has disabled ms-files rewriting manually, they don't need the extra
|
||||||
// directory, as they never had wp-content/uploads for the main site.
|
// directory, as they never had wp-content/uploads for the main site.
|
||||||
|
|
||||||
if ( defined( 'MULTISITE' ) )
|
$ms_dir = defined( 'MULTISITE' ) ? '/sites/' : '/';
|
||||||
$ms_dir = '/sites/' . get_current_blog_id();
|
$dir .= $ms_dir . $blog_id;
|
||||||
else
|
$url .= $ms_dir . $blog_id;
|
||||||
$ms_dir = '/' . get_current_blog_id();
|
|
||||||
|
|
||||||
$dir .= $ms_dir;
|
|
||||||
$url .= $ms_dir;
|
|
||||||
} elseif ( ! ms_is_switched() ) {
|
} elseif ( ! ms_is_switched() ) {
|
||||||
// Handle the old-form ms-files.php rewriting if the network still has that enabled.
|
// Handle the old-form ms-files.php rewriting if the network still has that enabled.
|
||||||
if ( defined( 'BLOGUPLOADDIR' ) )
|
if ( defined( 'BLOGUPLOADDIR' ) )
|
||||||
|
|
Loading…
Reference in New Issue