@@ 2629-2638 (lines=10) @@ | ||
2626 | * @param array $comment_ids Array of comment IDs. |
|
2627 | * @param bool $update_meta_cache Optional. Whether to update the meta cache. Default true. |
|
2628 | */ |
|
2629 | function _prime_comment_caches( $comment_ids, $update_meta_cache = true ) { |
|
2630 | global $wpdb; |
|
2631 | ||
2632 | $non_cached_ids = _get_non_cached_ids( $comment_ids, 'comment' ); |
|
2633 | if ( !empty( $non_cached_ids ) ) { |
|
2634 | $fresh_comments = $wpdb->get_results( sprintf( "SELECT $wpdb->comments.* FROM $wpdb->comments WHERE comment_ID IN (%s)", join( ",", array_map( 'intval', $non_cached_ids ) ) ) ); |
|
2635 | ||
2636 | update_comment_cache( $fresh_comments, $update_meta_cache ); |
|
2637 | } |
|
2638 | } |
|
2639 | ||
2640 | // |
|
2641 | // Internal |
@@ 524-533 (lines=10) @@ | ||
521 | * |
|
522 | * @param array $ids ID list. |
|
523 | */ |
|
524 | function _prime_site_caches( $ids ) { |
|
525 | global $wpdb; |
|
526 | ||
527 | $non_cached_ids = _get_non_cached_ids( $ids, 'sites' ); |
|
528 | if ( ! empty( $non_cached_ids ) ) { |
|
529 | $fresh_sites = $wpdb->get_results( sprintf( "SELECT * FROM $wpdb->blogs WHERE blog_id IN (%s)", join( ",", array_map( 'intval', $non_cached_ids ) ) ) ); |
|
530 | ||
531 | update_site_cache( $fresh_sites ); |
|
532 | } |
|
533 | } |
|
534 | ||
535 | /** |
|
536 | * Updates sites in cache. |
|
@@ 1173-1182 (lines=10) @@ | ||
1170 | * |
|
1171 | * @param array $network_ids Array of network IDs. |
|
1172 | */ |
|
1173 | function _prime_network_caches( $network_ids ) { |
|
1174 | global $wpdb; |
|
1175 | ||
1176 | $non_cached_ids = _get_non_cached_ids( $network_ids, 'networks' ); |
|
1177 | if ( !empty( $non_cached_ids ) ) { |
|
1178 | $fresh_networks = $wpdb->get_results( sprintf( "SELECT $wpdb->site.* FROM $wpdb->site WHERE id IN (%s)", join( ",", array_map( 'intval', $non_cached_ids ) ) ) ); |
|
1179 | ||
1180 | update_network_cache( $fresh_networks ); |
|
1181 | } |
|
1182 | } |
|
1183 | ||
1184 | /** |
|
1185 | * Handler for updating the blog date when a post is published or an already published post is changed. |
@@ 6002-6011 (lines=10) @@ | ||
5999 | * @param bool $update_term_cache Optional. Whether to update the term cache. Default true. |
|
6000 | * @param bool $update_meta_cache Optional. Whether to update the meta cache. Default true. |
|
6001 | */ |
|
6002 | function _prime_post_caches( $ids, $update_term_cache = true, $update_meta_cache = true ) { |
|
6003 | global $wpdb; |
|
6004 | ||
6005 | $non_cached_ids = _get_non_cached_ids( $ids, 'posts' ); |
|
6006 | if ( !empty( $non_cached_ids ) ) { |
|
6007 | $fresh_posts = $wpdb->get_results( sprintf( "SELECT $wpdb->posts.* FROM $wpdb->posts WHERE ID IN (%s)", join( ",", $non_cached_ids ) ) ); |
|
6008 | ||
6009 | update_post_caches( $fresh_posts, 'any', $update_term_cache, $update_meta_cache ); |
|
6010 | } |
|
6011 | } |
|
6012 | ||
6013 | /** |
|
6014 | * Adds a suffix if any trashed posts have a given slug. |
@@ 3555-3568 (lines=14) @@ | ||
3552 | * @param array $term_ids Array of term IDs. |
|
3553 | * @param bool $update_meta_cache Optional. Whether to update the meta cache. Default true. |
|
3554 | */ |
|
3555 | function _prime_term_caches( $term_ids, $update_meta_cache = true ) { |
|
3556 | global $wpdb; |
|
3557 | ||
3558 | $non_cached_ids = _get_non_cached_ids( $term_ids, 'terms' ); |
|
3559 | if ( ! empty( $non_cached_ids ) ) { |
|
3560 | $fresh_terms = $wpdb->get_results( sprintf( "SELECT t.*, tt.* FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id WHERE t.term_id IN (%s)", join( ",", array_map( 'intval', $non_cached_ids ) ) ) ); |
|
3561 | ||
3562 | update_term_cache( $fresh_terms, $update_meta_cache ); |
|
3563 | ||
3564 | if ( $update_meta_cache ) { |
|
3565 | update_termmeta_cache( $non_cached_ids ); |
|
3566 | } |
|
3567 | } |
|
3568 | } |
|
3569 | ||
3570 | // |
|
3571 | // Default callbacks |