mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-11 12:20:22 +00:00
Always return upload directory information from wp_upload_dir(), even if there is an error. Append the error to the array. see #19235.
git-svn-id: https://develop.svn.wordpress.org/trunk@21822 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -1467,8 +1467,8 @@ function wp_upload_dir( $time = null ) {
|
||||
$url = str_replace( UPLOADS, 'files', $url );
|
||||
}
|
||||
|
||||
$bdir = $dir;
|
||||
$burl = $url;
|
||||
$basedir = $dir;
|
||||
$baseurl = $url;
|
||||
|
||||
$subdir = '';
|
||||
if ( get_option( 'uploads_use_yearmonth_folders' ) ) {
|
||||
@@ -1483,12 +1483,20 @@ function wp_upload_dir( $time = null ) {
|
||||
$dir .= $subdir;
|
||||
$url .= $subdir;
|
||||
|
||||
$uploads = apply_filters( 'upload_dir', array( 'path' => $dir, 'url' => $url, 'subdir' => $subdir, 'basedir' => $bdir, 'baseurl' => $burl, 'error' => false ) );
|
||||
$uploads = apply_filters( 'upload_dir',
|
||||
array(
|
||||
'path' => $dir,
|
||||
'url' => $url,
|
||||
'subdir' => $subdir,
|
||||
'basedir' => $basedir,
|
||||
'baseurl' => $baseurl,
|
||||
'error' => false,
|
||||
) );
|
||||
|
||||
// Make sure we have an uploads dir
|
||||
if ( ! wp_mkdir_p( $uploads['path'] ) ) {
|
||||
$message = sprintf( __( 'Unable to create directory %s. Is its parent directory writable by the server?' ), $uploads['path'] );
|
||||
return array( 'error' => $message );
|
||||
$uploads['error'] = $message;
|
||||
}
|
||||
|
||||
return $uploads;
|
||||
|
||||
Reference in New Issue
Block a user