","",$post_content);
$post_content = str_replace("","
",$post_content);
*/
$post_name = $ID;
// 데이터베이스에 저장
if (!$pID[$ID] = $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_title = '$post_title' AND post_date = '$post_date'")) {
$wpdb->query("INSERT INTO $wpdb->posts
(post_author,post_date,post_date_gmt,post_content,post_title,post_status,comment_status,ping_status,post_modified,post_modified_gmt, post_name)
VALUES ('$post_author','$post_date','$post_date_gmt','$post_content','$post_title','$post_status','$comment_status','$ping_status','$post_modified','$post_modified_gmt', '$post_name')");
$pID[$ID] = $wpdb->get_var("SELECT ID FROM $wpdb->posts ORDER BY ID desc LIMIT 1");
$category1 = $post['category1'];
$category2 = $post['category2'];
if ($category2 > 0) {
$category = $c2ID[$category2];
} else {
$category = $cID[$category1];
}
if ( !$category )
$category = $unknown_cat1;
$wpdb->query("INSERT INTO $wpdb->post2cat
(post_id,category_id)
VALUES ($pID[$ID],$category)");
}
}
// 답글 옮기기
$tt_comment = mysql_query("SELECT * FROM $tt_comment_table ORDER BY no;");
while($comment = mysql_fetch_array($tt_comment,MYSQL_ASSOC)) {
$comment_post_ID = $pID[$comment["pno"]];
$comment_author = addslashes($comment["name"]);
$comment_author_url = $comment["homepage"];
$comment_author_IP = $comment["ip"];
$comment_date = date("Y-m-d H:i:s", $comment["regdate"]);
$comment_date_gmt = get_gmt_from_date($comment_date);
$comment_content = $comment["body"];
// UTF-8로 바꾸기
$comment_author = iconv("EUC-KR","UTF-8",$comment_author);
$comment_content = iconv("EUC-KR","UTF-8",$comment_content);
if(!$wpdb->get_var("SELECT comment_ID FROM $wpdb->comments WHERE comment_author = '$comment_author' AND comment_content = '$comment_content'") && $comment_post_ID) {
$wpdb->query("INSERT INTO $wpdb->comments
(comment_post_ID, comment_author, comment_author_url, comment_author_IP, comment_date, comment_date_gmt, comment_content)
VALUES ($comment_post_ID, '$comment_author', '$comment_author_url', '$comment_author_IP', '$comment_date', '$comment_date_gmt', '$comment_content')");
}
}
// 트랙백 옮기기
$tt_trackback = mysql_query("SELECT * FROM $tt_trackback_table ORDER BY no");
while($trackback = mysql_fetch_array($tt_trackback,MYSQL_ASSOC)) {
$comment_post_ID = $pID[$trackback["pno"]];
$comment_author = addslashes($trackback["site"]);
$comment_author_url = $trackback["url"];
$comment_author_IP = $trackback["ip"];
$comment_date = date("Y-m-d H:i:s",$trackback["regdate"]);
$comment_date_gmt = get_gmt_from_date($comment_date);
$comment_content = addslashes($trackback["body"]);
$comment_type = "trackback";
// UTF-8로 바꾸기
$comment_author = iconv("EUC-KR","UTF-8",$comment_author);
$comment_content = iconv("EUC-KR","UTF-8",$comment_content);
$comment_content = str_replace(""","\"",$comment_content);
if(!$wpdb->get_var("SELECT comment_ID FROM $wpdb->comments WHERE comment_author = '$comment_author' AND comment_content = '$comment_content'") && $comment_post_ID) {
$wpdb->query("INSERT INTO $wpdb->comments
(comment_post_ID, comment_author, comment_author_url, comment_author_IP, comment_date, comment_date_gmt, comment_content, comment_type)
VALUES ($comment_post_ID, '$comment_author', '$comment_author_url', '$comment_author_IP', '$comment_date', '$comment_date_gmt', '$comment_content','$comment_type')");
}
}
upgrade_all();
echo "
작업 완료";
?>