Make WordPress Core

Changeset 13065


Ignore:
Timestamp:
02/12/2010 08:22:34 AM (17 years ago)
Author:
westi
Message:

Improve the implementation of the default constant defining functions for multisite. See #11881.

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/ms-default-constants.php

    r12936 r13065  
    88
    99/**
    10  * Defines Multisite default constants.
     10 * Defines Multisite upload constants.
    1111 *
    1212 * @since 3.0.0
    13  * @param $context
    1413 */
    15 function ms_default_constants( $context ) {
    16         switch( $context ) {
    17                 case 'uploads' :
    18                         global $wpdb;
    19                         /** @since 3.0.0 */
    20                         if ( !defined( 'UPLOADBLOGSDIR' ) )
    21                                 define( 'UPLOADBLOGSDIR', 'wp-content/blogs.dir' );
    22                         /** @since 3.0.0 */
    23                         if ( !defined( 'UPLOADS' ) )
    24                                 define( 'UPLOADS', UPLOADBLOGSDIR . "/{$wpdb->blogid}/files/" );
    25                         /** @since 3.0.0 */
    26                         if ( !defined( 'BLOGUPLOADDIR' ) )
    27                                 define( 'BLOGUPLOADDIR', WP_CONTENT_DIR . "/blogs.dir/{$wpdb->blogid}/files/" );
    28                         break;
    29                 case 'cookies' :
    30                         global $current_site;
    31                         /**
    32                          * @since 1.2.0
    33                          */
    34                         if ( !defined( 'COOKIEPATH' ) )
    35                                         define( 'COOKIEPATH', $current_site->path );
    36                         /**
    37                          * @since 1.5.0
    38                          */
    39                         if ( !defined( 'SITECOOKIEPATH' ) )
    40                                         define( 'SITECOOKIEPATH', $current_site->path );
    41                         /**
    42                          * @since 2.6.0
    43                          */
    44                         if ( !defined( 'ADMIN_COOKIE_PATH' ) ) {
    45                                         if( !is_subdomain_install() ) {
    46                                                         define( 'ADMIN_COOKIE_PATH', SITECOOKIEPATH );
    47                                         } else {
    48                                                         define( 'ADMIN_COOKIE_PATH', SITECOOKIEPATH . 'wp-admin' );
    49                                         }
    50                         }
    51                         /**
    52                          * @since 2.0.0
    53                          */
    54                         if ( !defined('COOKIE_DOMAIN') )
    55                                         define('COOKIE_DOMAIN', '.' . $current_site->cookie_domain);
    56                         break;
    57                 case 'ms-files' :
    58                         /**
    59                          * Optional support for X-Sendfile header
    60                          * @since 3.0.0
    61                          */
    62                         if ( !defined( 'WPMU_SENDFILE' ) )
    63                                 define( 'WPMU_SENDFILE', false );
    64                         /**
    65                          * Optional support for X-Accel-Redirect header
    66                          * @since 3.0.0
    67                          */
    68                         if ( !defined( 'WPMU_ACCEL_REDIRECT' ) )
    69                                 define( 'WPMU_ACCEL_REDIRECT', false );
    70                         break;
     14function ms_upload_constants(  ) {
     15        global $wpdb;
     16
     17        /** @since 3.0.0 */
     18        if ( !defined( 'UPLOADBLOGSDIR' ) )
     19                define( 'UPLOADBLOGSDIR', 'wp-content/blogs.dir' );
     20
     21        /** @since 3.0.0 */
     22        if ( !defined( 'UPLOADS' ) )
     23                define( 'UPLOADS', UPLOADBLOGSDIR . "/{$wpdb->blogid}/files/" );
     24
     25        /** @since 3.0.0 */
     26        if ( !defined( 'BLOGUPLOADDIR' ) )
     27                define( 'BLOGUPLOADDIR', WP_CONTENT_DIR . "/blogs.dir/{$wpdb->blogid}/files/" );
     28}
     29
     30/**
     31 * Defines Multisite cookie constants.
     32 *
     33 * @since 3.0.0
     34 */
     35function ms_cookie_constants(  ) {
     36        global $current_site;
     37       
     38        /**
     39         * @since 1.2.0
     40         */
     41        if ( !defined( 'COOKIEPATH' ) )
     42                define( 'COOKIEPATH', $current_site->path );
     43
     44        /**
     45         * @since 1.5.0
     46         */
     47        if ( !defined( 'SITECOOKIEPATH' ) )
     48                define( 'SITECOOKIEPATH', $current_site->path );
     49
     50        /**
     51         * @since 2.6.0
     52         */
     53        if ( !defined( 'ADMIN_COOKIE_PATH' ) ) {
     54                if( !is_subdomain_install() ) {
     55                        define( 'ADMIN_COOKIE_PATH', SITECOOKIEPATH );
     56                } else {
     57                        define( 'ADMIN_COOKIE_PATH', SITECOOKIEPATH . 'wp-admin' );
     58                }
    7159        }
     60
     61        /**
     62         * @since 2.0.0
     63         */
     64        if ( !defined('COOKIE_DOMAIN') )
     65                define('COOKIE_DOMAIN', '.' . $current_site->cookie_domain);
     66}
     67
     68/**
     69 * Defines Multisite file constants.
     70 *
     71 * @since 3.0.0
     72 */
     73function ms_file_constants(  ) {
     74        /**
     75         * Optional support for X-Sendfile header
     76         * @since 3.0.0
     77         */
     78        if ( !defined( 'WPMU_SENDFILE' ) )
     79                define( 'WPMU_SENDFILE', false );
     80
     81        /**
     82         * Optional support for X-Accel-Redirect header
     83         * @since 3.0.0
     84         */
     85        if ( !defined( 'WPMU_ACCEL_REDIRECT' ) )
     86                define( 'WPMU_ACCEL_REDIRECT', false );
    7287}
    7388?>
  • trunk/wp-includes/ms-files.php

    r13040 r13065  
    1414}
    1515
    16 ms_default_constants( 'ms-files' );
     16ms_file_constants( );
    1717
    1818error_reporting( 0 );
  • trunk/wp-includes/ms-settings.php

    r12921 r13065  
    125125
    126126// Define upload directory constants
    127 ms_default_constants( 'uploads' );
     127ms_upload_constants( );
    128128
    129129?>
  • trunk/wp-settings.php

    r13064 r13065  
    151151        }
    152152        unset($file);
    153         ms_default_constants( 'cookies' );
     153
     154        ms_cookie_constants(  );
    154155}
    155156
Note: See TracChangeset for help on using the changeset viewer.