Make WordPress Core

Changeset 12405


Ignore:
Timestamp:
12/15/2009 05:53:51 PM (15 years ago)
Author:
ryan
Message:

Fix upload dir defaults. Props Denis-de-Bernardy. fixes #11276

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/schema.php

    r12329 r12405  
    190190
    191191    if ( ini_get('safe_mode') ) {
    192         // Safe mode screws up mkdir(), so we must use a flat structure.
     192        // Safe mode can break mkdir() so use a flat structure by default.
    193193        $uploads_use_yearmonth_folders = 0;
    194         $upload_path = WP_CONTENT_DIR;
    195194    } else {
    196195        $uploads_use_yearmonth_folders = 1;
    197         $upload_path = WP_CONTENT_DIR . '/uploads';
    198196    }
    199197
     
    266264    // 2.0.1
    267265    'uploads_use_yearmonth_folders' => $uploads_use_yearmonth_folders,
    268     'upload_path' => $upload_path,
     266    'upload_path' => '',
    269267
    270268    // 2.0.3
  • trunk/wp-admin/options-misc.php

    r11781 r12405  
    3131<tr valign="top">
    3232<th scope="row"><label for="upload_path"><?php _e('Store uploads in this folder'); ?></label></th>
    33 <td><input name="upload_path" type="text" id="upload_path" value="<?php echo esc_attr(str_replace(ABSPATH, '', get_option('upload_path'))); ?>" class="regular-text code" />
     33<td><input name="upload_path" type="text" id="upload_path" value="<?php echo esc_attr(get_option('upload_path')); ?>" class="regular-text code" />
    3434<span class="description"><?php _e('Default is <code>wp-content/uploads</code>'); ?></span>
    3535</td>
  • trunk/wp-includes/functions.php

    r12403 r12405  
    20362036    $upload_path = get_option( 'upload_path' );
    20372037    $upload_path = trim($upload_path);
    2038     if ( empty($upload_path) )
     2038    if ( empty($upload_path) ) {
    20392039        $dir = WP_CONTENT_DIR . '/uploads';
    2040     else
     2040    } else {
    20412041        $dir = $upload_path;
    2042 
    2043     // $dir is absolute, $path is (maybe) relative to ABSPATH
    2044     $dir = path_join( ABSPATH, $dir );
     2042        if ( 'wp-content/uploads' == $upload_path ) {
     2043            $dir = WP_CONTENT_DIR . '/uploads';
     2044        } elseif ( 0 !== strpos($dir, ABSPATH) ) {
     2045            // $dir is absolute, $upload_path is (maybe) relative to ABSPATH
     2046            $dir = path_join( ABSPATH, $dir );
     2047        }
     2048    }
    20452049
    20462050    if ( !$url = get_option( 'upload_url_path' ) ) {
    2047         if ( empty($upload_path) or ( $upload_path == $dir ) )
     2051        if ( empty($upload_path) || ( 'wp-content/uploads' == $upload_path ) || ( $upload_path == $dir ) )
    20482052            $url = WP_CONTENT_URL . '/uploads';
    20492053        else
Note: See TracChangeset for help on using the changeset viewer.