#22024 closed defect (bug) (fixed)
The query cache in WP_Comment_Query:query() is not invalidated when comments are added
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 3.5 | Priority: | normal |
Severity: | normal | Version: | 3.4.2 |
Component: | Comments | Keywords: | |
Focuses: | Cc: |
Description
last_changed is updated in clean_comment_cache(). clean_comment_cache() is not called from wp_insert_comment().
Tests_Comment_Query::test_get_comments_for_post() triggers the problem.
Attachments (2)
Change History (14)
#3
@
11 years ago
- Owner set to ryan
- Resolution set to fixed
- Status changed from new to closed
In [22080]:
#5
@
11 years ago
- Resolution fixed deleted
- Status changed from closed to reopened
On one site, this change is causing the following error when anyone leaves a comment:
Fatal error: Call to undefined function wp_cache_incr() in /home/ipstenu/public_html/wp-includes/comment.php on line 1293
I also can reproduce the error when trying to bulk-move comments.
Fatal error: Call to undefined function wp_cache_incr() in /home/ipstenu/public_html/wp-includes/comment.php on line 1967
I svn'd up, but I cannot reproduce this on more than one site (multisite). All sites on the network, regardless of plugins, have that error.
#6
@
11 years ago
You are using an object-cache.php drop-in that doesn't support wp_cache_incr() and wp_cache_decr(), added in 3.3.
Sadly, we'll probably need to avoid these functions in core for the time being, or begin to offer fallbacks (for when a drop-in doesn't add them) that in this case would call get() then set().
#7
follow-up:
↓ 8
@
11 years ago
In 3.5 we added wp_cache_switch_to_blog()
and use it, so offering fallbacks should be the right way.
#8
in reply to:
↑ 7
;
follow-up:
↓ 11
@
11 years ago
Replying to ocean90:
In 3.5 we added
wp_cache_switch_to_blog()
and use it, so offering fallbacks should be the right way.
Well, two different things. That's a limited-use method that does a function_exists() check, and if it doesn't exist, we do a decent amount of code. incr() and decr() are "nice-to-haves" that at worst can be replaced with a get() and set(). I'll let ryan determine what he wants to do here.
#9
follow-up:
↓ 12
@
11 years ago
First, which object cache backend is being used? It should be updated.
I guess we can add some function_exists action.
#11
in reply to:
↑ 8
@
11 years ago
Replying to nacin:
Well, two different things. That's a limited-use method that does a function_exists() check, and if it doesn't exist, we do a decent amount of code. incr() and decr() are "nice-to-haves" that at worst can be replaced with a get() and set(). I'll let ryan determine what he wants to do here.
Yeah, you are right. It was too late yesterday.
last_changed could be changed to a wp_cache_incr() counter.