From a7011c50ca333a49fedc71ba159c103fafdaf9ab Mon Sep 17 00:00:00 2001 From: wpmuguru Date: Mon, 8 Mar 2010 19:52:29 +0000 Subject: [PATCH] allow existing media path on main site when converting to multisite, see #12549 git-svn-id: http://svn.automattic.com/wordpress/trunk@13619 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/schema.php | 4 ++++ wp-includes/functions.php | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/wp-admin/includes/schema.php b/wp-admin/includes/schema.php index ce06c40485..cad7f065d7 100644 --- a/wp-admin/includes/schema.php +++ b/wp-admin/includes/schema.php @@ -726,6 +726,10 @@ Thanks! $blog_id = $wpdb->insert_id; update_user_meta( $site_user->ID, 'source_domain', $domain ); update_user_meta( $site_user->ID, 'primary_blog', $blog_id ); + if ( !$upload_path = get_option( 'upload_path' ) ) { + $upload_path = substr( WP_CONTENT_DIR, strlen( ABSPATH ) ) . '/uploads'; + update_option( 'upload_path', $upload_path ); + } } if ( $vhost == 'yes' ) diff --git a/wp-includes/functions.php b/wp-includes/functions.php index 48cbc63bb1..78d699d6d4 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -2131,7 +2131,7 @@ function wp_upload_dir( $time = null ) { $url = trailingslashit( $siteurl ) . $upload_path; } - if ( defined('UPLOADS') ) { + if ( defined('UPLOADS') && ( WP_CONTENT_DIR . '/uploads' != ABSPATH . $upload_path ) ) { $dir = ABSPATH . UPLOADS; $url = trailingslashit( $siteurl ) . UPLOADS; } @@ -4077,4 +4077,4 @@ function __return_true() { function __return_false() { return false; } -?> \ No newline at end of file +?>