Changeset 54080 for trunk/src/wp-includes/ms-network.php
- Timestamp:
- 09/06/2022 11:26:45 AM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/ms-network.php
r53944 r54080 85 85 $network_ids = (array) $ids; 86 86 wp_cache_delete_multiple( $network_ids, 'networks' ); 87 wp_cache_delete_multiple( $network_ids, 'site_meta' ); 87 88 88 89 foreach ( $network_ids as $id ) { … … 108 109 * 109 110 * @since 4.6.0 111 * @since 6.1.0 Introduced the `$update_meta_cache` parameter. 110 112 * 111 * @param array $networks Array of network row objects. 113 * @param array $networks Array of network row objects. 114 * @param bool $update_meta_cache Whether to update site meta cache. Default true. 112 115 */ 113 function update_network_cache( $networks ) {116 function update_network_cache( $networks, $update_meta_cache = true ) { 114 117 $data = array(); 115 118 foreach ( (array) $networks as $network ) { 116 119 $data[ $network->id ] = $network; 117 120 } 121 118 122 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 } 119 127 } 120 128 … … 123 131 * 124 132 * @since 4.6.0 133 * @since 6.1.0 Introduced the `$update_meta_cache` parameter. 125 134 * @since 6.1.0 This function is no longer marked as "private". 126 135 * … … 128 137 * @global wpdb $wpdb WordPress database abstraction object. 129 138 * 130 * @param array $network_ids Array of network IDs. 139 * @param array $network_ids Array of network IDs. 140 * @param bool $update_meta_cache Whether to update site meta cache. Default true. 131 141 */ 132 function _prime_network_caches( $network_ids ) {142 function _prime_network_caches( $network_ids, $update_meta_cache = true ) { 133 143 global $wpdb; 134 144 … … 137 147 $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 138 148 139 update_network_cache( $fresh_networks );149 update_network_cache( $fresh_networks, $update_meta_cache ); 140 150 } 141 151 }
Note: See TracChangeset
for help on using the changeset viewer.