You are here

function spam_update_5303 in Spam 5.3

Mark spam comments as SPAM_COMMENT instead of COMMENT_NOT_PUBLISHED.

File

./spam.install, line 446

Code

function spam_update_5303() {

  // Update contontained in _5300 if updating from 5.x-1.x spam module.
  if (spam_skip_update()) {
    return array();
  }
  $ret = array();
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
    default:
      $result = db_query("SELECT cid FROM {comments} c INNER JOIN {spam_tracker} t ON c.cid = t.content_id wHERE t.content_type = 'comment' AND c.status = %d AND t.score >= %d", COMMENT_NOT_PUBLISHED, variable_get('spam_threshold', SPAM_DEFAULT_THRESHOLD));
      while ($comment = db_fetch_object($result)) {
        $ret[] = update_sql('UPDATE {comments} SET status = ' . SPAM_COMMENT . " WHERE cid = {$comment->cid}");
      }
      break;
  }
  return $ret;
}