You are here

function comment_migrate_complete_comment in Migrate 6

Implementation of hook_migrate_complete_comment().

File

modules/comment.migrate.inc, line 163
Implementation of comment destination handling

Code

function comment_migrate_complete_comment(&$comment, $tblinfo, $row) {
  $errors = array();
  if ($comment['cid']) {

    // comment_save() always saves time() as the timestamp, override if we have a value
    if ($comment['timestamp']) {
      db_query("UPDATE {comments}\n                SET timestamp=%d, uid=%d, hostname='%s'\n                WHERE cid=%d", $comment['timestamp'], $comment['uid'], $comment['hostname'], $comment['cid']);
    }
    $sourcekey = $tblinfo->sourcekey;
    migrate_add_mapping($tblinfo->mcsid, $row->{$sourcekey}, $comment['cid']);
  }
  else {
    $errors[] = migrate_message(t('Comment not saved'));
  }
  return $errors;
}