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;
  }
} 
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

greggles’s picture

Priority: Minor » Normal
Status: Active » Needs review
FileSize
1.62 KB
1.72 KB

Great point.

We should also sync it up in an update function.

Can you test out this patch?

greggles’s picture

Status: Needs review » Fixed

This is now fixed.

Thanks for the report müzso!

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.