WordPress.org

Make WordPress Core

Ticket #18489: 18489.patch

File 18489.patch, 2.9 KB (added by eddiemoya, 7 years ago)

default-constants.php, wp-settings.php, and /wp-includes/functions.php

  • wp-includes/default-constants.php

    # This patch file was generated by NetBeans IDE
    # Following Index: paths are relative to: /Applications/MAMP/htdocs/WordPressCore/trunk
    # 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.
     
    298298
    299299}
    300300
     301/**
     302 * Defines uploads directory WordPress constants
     303 *
     304 * @since 3.3
     305 */
     306function wp_uploads_constants() {
     307        /**
     308         * Allows for the uploads directory to be moved from the default location.
     309         *
     310         * @since 3.3
     311         */
     312        if ( !defined('WP_UPLOADS_DIR') )
     313                define('WP_UPLOADS_DIR', WP_CONTENT_DIR . '/uploads');
     314
     315        /**
     316         * Allows for the uploads directory to be moved from the default location.
     317         *
     318         * @since 3.3
     319         */
     320        if ( !defined('WP_UPLOADS_URL') )
     321                define('WP_UPLOADS_URL', WP_CONTENT_URL . '/uploads');
     322}
     323
    301324?>
  • wp-includes/functions.php

     
    22202220        $siteurl = get_option( 'siteurl' );
    22212221        $upload_path = get_option( 'upload_path' );
    22222222        $upload_path = trim($upload_path);
    2223         $main_override = is_multisite() && defined( 'MULTISITE' ) && is_main_site();
    2224         if ( empty($upload_path) ) {
    2225                 $dir = WP_CONTENT_DIR . '/uploads';
    2226         } else {
     2223        $main_override = is_multisite() && defined('MULTISITE') && is_main_site();
     2224        $dir = WP_UPLOADS_DIR;
     2225
     2226        if (!empty($upload_path)) {
    22272227                $dir = $upload_path;
    2228                 if ( 'wp-content/uploads' == $upload_path ) {
    2229                         $dir = WP_CONTENT_DIR . '/uploads';
    2230                 } elseif ( 0 !== strpos($dir, ABSPATH) ) {
     2228            if ('wp-content/uploads' != $upload_path || 0 !== strpos($dir, ABSPATH)) {
    22312229                        // $dir is absolute, $upload_path is (maybe) relative to ABSPATH
    2232                         $dir = path_join( ABSPATH, $dir );
     2230                $dir = path_join(ABSPATH, $dir);
    22332231                }
    22342232        }
    22352233
    22362234        if ( !$url = get_option( 'upload_url_path' ) ) {
    22372235                if ( empty($upload_path) || ( 'wp-content/uploads' == $upload_path ) || ( $upload_path == $dir ) )
    2238                         $url = WP_CONTENT_URL . '/uploads';
     2236                        $url = WP_UPLOADS_URL;
    22392237                else
    22402238                        $url = trailingslashit( $siteurl ) . $upload_path;
    22412239        }
  • wp-settings.php

     
    153153// Define must-use plugin directory constants, which may be overridden in the sunrise.php drop-in.
    154154wp_plugin_directory_constants( );
    155155
     156//Define the uploads directory constants - must be after wp_plugin_directory_constants() because it defines WP_CONTENT_URL
     157wp_uploads_constants();
     158
    156159// Load must-use plugins.
    157160foreach ( wp_get_mu_plugins() as $mu_plugin ) {
    158161        include_once( $mu_plugin );