Make WordPress Core

Ticket #31081: 31081.diff

File 31081.diff, 2.2 KB (added by dd32, 10 years ago)
  • src/wp-includes/comment.php

     
    771771                        return array_map( 'intval', $this->comments );
    772772                }
    773773
    774774                $results = $wpdb->get_results( $this->request );
    775775                /**
    776776                 * Filter the comment query results.
    777777                 *
    778778                 * @since 3.1.0
    779779                 *
    780780                 * @param array            $results  An array of comments.
    781781                 * @param WP_Comment_Query &$this    Current instance of WP_Comment_Query, passed by reference.
    782782                 */
    783783                $comments = apply_filters_ref_array( 'the_comments', array( $results, &$this ) );
    784784
    785785                wp_cache_add( $cache_key, $comments, 'comment' );
     786                if ( '*' == $fields ) {
     787                        update_comment_cache( $comments );
     788                }
    786789
    787790                return $comments;
    788791        }
    789792
    790793        /**
    791794         * Used internally to generate an SQL string for searching across multiple columns
    792795         *
    793796         * @access protected
    794797         * @since 3.1.0
    795798         *
    796799         * @param string $string
    797800         * @param array $cols
    798801         * @return string
    799802         */
    800803        protected function get_search_sql( $string, $cols ) {
  • src/wp-includes/comment-template.php

     
    11721172        }
    11731173
    11741174        $comments = get_comments( $comment_args );
    11751175
    11761176        /**
    11771177         * Filter the comments array.
    11781178         *
    11791179         * @since 2.1.0
    11801180         *
    11811181         * @param array $comments Array of comments supplied to the comments template.
    11821182         * @param int   $post_ID  Post ID.
    11831183         */
    11841184        $wp_query->comments = apply_filters( 'comments_array', $comments, $post->ID );
    11851185        $comments = &$wp_query->comments;
    11861186        $wp_query->comment_count = count($wp_query->comments);
    1187         update_comment_cache($wp_query->comments);
    11881187
    11891188        if ( $separate_comments ) {
    11901189                $wp_query->comments_by_type = separate_comments($comments);
    11911190                $comments_by_type = &$wp_query->comments_by_type;
    11921191        }
    11931192
    11941193        $overridden_cpage = false;
    11951194        if ( '' == get_query_var('cpage') && get_option('page_comments') ) {
    11961195                set_query_var( 'cpage', 'newest' == get_option('default_comments_page') ? get_comment_pages_count() : 1 );
    11971196                $overridden_cpage = true;
    11981197        }
    11991198
    12001199        if ( !defined('COMMENTS_TEMPLATE') )
    12011200                define('COMMENTS_TEMPLATE', true);
    12021201