Make WordPress Core


Ignore:
Timestamp:
10/23/2012 01:49:00 PM (12 years ago)
Author:
ryan
Message:

A more generic message for wp_upload_dir(). Props nacin. fixes #21796

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/wp-includes/functions.php

    r22222 r22276  
    15711571    // Make sure we have an uploads dir
    15721572    if ( ! wp_mkdir_p( $uploads['path'] ) ) {
    1573         $message = sprintf( __( 'Unable to create directory %s. Is its parent directory writable by the server?' ), $uploads['path'] );
     1573        if ( 0 === strpos( $uploads['basedir'], ABSPATH ) )
     1574            $error_path = str_replace( ABSPATH, '', $uploads['basedir'] ) . $uploads['subdir'];
     1575        else
     1576            $error_path = basename( $uploads['basedir'] ) . $uploads['subdir'];
     1577
     1578        $message = sprintf( __( 'Unable to create directory %s. Is its parent directory writable by the server?' ), $error_path );
    15741579        $uploads['error'] = $message;
    15751580    }
     
    16891694    $new_file = $upload['path'] . "/$filename";
    16901695    if ( ! wp_mkdir_p( dirname( $new_file ) ) ) {
    1691         $message = sprintf( __( 'Unable to create directory %s. Is its parent directory writable by the server?' ), dirname( $new_file ) );
     1696        if ( 0 === strpos( $upload['basedir'], ABSPATH ) )
     1697            $error_path = str_replace( ABSPATH, '', $upload['basedir'] ) . $upload['subdir'];
     1698        else
     1699            $error_path = basename( $upload['basedir'] ) . $upload['subdir'];
     1700
     1701        $message = sprintf( __( 'Unable to create directory %s. Is its parent directory writable by the server?' ), $error_path );
    16921702        return array( 'error' => $message );
    16931703    }
Note: See TracChangeset for help on using the changeset viewer.