Have wp_upload_dir() account for blog switching, ms-files rewriting, and the UPLOADS constant properly. This type of logic needs a lot of code comments.

Prevents wp_upload_dir() from obeying the UPLOADS constant when ms-files rewriting is enabled and a blog is switched.

Reverts [22106] thanks to [22108].

see #19235.



git-svn-id: http://core.svn.wordpress.org/trunk@22222 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Nacin
2012-10-12 22:05:02 +00:00
parent 5302794b9b
commit dc3fbf216f
2 changed files with 26 additions and 14 deletions

View File

@@ -28,11 +28,10 @@ function ms_upload_constants() {
if ( !defined( 'UPLOADBLOGSDIR' ) )
define( 'UPLOADBLOGSDIR', 'wp-content/blogs.dir' );
// 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.
// Note, the main site in a post-MU network uses wp-content/uploads.
// This is handled in wp_upload_dir() by ignoring UPLOADS for this case.
if ( ! defined( 'UPLOADS' ) ) {
if ( ! ( is_main_site() && defined( 'MULTISITE' ) ) )
define( 'UPLOADS', UPLOADBLOGSDIR . "/{$wpdb->blogid}/files/" );
define( 'UPLOADS', UPLOADBLOGSDIR . "/{$wpdb->blogid}/files/" );
// Uploads dir relative to ABSPATH
if ( 'wp-content/blogs.dir' == UPLOADBLOGSDIR && ! defined( 'BLOGUPLOADDIR' ) )