Changeset 53065
- Timestamp:
- 04/05/2022 01:53:59 AM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-query.php
r52990 r53065 2721 2721 $climits = ( ! empty( $climits ) ) ? $climits : ''; 2722 2722 2723 $comments = (array) $wpdb->get_results( "SELECT $distinct {$wpdb->comments}.* FROM {$wpdb->comments} $cjoin $cwhere $cgroupby $corderby $climits" ); 2723 $comments_request = "SELECT $distinct {$wpdb->comments}.comment_ID FROM {$wpdb->comments} $cjoin $cwhere $cgroupby $corderby $climits"; 2724 2725 $key = md5( $comments_request ); 2726 $last_changed = wp_cache_get_last_changed( 'comment' ) . ':' . wp_cache_get_last_changed( 'posts' ); 2727 2728 $cache_key = "comment_feed:$key:$last_changed"; 2729 $comment_ids = wp_cache_get( $cache_key, 'comment' ); 2730 if ( false === $comment_ids ) { 2731 $comment_ids = $wpdb->get_col( $comments_request ); 2732 wp_cache_add( $cache_key, $comment_ids, 'comment' ); 2733 } 2734 _prime_comment_caches( $comment_ids, false ); 2735 2724 2736 // Convert to WP_Comment. 2725 2737 /** @var WP_Comment[] */ 2726 $this->comments = array_map( 'get_comment', $comment s );2738 $this->comments = array_map( 'get_comment', $comment_ids ); 2727 2739 $this->comment_count = count( $this->comments ); 2728 2740 … … 3165 3177 $climits = apply_filters_ref_array( 'comment_feed_limits', array( 'LIMIT ' . get_option( 'posts_per_rss' ), &$this ) ); 3166 3178 3167 $comments_request = "SELECT {$wpdb->comments}.* FROM {$wpdb->comments} $cjoin $cwhere $cgroupby $corderby $climits"; 3168 $comments = $wpdb->get_results( $comments_request ); 3179 $comments_request = "SELECT {$wpdb->comments}.comment_ID FROM {$wpdb->comments} $cjoin $cwhere $cgroupby $corderby $climits"; 3180 3181 $key = md5( $comments_request ); 3182 $last_changed = wp_cache_get_last_changed( 'comment' ); 3183 3184 $cache_key = "comment_feed:$key:$last_changed"; 3185 $comment_ids = wp_cache_get( $cache_key, 'comment' ); 3186 if ( false === $comment_ids ) { 3187 $comment_ids = $wpdb->get_col( $comments_request ); 3188 wp_cache_add( $cache_key, $comment_ids, 'comment' ); 3189 } 3190 _prime_comment_caches( $comment_ids, false ); 3191 3169 3192 // Convert to WP_Comment. 3170 3193 /** @var WP_Comment[] */ 3171 $this->comments = array_map( 'get_comment', $comment s );3194 $this->comments = array_map( 'get_comment', $comment_ids ); 3172 3195 $this->comment_count = count( $this->comments ); 3173 3196 }
Note: See TracChangeset
for help on using the changeset viewer.