Make WordPress Core


Ignore:
Timestamp:
10/18/2022 06:14:01 PM (2 years ago)
Author:
davidbaumwald
Message:

Networks and Sites: Revert the use of the metadata API for *_network_options functions.

[54080] refactored the logic in get_network_option(), update_network_option() and delete_network_option() to use the metadata API. However, this change resulted in issues with large multisite installs that utilize memcached having network options > 1MB in size.

This change reverts [54080] and all related follow-up changes.

Reverts [54080], [54081], and [54082]. Partially reverts [54267] and [54402].

Props pavelschoffer, rebasaurus, johnbillion, spacedmonkey, desrosj, rinatkhaziev.
Fixes #56845.
See #37181.

File:
1 edited

Legend:

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

    r54080 r54637  
    8585    $network_ids = (array) $ids;
    8686    wp_cache_delete_multiple( $network_ids, 'networks' );
    87     wp_cache_delete_multiple( $network_ids, 'site_meta' );
    8887
    8988    foreach ( $network_ids as $id ) {
     
    109108 *
    110109 * @since 4.6.0
    111  * @since 6.1.0 Introduced the `$update_meta_cache` parameter.
    112110 *
    113  * @param array $networks          Array of network row objects.
    114  * @param bool  $update_meta_cache Whether to update site meta cache. Default true.
     111 * @param array $networks Array of network row objects.
    115112 */
    116 function update_network_cache( $networks, $update_meta_cache = true ) {
     113function update_network_cache( $networks ) {
    117114    $data = array();
    118115    foreach ( (array) $networks as $network ) {
    119116        $data[ $network->id ] = $network;
    120117    }
    121 
    122118    wp_cache_add_multiple( $data, 'networks' );
    123     if ( $update_meta_cache ) {
    124         $network_ids = array_keys( $data );
    125         update_meta_cache( 'site', $network_ids );
    126     }
    127119}
    128120
     
    131123 *
    132124 * @since 4.6.0
    133  * @since 6.1.0 Introduced the `$update_meta_cache` parameter.
    134125 * @since 6.1.0 This function is no longer marked as "private".
    135126 *
     
    137128 * @global wpdb $wpdb WordPress database abstraction object.
    138129 *
    139  * @param array $network_ids       Array of network IDs.
    140  * @param bool  $update_meta_cache Whether to update site meta cache. Default true.
     130 * @param array $network_ids Array of network IDs.
    141131 */
    142 function _prime_network_caches( $network_ids, $update_meta_cache = true ) {
     132function _prime_network_caches( $network_ids ) {
    143133    global $wpdb;
    144134
     
    147137        $fresh_networks = $wpdb->get_results( sprintf( "SELECT $wpdb->site.* FROM $wpdb->site WHERE id IN (%s)", implode( ',', array_map( 'intval', $non_cached_ids ) ) ) ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
    148138
    149         update_network_cache( $fresh_networks, $update_meta_cache );
     139        update_network_cache( $fresh_networks );
    150140    }
    151141}
Note: See TracChangeset for help on using the changeset viewer.