Publishes a comment.
Drupal\comment\Comment $comment: (optional) A comment object to publish.
array $context: Array with components:
function comment_publish_action(Comment $comment = NULL, $context = array()) {
if (isset($comment->subject)) {
$subject = $comment->subject;
$comment->status = COMMENT_PUBLISHED;
}
else {
$cid = $context['cid'];
$subject = db_query('SELECT subject FROM {comment} WHERE cid = :cid', array(
':cid' => $cid,
))
->fetchField();
db_update('comment')
->fields(array(
'status' => COMMENT_PUBLISHED,
))
->condition('cid', $cid)
->execute();
}
watchdog('action', 'Published comment %subject.', array(
'%subject' => $subject,
));
}