Skip to content

Instantly share code, notes, and snippets.

@guoxiangke
Created March 6, 2014 06:59
Show Gist options
  • Save guoxiangke/9383865 to your computer and use it in GitHub Desktop.
Save guoxiangke/9383865 to your computer and use it in GitHub Desktop.
<?php
//drupal7 迁移评论 某个节点的
//dpm(comment_load(381));
$comments = array();
for($i=0;$i<500;$i++) {
$comment = comment_load($i);
if($comment && $comment->nid == '3') {
$comment->nid = '486';
$comment->node_type = 'comment_node_page';
unset($comment->rdf_data);
unset($comment->mapping);
unset($comment->rdf_mapping);
unset($comment->signature);
unset($comment->signature_format);
unset($comment->picture);
unset($comment->u_uid);
unset($comment->registered_name);
unset($comment->homepage);
unset($comment->new);
unset($comment->homepage);
$comments[] = $comment;
}
}
dpm($comments);
/////////////////
foreach($comments as $key=>$comment) {
comment_save($comment);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment