Make WordPress Core

Opened 4 years ago

Last modified 3 years ago

#14840 closed defect (bug)

Constant UPLOADS not working for the main site if MULTISITES is not enabled — at Version 1

Reported by: Axel_germany Owned by:
Milestone: 3.0.2 Priority: high
Severity: major Version: 3.1
Component: Upload Keywords:
Focuses: Cc:

Description (last modified by nacin)

You can enable Multisite support by defining the constant
"MULTISITE“ within wp-config.php. Thus if you don't have multisite support enabled the Constant isn't set and defined(constant("MULTISITE“)) returns false. However on line 89 of the file wp-settings.php the constant "MULTISITE“ is defined and set to „false“ if your wp is not a multisite wp.

// Initialize multisite if enabled.
if ( is_multisite() ) {
        require( ABSPATH . WPINC . '/ms-blogs.php' );
        require( ABSPATH . WPINC . '/ms-settings.php' );
} elseif ( ! defined( 'MULTISITE' ) ) {
        define( 'MULTISITE', false );

Due to this the overwriting of the upload path which is possible by defining the constant "UPLOADS“ doesn't work for the main site because the if clause in in line 2146 of wp-includes/functions.php

if ( defined('UPLOADS') && !$main_override && ( !isset( $switched ) || $switched === false ) ) {
                $dir = ABSPATH . UPLOADS;
                $url = trailingslashit( $siteurl ) . UPLOADS;

isn't true even if the CONSTANT 'UPLOADS' is defined because $main_override is true and thus !$main_override is false. $main_override is true because line 2127 of the same file is in this case true.

$main_override = defined( 'MULTISITE' ) && is_main_site();

From my point of view it would be better to use

$main_override = MULTISITE && is_main_site(); 

used Version: a development version (3.1-alpha) (SVN TRUNK Sept. 10 2010)

Change History (1)

comment:1 nacin4 years ago

  • Description modified (diff)
Note: See TracTickets for help on using tickets.