function migrate_phpbb_topic($pTopicId, &$pRootComment) { global $db; $sql = "SELECT bbp.*, bbpt.* FROM " . POSTS_TABLE . " bbp\n\t\t\t\tINNER JOIN " . POSTS_TEXT_TABLE . " bbpt ON(bbpt.post_id=bbp.post_id) \n\t\t\t\tINNER JOIN " . TOPICS_TABLE . " bbt ON(bbt.topic_id=bbp.topic_id) \n\t\t\tWHERE bbp.topic_id={$pTopicId} AND bbp.post_id != bbt.topic_first_post_id\n\t\t\tORDER BY bbp.post_time "; if (!($result = $db->sql_query($sql))) { message_die(GENERAL_ERROR, "Could not obtain topic/post information.", '', __LINE__, __FILE__, $sql); } while ($row = $db->sql_fetchrow($result)) { print "Migrating Post {$row['post_id']}<br/>\n"; $commentHash = array(); $commentHash['root_id'] = $pRootComment->getField('root_id'); $commentHash['parent_id'] = $pRootComment->getField('content_id'); $commentHash['anon_name'] = $row['post_username']; $commentHash['title'] = $row['post_subject']; $commentHash['edit'] = $row['post_text']; $commentHash['format_guid'] = 'bbcode'; $commentHash['created'] = $row['post_time']; $commentHash['last_modified'] = $row['post_edit_time']; $commentHash['user_id'] = $row['poster_id']; $commentHash['modifier_user_id'] = $row['poster_id']; $commentHash['ip'] = decode_ip($row['poster_ip']); $newComment = new LibertyComment(); if ($newComment->storeComment($commentHash)) { $postHash['migrate_post_id'] = $row['post_id']; $newPost = new BitBoardPost($newComment->mCommentId); $newPost->store($postHash); } else { vd($row); vd($commentHash); vd($newComment->mErrors); die; } } }