Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
If a comment is added to a node, a new record is automatically inserted in the comment_notify table (so far it's all OK). However if the comment is deleted, the record from comment_notify is not removed. I suspect that these records are of no further use, thus they could be deleted.
Adding a "delete" handler to the end of the comment_notify_comment() hook implementation could do this:
function comment_notify_comment($comment, $op) {
// (...)
switch ($op) {
// (...)
// add this to the end
case 'delete':
$sql = 'DELETE FROM {comment_notify} WHERE cid = %d';
db_query($sql, $comment->cid);
break;
}
}
Comment | File | Size | Author |
---|---|---|---|
#1 | 297791_5x_comment_notify_handle_deletion.patch | 1.72 KB | greggles |
#1 | 297791_6x_comment_notify_handle_deletion.patch | 1.62 KB | greggles |
Comments
Comment #1
gregglesGreat point.
We should also sync it up in an update function.
Can you test out this patch?
Comment #2
gregglesThis is now fixed.
Thanks for the report müzso!
Comment #3
Anonymous (not verified) CreditAttribution: Anonymous commentedAutomatically closed -- issue fixed for two weeks with no activity.