add upload dir support to switch to blog, props ocean90, see #11998

git-svn-id: https://develop.svn.wordpress.org/trunk@14510 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ron Rennick 2010-05-07 22:50:05 +00:00
parent b5f96d7953
commit 9d47e01b62
1 changed files with 3 additions and 2 deletions

View File

@ -2114,6 +2114,7 @@ function path_join( $base, $path ) {
* @return array See above for description. * @return array See above for description.
*/ */
function wp_upload_dir( $time = null ) { function wp_upload_dir( $time = null ) {
global $switched;
$siteurl = get_option( 'siteurl' ); $siteurl = get_option( 'siteurl' );
$upload_path = get_option( 'upload_path' ); $upload_path = get_option( 'upload_path' );
$upload_path = trim($upload_path); $upload_path = trim($upload_path);
@ -2136,12 +2137,12 @@ function wp_upload_dir( $time = null ) {
$url = trailingslashit( $siteurl ) . $upload_path; $url = trailingslashit( $siteurl ) . $upload_path;
} }
if ( defined('UPLOADS') && ( WP_CONTENT_DIR . '/uploads' != ABSPATH . $upload_path ) ) { if ( defined('UPLOADS') && ( WP_CONTENT_DIR . '/uploads' != ABSPATH . $upload_path ) && ( !isset( $switched ) || $switched === false ) ) {
$dir = ABSPATH . UPLOADS; $dir = ABSPATH . UPLOADS;
$url = trailingslashit( $siteurl ) . UPLOADS; $url = trailingslashit( $siteurl ) . UPLOADS;
} }
if ( is_multisite() && ( WP_CONTENT_DIR . '/uploads' != ABSPATH . $upload_path ) ) { if ( is_multisite() && ( WP_CONTENT_DIR . '/uploads' != ABSPATH . $upload_path ) && ( !isset( $switched ) || $switched === false ) ) {
if ( defined( 'BLOGUPLOADDIR' ) ) if ( defined( 'BLOGUPLOADDIR' ) )
$dir = untrailingslashit(BLOGUPLOADDIR); $dir = untrailingslashit(BLOGUPLOADDIR);
$url = str_replace( UPLOADS, 'files', $url ); $url = str_replace( UPLOADS, 'files', $url );