WordPress.org

Make WordPress Core

Changeset 38636


Ignore:
Timestamp:
09/20/16 21:38:08 (10 months ago)
Author:
jeremyfelt
Message:

Multisite: Revert [38388].

Restore get_current_site() to a multisite only function. Providing this in single site may be a possibility in the future, but should have a dedicated ticket and discussion.

See #37699.

Location:
trunk/src/wp-includes
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/functions.php

    r38632 r38636  
    43104310 * @since 3.0.0 
    43114311 * 
     4312 * @global object $current_site 
     4313 * 
    43124314 * @param int $site_id Optional. Site ID to test. Defaults to current site. 
    43134315 * @return bool True if $site_id is the main site of the network, or if not 
     
    43154317 */ 
    43164318function is_main_site( $site_id = null ) { 
    4317     if ( ! is_multisite() ) { 
     4319    // This is the current network's information; 'site' is old terminology. 
     4320    global $current_site; 
     4321 
     4322    if ( ! is_multisite() ) 
    43184323        return true; 
    4319     } 
    4320  
    4321     if ( ! $site_id ) { 
     4324 
     4325    if ( ! $site_id ) 
    43224326        $site_id = get_current_blog_id(); 
    4323     } 
    4324     return (int) $site_id === (int) get_current_site()->blog_id; 
     4327 
     4328    return (int) $site_id === (int) $current_site->blog_id; 
    43254329} 
    43264330 
  • trunk/src/wp-includes/link-template.php

    r38611 r38636  
    32583258    $current_site = get_current_site(); 
    32593259 
    3260     if ( 'relative' == $scheme ) { 
     3260    if ( 'relative' == $scheme ) 
    32613261        $url = $current_site->path; 
    3262     } else { 
     3262    else 
    32633263        $url = set_url_scheme( 'http://' . $current_site->domain . $current_site->path, $scheme ); 
    3264     } 
    3265  
    3266     if ( $path && is_string( $path ) ) { 
     3264 
     3265    if ( $path && is_string( $path ) ) 
    32673266        $url .= ltrim( $path, '/' ); 
    3268     } 
    32693267 
    32703268    /** 
     
    33063304        $scheme = is_ssl() && ! is_admin() ? 'https' : 'http'; 
    33073305 
    3308     if ( 'relative' == $scheme ) { 
     3306    if ( 'relative' == $scheme ) 
    33093307        $url = $current_site->path; 
    3310     } else { 
     3308    else 
    33113309        $url = set_url_scheme( 'http://' . $current_site->domain . $current_site->path, $scheme ); 
    3312     } 
    3313  
    3314     if ( $path && is_string( $path ) ) { 
     3310 
     3311    if ( $path && is_string( $path ) ) 
    33153312        $url .= ltrim( $path, '/' ); 
    3316     } 
    33173313 
    33183314    /** 
  • trunk/src/wp-includes/load.php

    r38607 r38636  
    10691069    return ( $thing instanceof WP_Error ); 
    10701070} 
    1071  
    1072 /** 
    1073  * Get the current network. 
    1074  * 
    1075  * Returns an object containing the 'id', 'domain', 'path', and 'site_name' 
    1076  * properties of the network being viewed. 
    1077  * 
    1078  * @see wpmu_current_site() 
    1079  * 
    1080  * @since MU 
    1081  * 
    1082  * @global WP_Network $current_site 
    1083  * 
    1084  * @return WP_Network 
    1085  */ 
    1086 function get_current_site() { 
    1087     global $current_site; 
    1088     return $current_site; 
    1089 } 
  • trunk/src/wp-includes/ms-blogs.php

    r38596 r38636  
    10891089 * @since 4.6.0 
    10901090 * 
     1091 * @global WP_Network $current_site 
     1092 * 
    10911093 * @param WP_Network|int|null $network Optional. Network to retrieve. Default is the current network. 
    10921094 * @return WP_Network|null The network object or null if not found. 
    10931095 */ 
    10941096function get_network( $network = null ) { 
    1095     $current_site = get_current_site(); 
     1097    global $current_site; 
    10961098    if ( empty( $network ) && isset( $current_site ) ) { 
    10971099        $network = $current_site; 
  • trunk/src/wp-includes/ms-functions.php

    r38457 r38636  
    13331333 */ 
    13341334function install_blog( $blog_id, $blog_title = '' ) { 
    1335     global $wpdb, $wp_roles; 
     1335    global $wpdb, $wp_roles, $current_site; 
     1336 
    13361337    // Cast for security 
    13371338    $blog_id = (int) $blog_id; 
     
    13611362            $siteurl = set_url_scheme( $siteurl, 'https' ); 
    13621363        } 
    1363         if ( 'https' === parse_url( get_home_url( get_current_site()->blog_id ), PHP_URL_SCHEME ) ) { 
     1364        if ( 'https' === parse_url( get_home_url( $current_site->blog_id ), PHP_URL_SCHEME ) ) { 
    13641365            $home = set_url_scheme( $home, 'https' ); 
    13651366        } 
     
    14981499    $message = $welcome_email; 
    14991500 
    1500     if ( empty( $current_site->site_name ) ) { 
     1501    if ( empty( $current_site->site_name ) ) 
    15011502        $current_site->site_name = 'WordPress'; 
    1502     } 
    15031503 
    15041504    /** 
     
    15901590    wp_mail( $user->user_email, wp_specialchars_decode( $subject ), $message, $message_headers ); 
    15911591    return true; 
     1592} 
     1593 
     1594/** 
     1595 * Get the current network. 
     1596 * 
     1597 * Returns an object containing the 'id', 'domain', 'path', and 'site_name' 
     1598 * properties of the network being viewed. 
     1599 * 
     1600 * @see wpmu_current_site() 
     1601 * 
     1602 * @since MU 
     1603 * 
     1604 * @global WP_Network $current_site 
     1605 * 
     1606 * @return WP_Network 
     1607 */ 
     1608function get_current_site() { 
     1609    global $current_site; 
     1610    return $current_site; 
    15921611} 
    15931612 
  • trunk/src/wp-includes/option.php

    r38388 r38636  
    10711071 * 
    10721072 * @global wpdb   $wpdb 
     1073 * @global object $current_site 
    10731074 * 
    10741075 * @param int      $network_id ID of the network. Can be null to default to the current network ID. 
     
    10781079 */ 
    10791080function get_network_option( $network_id, $option, $default = false ) { 
    1080     global $wpdb; 
     1081    global $wpdb, $current_site; 
    10811082 
    10821083    if ( $network_id && ! is_numeric( $network_id ) ) { 
     
    10881089    // Fallback to the current network if a network ID is not specified. 
    10891090    if ( ! $network_id && is_multisite() ) { 
    1090         $network_id = get_current_site()->id; 
     1091        $network_id = $current_site->id; 
    10911092    } 
    10921093 
     
    11871188 * 
    11881189 * @global wpdb   $wpdb 
     1190 * @global object $current_site 
    11891191 * 
    11901192 * @param int    $network_id ID of the network. Can be null to default to the current network ID. 
     
    11941196 */ 
    11951197function add_network_option( $network_id, $option, $value ) { 
    1196     global $wpdb; 
     1198    global $wpdb, $current_site; 
    11971199 
    11981200    if ( $network_id && ! is_numeric( $network_id ) ) { 
     
    12041206    // Fallback to the current network if a network ID is not specified. 
    12051207    if ( ! $network_id && is_multisite() ) { 
    1206         $network_id = get_current_site()->id; 
     1208        $network_id = $current_site->id; 
    12071209    } 
    12081210 
     
    12961298 * 
    12971299 * @global wpdb   $wpdb 
     1300 * @global object $current_site 
    12981301 * 
    12991302 * @param int    $network_id ID of the network. Can be null to default to the current network ID. 
     
    13021305 */ 
    13031306function delete_network_option( $network_id, $option ) { 
    1304     global $wpdb; 
     1307    global $wpdb, $current_site; 
    13051308 
    13061309    if ( $network_id && ! is_numeric( $network_id ) ) { 
     
    13121315    // Fallback to the current network if a network ID is not specified. 
    13131316    if ( ! $network_id && is_multisite() ) { 
    1314         $network_id = get_current_site()->id; 
     1317        $network_id = $current_site->id; 
    13151318    } 
    13161319 
     
    13771380 * 
    13781381 * @global wpdb   $wpdb 
     1382 * @global object $current_site 
    13791383 * 
    13801384 * @param int      $network_id ID of the network. Can be null to default to the current network ID. 
     
    13841388 */ 
    13851389function update_network_option( $network_id, $option, $value ) { 
    1386     global $wpdb; 
     1390    global $wpdb, $current_site; 
    13871391 
    13881392    if ( $network_id && ! is_numeric( $network_id ) ) { 
     
    13941398    // Fallback to the current network if a network ID is not specified. 
    13951399    if ( ! $network_id && is_multisite() ) { 
    1396         $network_id = get_current_site()->id; 
     1400        $network_id = $current_site->id; 
    13971401    } 
    13981402 
Note: See TracChangeset for help on using the changeset viewer.