@@ 2810-2819 (lines=10) @@ | ||
2807 | * @param array $comment_ids Array of comment IDs. |
|
2808 | * @param bool $update_meta_cache Optional. Whether to update the meta cache. Default true. |
|
2809 | */ |
|
2810 | function _prime_comment_caches( $comment_ids, $update_meta_cache = true ) { |
|
2811 | global $wpdb; |
|
2812 | ||
2813 | $non_cached_ids = _get_non_cached_ids( $comment_ids, 'comment' ); |
|
2814 | if ( !empty( $non_cached_ids ) ) { |
|
2815 | $fresh_comments = $wpdb->get_results( sprintf( "SELECT $wpdb->comments.* FROM $wpdb->comments WHERE comment_ID IN (%s)", join( ",", array_map( 'intval', $non_cached_ids ) ) ) ); |
|
2816 | ||
2817 | update_comment_cache( $fresh_comments, $update_meta_cache ); |
|
2818 | } |
|
2819 | } |
|
2820 | ||
2821 | // |
|
2822 | // Internal |
@@ 551-560 (lines=10) @@ | ||
548 | * |
|
549 | * @param array $ids ID list. |
|
550 | */ |
|
551 | function _prime_site_caches( $ids ) { |
|
552 | global $wpdb; |
|
553 | ||
554 | $non_cached_ids = _get_non_cached_ids( $ids, 'sites' ); |
|
555 | if ( ! empty( $non_cached_ids ) ) { |
|
556 | $fresh_sites = $wpdb->get_results( sprintf( "SELECT * FROM $wpdb->blogs WHERE blog_id IN (%s)", join( ",", array_map( 'intval', $non_cached_ids ) ) ) ); |
|
557 | ||
558 | update_site_cache( $fresh_sites ); |
|
559 | } |
|
560 | } |
|
561 | ||
562 | /** |
|
563 | * Updates sites in cache. |
|
@@ 1215-1224 (lines=10) @@ | ||
1212 | * |
|
1213 | * @param array $network_ids Array of network IDs. |
|
1214 | */ |
|
1215 | function _prime_network_caches( $network_ids ) { |
|
1216 | global $wpdb; |
|
1217 | ||
1218 | $non_cached_ids = _get_non_cached_ids( $network_ids, 'networks' ); |
|
1219 | if ( !empty( $non_cached_ids ) ) { |
|
1220 | $fresh_networks = $wpdb->get_results( sprintf( "SELECT $wpdb->site.* FROM $wpdb->site WHERE id IN (%s)", join( ",", array_map( 'intval', $non_cached_ids ) ) ) ); |
|
1221 | ||
1222 | update_network_cache( $fresh_networks ); |
|
1223 | } |
|
1224 | } |
|
1225 | ||
1226 | /** |
|
1227 | * Handler for updating the blog date when a post is published or an already published post is changed. |
@@ 6129-6138 (lines=10) @@ | ||
6126 | * @param bool $update_term_cache Optional. Whether to update the term cache. Default true. |
|
6127 | * @param bool $update_meta_cache Optional. Whether to update the meta cache. Default true. |
|
6128 | */ |
|
6129 | function _prime_post_caches( $ids, $update_term_cache = true, $update_meta_cache = true ) { |
|
6130 | global $wpdb; |
|
6131 | ||
6132 | $non_cached_ids = _get_non_cached_ids( $ids, 'posts' ); |
|
6133 | if ( !empty( $non_cached_ids ) ) { |
|
6134 | $fresh_posts = $wpdb->get_results( sprintf( "SELECT $wpdb->posts.* FROM $wpdb->posts WHERE ID IN (%s)", join( ",", $non_cached_ids ) ) ); |
|
6135 | ||
6136 | update_post_caches( $fresh_posts, 'any', $update_term_cache, $update_meta_cache ); |
|
6137 | } |
|
6138 | } |
|
6139 | ||
6140 | /** |
|
6141 | * Adds a suffix if any trashed posts have a given slug. |
@@ 3346-3359 (lines=14) @@ | ||
3343 | * @param array $term_ids Array of term IDs. |
|
3344 | * @param bool $update_meta_cache Optional. Whether to update the meta cache. Default true. |
|
3345 | */ |
|
3346 | function _prime_term_caches( $term_ids, $update_meta_cache = true ) { |
|
3347 | global $wpdb; |
|
3348 | ||
3349 | $non_cached_ids = _get_non_cached_ids( $term_ids, 'terms' ); |
|
3350 | if ( ! empty( $non_cached_ids ) ) { |
|
3351 | $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 ) ) ) ); |
|
3352 | ||
3353 | update_term_cache( $fresh_terms, $update_meta_cache ); |
|
3354 | ||
3355 | if ( $update_meta_cache ) { |
|
3356 | update_termmeta_cache( $non_cached_ids ); |
|
3357 | } |
|
3358 | } |
|
3359 | } |
|
3360 | ||
3361 | // |
|
3362 | // Default callbacks |