The "counts" cache for comments by post id is never invalidated. Neither wp_update_comment_count() nor wp_update_comment_count_now() touch the cache.

Adds unit test.
See #33875.

Built from https://develop.svn.wordpress.org/trunk@34131


git-svn-id: http://core.svn.wordpress.org/trunk@34099 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Scott Taylor 2015-09-14 22:04:26 +00:00
parent 7639a89a1f
commit 60367d567d
2 changed files with 3 additions and 2 deletions

View File

@ -1916,6 +1916,8 @@ function wp_update_comment_count_now($post_id) {
clean_post_cache( $post ); clean_post_cache( $post );
wp_cache_delete( "comments-{$post_id}", 'counts' );
/** /**
* Fires immediately after a post's comment count is updated in the database. * Fires immediately after a post's comment count is updated in the database.
* *
@ -2324,7 +2326,6 @@ function xmlrpc_pingback_error( $ixr_error ) {
function clean_comment_cache($ids) { function clean_comment_cache($ids) {
foreach ( (array) $ids as $id ) { foreach ( (array) $ids as $id ) {
wp_cache_delete( $id, 'comment' ); wp_cache_delete( $id, 'comment' );
wp_cache_delete( "comment-{$id}", 'counts' );
} }
wp_cache_set( 'last_changed', microtime(), 'comment' ); wp_cache_set( 'last_changed', microtime(), 'comment' );

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.4-alpha-34130'; $wp_version = '4.4-alpha-34131';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.