Make WordPress Core


Ignore:
Timestamp:
09/11/2012 10:06:49 PM (14 years ago)
Author:
nacin
Message:

Always return upload directory information from wp_upload_dir(), even if there is an error. Append the error to the array. see #19235.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/functions.php

    r21818 r21822  
    14681468        }
    14691469
    1470         $bdir = $dir;
    1471         $burl = $url;
     1470        $basedir = $dir;
     1471        $baseurl = $url;
    14721472
    14731473        $subdir = '';
     
    14841484        $url .= $subdir;
    14851485
    1486         $uploads = apply_filters( 'upload_dir', array( 'path' => $dir, 'url' => $url, 'subdir' => $subdir, 'basedir' => $bdir, 'baseurl' => $burl, 'error' => false ) );
     1486        $uploads = apply_filters( 'upload_dir',
     1487                array(
     1488                        'path'    => $dir,
     1489                        'url'     => $url,
     1490                        'subdir'  => $subdir,
     1491                        'basedir' => $basedir,
     1492                        'baseurl' => $baseurl,
     1493                        'error'   => false,
     1494                ) );
    14871495
    14881496        // Make sure we have an uploads dir
    14891497        if ( ! wp_mkdir_p( $uploads['path'] ) ) {
    14901498                $message = sprintf( __( 'Unable to create directory %s. Is its parent directory writable by the server?' ), $uploads['path'] );
    1491                 return array( 'error' => $message );
     1499                $uploads['error'] = $message;
    14921500        }
    14931501
Note: See TracChangeset for help on using the changeset viewer.