WordPress.org

Make WordPress Core

Ticket #33900: 33900.3.patch

File 33900.3.patch, 2.6 KB (added by flixos90, 3 years ago)
  • src/wp-includes/functions.php

     
    42204220 *
    42214221 * @since 4.3.0
    42224222 *
    4223  * @global wpdb $wpdb WordPress database abstraction object.
     4223 * @global wpdb   $wpdb WordPress database abstraction object.
     4224 * @global object $current_site
    42244225 *
    42254226 * @return int The ID of the main network.
    42264227 */
    42274228function get_main_network_id() {
    4228         global $wpdb;
     4229        global $wpdb, $current_site;
    42294230
    42304231        if ( ! is_multisite() ) {
    42314232                return 1;
     
    42334234
    42344235        if ( defined( 'PRIMARY_NETWORK_ID' ) ) {
    42354236                $main_network_id = PRIMARY_NETWORK_ID;
    4236         } elseif ( 1 === (int) get_current_site()->id ) {
     4237        } elseif ( $current_site instanceof WP_Network && 1 === (int) $current_site->id ) {
    42374238                // If the current network has an ID of 1, assume it is the main network.
    42384239                $main_network_id = 1;
    42394240        } else {
  • src/wp-includes/load.php

     
    183183        // If the $upgrading timestamp is older than 10 minutes, don't die.
    184184        if ( ( time() - $upgrading ) >= 600 )
    185185                return;
    186        
     186
    187187        /**
    188188         * Bypass the maintenance mode check
    189189         *
    190190         * This filter should *NOT* be used by plugins. It is designed for non-web
    191          * runtimes. If this filter returns true, maintenance mode will not be 
     191         * runtimes. If this filter returns true, maintenance mode will not be
    192192         * active which can cause problems during updates for web site views.
    193193         *
    194194         * @since 4.6.0
     
    196196         * @param bool True to bypass maintenance
    197197         */
    198198        if ( apply_filters( 'bypass_maintenance_mode', false ) ){
    199                 return; 
     199                return;
    200200        }
    201201
    202202        if ( file_exists( WP_CONTENT_DIR . '/maintenance.php' ) ) {
     
    310310         *
    311311         * @since 4.6.0
    312312         *
    313          * @param bool True to bypass debug mode 
     313         * @param bool True to bypass debug mode
    314314         */
    315315        if ( apply_filters( 'bypass_debug_mode', false ) ){
    316                 return; 
     316                return;
    317317        }
    318318
    319319        if ( WP_DEBUG ) {
     
    808808}
    809809
    810810/**
     811 * Retrieve the current network ID.
     812 *
     813 * @since 4.6.0
     814 *
     815 * @global object $current_site
     816 *
     817 * @return int Network id
     818 */
     819function get_current_network_id() {
     820        global $current_site;
     821
     822        if ( ! is_multisite() ) {
     823                return 1;
     824        }
     825
     826        if ( ! $current_site instanceof WP_Network ) {
     827                return get_main_network_id();
     828        }
     829
     830        return absint( $current_site->id );
     831}
     832
     833/**
    811834 * Attempt an early load of translations.
    812835 *
    813836 * Used for errors encountered during the initial loading process, before