WordPress.org

Make WordPress Core

Changeset 21757


Ignore:
Timestamp:
09/05/12 01:08:23 (20 months ago)
Author:
nacin
Message:

A more generic message for wp_upload_dir(). see #21796, for 3.4.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3.4/wp-includes/functions.php

    r21146 r21757  
    14871487    // Make sure we have an uploads dir 
    14881488    if ( ! wp_mkdir_p( $uploads['path'] ) ) { 
    1489         $message = sprintf( __( 'Unable to create directory %s. Is its parent directory writable by the server?' ), $uploads['path'] ); 
     1489        if ( 0 === strpos( $uploads['basedir'], ABSPATH ) ) 
     1490            $error_path = str_replace( ABSPATH, '', $uploads['basedir'] ) . $uploads['subdir']; 
     1491        else 
     1492            $error_path = basename( $uploads['basedir'] ) . $uploads['subdir']; 
     1493 
     1494        $message = sprintf( __( 'Unable to create directory %s. Is its parent directory writable by the server?' ), $error_path ); 
    14901495        return array( 'error' => $message ); 
    14911496    } 
     
    16051610    $new_file = $upload['path'] . "/$filename"; 
    16061611    if ( ! wp_mkdir_p( dirname( $new_file ) ) ) { 
    1607         $message = sprintf( __( 'Unable to create directory %s. Is its parent directory writable by the server?' ), dirname( $new_file ) ); 
     1612        if ( 0 === strpos( $upload['basedir'], ABSPATH ) ) 
     1613            $error_path = str_replace( ABSPATH, '', $upload['basedir'] ) . $upload['subdir']; 
     1614        else 
     1615            $error_path = basename( $upload['basedir'] ) . $upload['subdir']; 
     1616 
     1617        $message = sprintf( __( 'Unable to create directory %s. Is its parent directory writable by the server?' ), $error_path ); 
    16081618        return array( 'error' => $message ); 
    16091619    } 
Note: See TracChangeset for help on using the changeset viewer.