WordPress.org

Make WordPress Core

Ticket #18489: 18489.2.patch

File 18489.2.patch, 1.7 KB (added by eddiemoya, 7 years ago)

Does not define the option but checks to see if it has been defined.

  • functions.php

    # This patch file was generated by NetBeans IDE
    # Following Index: paths are relative to: /Applications/MAMP/htdocs/WordPressCore/trunk/wp-includes
    # This patch can be applied using context Tools: Patch action on respective folder.
    # It uses platform neutral UTF-8 encoding and \n newlines.
    # Above lines and this line are ignored by the patching process.
     
    22212221        $upload_path = get_option( 'upload_path' );
    22222222        $upload_path = trim($upload_path);
    22232223        $main_override = is_multisite() && defined( 'MULTISITE' ) && is_main_site();
    2224         if ( empty($upload_path) ) {
    2225                 $dir = WP_CONTENT_DIR . '/uploads';
    2226         } else {
     2224       
     2225        // If WP_UPLOADS_DIR is defined, use it, otherwise assum the default for now.
     2226        $dir = ( defined('WP_UPLOADS_DIR') ) ? WP_UPLOADS_DIR : WP_CONTENT_DIR . '/uploads'; ;
     2227
     2228        if (!empty($upload_path)) {
    22272229                $dir = $upload_path;
    2228                 if ( 'wp-content/uploads' == $upload_path ) {
    2229                         $dir = WP_CONTENT_DIR . '/uploads';
    2230                 } elseif ( 0 !== strpos($dir, ABSPATH) ) {
     2230            if ('wp-content/uploads' != $upload_path || 0 !== strpos($dir, ABSPATH)) {
    22312231                        // $dir is absolute, $upload_path is (maybe) relative to ABSPATH
    2232                         $dir = path_join( ABSPATH, $dir );
     2232                $dir = path_join(ABSPATH, $dir);
    22332233                }
    22342234        }
    22352235
    22362236        if ( !$url = get_option( 'upload_url_path' ) ) {
    22372237                if ( empty($upload_path) || ( 'wp-content/uploads' == $upload_path ) || ( $upload_path == $dir ) )
    2238                         $url = WP_CONTENT_URL . '/uploads';
     2238                        $url = ( defined('WP_UPLOADS_URL') ) ? WP_UPLOADS_DIR : WP_CONTENT_URL . '/uploads';
    22392239                else
    22402240                        $url = trailingslashit( $siteurl ) . $upload_path;
    22412241        }