Ticket #4387 (closed defect: fixed)

Opened 2 years ago

Last modified 1 year ago

get_comment is not cached

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

Description

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

Attachments

comment.patch (0.7 kB) - added by hovenko on 06/01/07 08:18:38.
Fixes a typo in comments cache
comment.02.patch (1.7 kB) - added by hovenko on 06/01/07 12:09:33.
This patch will clear the cache when comments gets deleted or updated
comment.03.patch (0.9 kB) - added by hovenko on 06/01/07 12:29:39.
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 (0.8 kB) - added by hovenko on 06/02/07 02:03:40.
The action wp_set_comment_status will now only be called on when the status has changed

Change History

06/01/07 08:18:38 changed by hovenko

  • attachment comment.patch added.

Fixes a typo in comments cache

06/01/07 08:19:07 changed by hovenko

  • version set to 2.2.

06/01/07 12:09:33 changed by hovenko

  • attachment comment.02.patch added.

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

06/01/07 12:29:39 changed by hovenko

  • attachment comment.03.patch added.

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

(follow-up: ↓ 6 ) 06/01/07 12:49:30 changed by 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 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?

06/01/07 14:43:45 changed by foolswisdom

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

06/01/07 14:46:39 changed by Nazgul

  • keywords set to has-patch.

06/01/07 21:58:55 changed by markjaquith

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

(in reply to: ↑ 2 ) 06/02/07 01:56:16 changed by hovenko

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".

06/02/07 02:03:40 changed by hovenko

  • attachment comment.04.patch added.

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

06/07/07 18:21:18 changed by ryan

  • owner changed from anonymous to ryan.

06/08/07 00:20:22 changed by ryan

  • status changed from new to closed.
  • resolution set to fixed.

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

06/08/07 06:56:35 changed by ryan

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