WordPress.org

Make WordPress Core

Opened 14 years ago

Closed 14 years ago

Last modified 14 years ago

#4387 closed defect (bug) (fixed)

get_comment is not cached

Reported by: hovenko Owned by: ryan
Milestone: 2.3 Priority: high
Severity: normal Version: 2.2
Component: General Keywords: has-patch
Focuses: Cc:

Description

Comments retrieved with get_comment(..) is not cached because the comment id used in the cache is allways a NULL value.

Attachments (4)

comment.patch (712 bytes) - added by hovenko 14 years ago.
Fixes a typo in comments cache
comment.02.patch (1.7 KB) - added by hovenko 14 years ago.
This patch will clear the cache when comments gets deleted or updated
comment.03.patch (947 bytes) - added by hovenko 14 years ago.
Fix: previous patch cleared the cache too late. Fix: edit_comments function can also update the comment status, so it should call on the action wp_set_comment_status
comment.04.patch (857 bytes) - added by hovenko 14 years ago.
The action wp_set_comment_status will now only be called on when the status has changed

Download all attachments as: .zip

Change History (13)

@hovenko
14 years ago

Fixes a typo in comments cache

#1 @hovenko
14 years ago

  • Version set to 2.2

@hovenko
14 years ago

This patch will clear the cache when comments gets deleted or updated

@hovenko
14 years ago

Fix: previous patch cleared the cache too late. Fix: edit_comments function can also update the comment status, so it should call on the action wp_set_comment_status

#2 follow-up: @hovenko
14 years ago

The last patch will also call on the action hook "wp_set_comment_status" after
updating the comment with the function edit_comment, since that function
might update the comment status as well.

The reason for this was because the wp-admin/moderation.php will call on the
hook "wp_set_comment_status", but when editing comments from
wp-admin/comment.php it will call on the hook "edit_comment". Where's the
logic?

#3 @foolswisdom
14 years ago

  • Summary changed from Typo in comments cache to get_comment is not cached

#4 @Nazgul
14 years ago

  • Keywords has-patch added

#5 @markjaquith
14 years ago

wp_set_comment_status should only be triggered if the comment status actually changes.

#6 in reply to: ↑ 2 @hovenko
14 years ago

Replying to hovenko:

The last patch will also call on the action hook "wp_set_comment_status" after
updating the comment with the function edit_comment, since that function
might update the comment status as well.

The functions name is of course "wp_update_comment", not "edit_comment".

@hovenko
14 years ago

The action wp_set_comment_status will now only be called on when the status has changed

#7 @ryan
14 years ago

  • Owner changed from anonymous to ryan

#8 @ryan
14 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [5666]) Comment caching. Reduce queries on edit-comments.php page. Add non-persistent cache groups. Hat tip to hovenko. fixes #4387

#9 @ryan
14 years ago

(In [5667]) More comment caching. see #4387

Note: See TracTickets for help on using tickets.