You are here

function linkchecker_comment in Link checker 5.2

Same name and namespace in other branches
  1. 6.2 linkchecker.module \linkchecker_comment()

File

./linkchecker.module, line 933
This module periodically check links in given node types, blocks, cck fields, etc.

Code

function linkchecker_comment($comment, $op) {

  // Convert $comment object (admin/content/comment) to array (comment/edit/[cid]).
  $comment = (array) $comment;
  switch ($op) {
    case 'insert':
    case 'update':
    case 'publish':
      $node_type = db_result(db_query("SELECT type FROM {node} WHERE nid = %d", $comment['nid']));

      // Use $comment['status'] to hack around comment_save() not hooking on publish (D5 only).
      if ($comment['status'] == COMMENT_PUBLISHED && _linkchecker_scan_nodetype($node_type)) {
        _linkchecker_add_comment_links($comment);
      }
      elseif ($comment['status'] == COMMENT_NOT_PUBLISHED) {
        _linkchecker_delete_comment_links($comment['cid']);
      }
      break;
    case 'unpublish':
    case 'delete':
      _linkchecker_delete_comment_links($comment['cid']);
      break;
  }
}