Changeset 37477 for trunk/src/wp-includes/ms-blogs.php
- Timestamp:
- 05/20/2016 10:03:52 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/ms-blogs.php
r37468 r37477 521 521 522 522 /** 523 * Adds any sites from the given ids to the cache that do not already exist in cache. 524 * 525 * @since 4.6.0 526 * @access private 527 * 528 * @see update_site_cache() 529 * 530 * @global wpdb $wpdb WordPress database abstraction object. 531 * 532 * @param array $ids ID list. 533 */ 534 function _prime_site_caches( $ids ) { 535 global $wpdb; 536 537 $non_cached_ids = _get_non_cached_ids( $ids, 'sites' ); 538 if ( ! empty( $non_cached_ids ) ) { 539 $fresh_sites = $wpdb->get_results( sprintf( "SELECT * FROM $wpdb->blogs WHERE blog_id IN (%s)", join( ",", array_map( 'intval', $non_cached_ids ) ) ) ); 540 541 update_site_cache( $fresh_sites ); 542 } 543 } 544 545 /** 546 * Updates sites in cache. 547 * 548 * @since 4.6.0 549 * 550 * @param array $sites Array of site objects, passed by reference. 551 */ 552 function update_site_cache( &$sites ) { 553 if ( ! $sites ) { 554 return; 555 } 556 557 foreach ( $sites as $site ) { 558 wp_cache_add( $site->blog_id, $site, 'sites' ); 559 wp_cache_add( $site->blog_id . 'short', $site, 'blog-details' ); 560 } 561 } 562 563 /** 523 564 * Retrieve option value for a given blog id based on name of option. 524 565 *
Note: See TracChangeset
for help on using the changeset viewer.