Deal correctly with empty upload_path option. Hat tip: tellyworth.
git-svn-id: https://develop.svn.wordpress.org/trunk@7134 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
387f9a1e87
commit
8415bccde9
@ -1063,7 +1063,10 @@ function path_join( $base, $path ) {
|
|||||||
// Returns an array containing the current upload directory's path and url, or an error message.
|
// Returns an array containing the current upload directory's path and url, or an error message.
|
||||||
function wp_upload_dir( $time = NULL ) {
|
function wp_upload_dir( $time = NULL ) {
|
||||||
$siteurl = get_option( 'siteurl' );
|
$siteurl = get_option( 'siteurl' );
|
||||||
$upload_path = $dir = get_option( 'upload_path' );
|
$upload_path = get_option( 'upload_path' );
|
||||||
|
if ( trim($upload_path) === '' )
|
||||||
|
$upload_path = 'wp-content/uploads';
|
||||||
|
$dir = $upload_path;
|
||||||
|
|
||||||
// $dir is absolute, $path is (maybe) relative to ABSPATH
|
// $dir is absolute, $path is (maybe) relative to ABSPATH
|
||||||
$dir = path_join( ABSPATH, $upload_path );
|
$dir = path_join( ABSPATH, $upload_path );
|
||||||
@ -1072,9 +1075,6 @@ function wp_upload_dir( $time = NULL ) {
|
|||||||
if ( !$url = get_option( 'upload_url_path' ) )
|
if ( !$url = get_option( 'upload_url_path' ) )
|
||||||
$url = trailingslashit( $siteurl ) . $path;
|
$url = trailingslashit( $siteurl ) . $path;
|
||||||
|
|
||||||
if ( $dir == ABSPATH ) // the option was empty
|
|
||||||
$dir = ABSPATH . 'wp-content/uploads';
|
|
||||||
|
|
||||||
if ( defined('UPLOADS') ) {
|
if ( defined('UPLOADS') ) {
|
||||||
$dir = ABSPATH . UPLOADS;
|
$dir = ABSPATH . UPLOADS;
|
||||||
$url = trailingslashit( $siteurl ) . UPLOADS;
|
$url = trailingslashit( $siteurl ) . UPLOADS;
|
||||||
|
Loading…
Reference in New Issue
Block a user