allow custom content dir in WP 3.0 main site, fixes #13733

git-svn-id: http://svn.automattic.com/wordpress/trunk@15197 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
wpmuguru 2010-06-10 19:37:51 +00:00
parent 69164abe07
commit 74d9ba3159
1 changed files with 3 additions and 4 deletions

View File

@ -2125,14 +2125,13 @@ function wp_upload_dir( $time = null ) {
$siteurl = get_option( 'siteurl' );
$upload_path = get_option( 'upload_path' );
$upload_path = trim($upload_path);
$main_override = false;
$main_override = defined( 'MULTISITE' ) && is_main_site();
if ( empty($upload_path) ) {
$dir = WP_CONTENT_DIR . '/uploads';
} else {
$dir = $upload_path;
if ( 'wp-content/uploads' == $upload_path ) {
$dir = WP_CONTENT_DIR . '/uploads';
$main_override = defined( 'MULTISITE' ) && is_main_site();
} elseif ( 0 !== strpos($dir, ABSPATH) ) {
// $dir is absolute, $upload_path is (maybe) relative to ABSPATH
$dir = path_join( ABSPATH, $dir );
@ -2146,12 +2145,12 @@ function wp_upload_dir( $time = null ) {
$url = trailingslashit( $siteurl ) . $upload_path;
}
if ( defined('UPLOADS') && ( !$main_override || WP_CONTENT_DIR . '/uploads' != ABSPATH . $upload_path ) && ( !isset( $switched ) || $switched === false ) ) {
if ( defined('UPLOADS') && !$main_override && ( !isset( $switched ) || $switched === false ) ) {
$dir = ABSPATH . UPLOADS;
$url = trailingslashit( $siteurl ) . UPLOADS;
}
if ( is_multisite() && ( !$main_override || WP_CONTENT_DIR . '/uploads' != ABSPATH . $upload_path ) && ( !isset( $switched ) || $switched === false ) ) {
if ( is_multisite() && !$main_override && ( !isset( $switched ) || $switched === false ) ) {
if ( defined( 'BLOGUPLOADDIR' ) )
$dir = untrailingslashit(BLOGUPLOADDIR);
$url = str_replace( UPLOADS, 'files', $url );