Make WordPress Core


Ignore:
Timestamp:
09/20/2022 02:24:08 PM (3 years ago)
Author:
spacedmonkey
Message:

Networks and Sites: Store main site id of a network in network options.

Instead of caching main site id an object cache, store main site id on a network options. This results in less database queries on sites without persistent object caching.

Props spacedmonkey, johnjamesjacoby, peterwilsoncc, desrosj.
Fixes #55802.

File:
1 edited

Legend:

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

    r54240 r54256  
    10691069        update_user_meta( $site_user->ID, 'primary_blog', $current_site->blog_id );
    10701070
     1071        // Unable to use update_network_option() while populating the network.
     1072        $wpdb->insert(
     1073            $wpdb->sitemeta,
     1074            array(
     1075                'site_id'    => $network_id,
     1076                'meta_key'   => 'main_site',
     1077                'meta_value' => $current_site->blog_id,
     1078            )
     1079        );
     1080
    10711081        if ( $subdomain_install ) {
    10721082            $wp_rewrite->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' );
Note: See TracChangeset for help on using the changeset viewer.