web/wp-includes/ms-default-constants.php
changeset 204 09a1c134465b
parent 194 32102edaa81b
equal deleted inserted replaced
203:f507feede89a 204:09a1c134465b
     8  */
     8  */
     9 
     9 
    10 /**
    10 /**
    11  * Defines Multisite upload constants.
    11  * Defines Multisite upload constants.
    12  *
    12  *
       
    13  * Exists for backward compatibility with legacy file-serving through
       
    14  * wp-includes/ms-files.php (wp-content/blogs.php in MU).
       
    15  *
    13  * @since 3.0.0
    16  * @since 3.0.0
    14  */
    17  */
    15 function ms_upload_constants(  ) {
    18 function ms_upload_constants() {
    16 	global $wpdb;
    19 	global $wpdb;
    17 
    20 
    18 	/** @since 3.0.0 */
    21 	// This filter is attached in ms-default-filters.php but that file is not included during SHORTINIT.
       
    22 	add_filter( 'default_site_option_ms_files_rewriting', '__return_true' );
       
    23 
       
    24 	if ( ! get_site_option( 'ms_files_rewriting' ) )
       
    25 		return;
       
    26 
    19 	// Base uploads dir relative to ABSPATH
    27 	// Base uploads dir relative to ABSPATH
    20 	if ( !defined( 'UPLOADBLOGSDIR' ) )
    28 	if ( !defined( 'UPLOADBLOGSDIR' ) )
    21 		define( 'UPLOADBLOGSDIR', 'wp-content/blogs.dir' );
    29 		define( 'UPLOADBLOGSDIR', 'wp-content/blogs.dir' );
    22 
    30 
    23 	/** @since 3.0.0 */
    31 	// Note, the main site in a post-MU network uses wp-content/uploads.
    24 	if ( !defined( 'UPLOADS' ) ) {
    32 	// This is handled in wp_upload_dir() by ignoring UPLOADS for this case.
       
    33 	if ( ! defined( 'UPLOADS' ) ) {
       
    34 		define( 'UPLOADS', UPLOADBLOGSDIR . "/{$wpdb->blogid}/files/" );
       
    35 
    25 		// Uploads dir relative to ABSPATH
    36 		// Uploads dir relative to ABSPATH
    26 		define( 'UPLOADS', UPLOADBLOGSDIR . "/{$wpdb->blogid}/files/" );
    37 		if ( 'wp-content/blogs.dir' == UPLOADBLOGSDIR && ! defined( 'BLOGUPLOADDIR' ) )
    27 		if ( 'wp-content/blogs.dir' == UPLOADBLOGSDIR )
       
    28 			define( 'BLOGUPLOADDIR', WP_CONTENT_DIR . "/blogs.dir/{$wpdb->blogid}/files/" );
    38 			define( 'BLOGUPLOADDIR', WP_CONTENT_DIR . "/blogs.dir/{$wpdb->blogid}/files/" );
    29 	}
    39 	}
    30 }
    40 }
    31 
    41 
    32 /**
    42 /**
    51 
    61 
    52 	/**
    62 	/**
    53 	 * @since 2.6.0
    63 	 * @since 2.6.0
    54 	 */
    64 	 */
    55 	if ( !defined( 'ADMIN_COOKIE_PATH' ) ) {
    65 	if ( !defined( 'ADMIN_COOKIE_PATH' ) ) {
    56 		if( !is_subdomain_install() ) {
    66 		if ( ! is_subdomain_install() || trim( parse_url( get_option( 'siteurl' ), PHP_URL_PATH ), '/' ) ) {
    57 			define( 'ADMIN_COOKIE_PATH', SITECOOKIEPATH );
    67 			define( 'ADMIN_COOKIE_PATH', SITECOOKIEPATH );
    58 		} else {
    68 		} else {
    59 			define( 'ADMIN_COOKIE_PATH', SITECOOKIEPATH . 'wp-admin' );
    69 			define( 'ADMIN_COOKIE_PATH', SITECOOKIEPATH . 'wp-admin' );
    60 		}
    70 		}
    61 	}
    71 	}
    72 }
    82 }
    73 
    83 
    74 /**
    84 /**
    75  * Defines Multisite file constants.
    85  * Defines Multisite file constants.
    76  *
    86  *
       
    87  * Exists for backward compatibility with legacy file-serving through
       
    88  * wp-includes/ms-files.php (wp-content/blogs.php in MU).
       
    89  *
    77  * @since 3.0.0
    90  * @since 3.0.0
    78  */
    91  */
    79 function ms_file_constants(  ) {
    92 function ms_file_constants() {
    80 	/**
    93 	/**
    81 	 * Optional support for X-Sendfile header
    94 	 * Optional support for X-Sendfile header
    82 	 * @since 3.0.0
    95 	 * @since 3.0.0
    83 	 */
    96 	 */
    84 	if ( !defined( 'WPMU_SENDFILE' ) )
    97 	if ( !defined( 'WPMU_SENDFILE' ) )