Convert postnuke stories and comments to WordPress


Converting Postnuke to WP2 databases!

"; } else { echo "

This is a preview of what is going to happen, to actually convert you'll need to press the button at the very bottom of this page!

"; } ?>

Category Conversions

"; if ($submit && ( $myrow[pn_topicid] > 1 ) ) { mysql_select_db($destdb, $db_connect); mysql_query($sql, $db_connect) or die("Fatal error: ".mysql_error()); } } ?>

Story Conversion

\n'.$mybodytext; #$myhometext = $mybodytext; } $mytitle = mysql_escape_string($myrow['pn_title']); $myname = mysql_escape_string(sanitize($mytitle)); $sql = "INSERT INTO `" . $desttable_prefix . "posts` ( `ID` , `post_author` , `post_date` , `post_date_gmt` , `post_content` , `post_title` , `post_name` , `post_category` , `post_excerpt` , `post_status` , `comment_status` , `ping_status` , `post_password` , `to_ping` , `pinged` , `post_modified` , `post_modified_gmt` , `post_content_filtered` , `post_parent` ) VALUES ( '$myrow[pn_sid]', '1', '$myrow[pn_time]', '0000-00-00 00:00:00', '$myhometext', '$mytitle', '$myname', '$myrow[pn_topic]', '', 'publish', 'open', 'open', '', '', '', '$myrow[pn_time]', '0000-00-00 00:00:00', '', '0' );"; // only really do insert if requested if ($submit) { mysql_select_db($destdb, $db_connect); mysql_query($sql, $db_connect); // now get the ID of the post we just added $sql = "select MAX(ID) from " . $desttable_prefix . "posts"; $getID = mysql_query($sql, $db_connect); $currentID = mysql_fetch_array($getID); $currentID = $currentID['MAX(ID)']; printf("

Just inserted ID %s

\n", $currentID); // add post2cat map... why does he have this table? if ($myrow['pn_topic'] == 0) $topicnum = 1; else $topicnum = $myrow['pn_topic']; $sql = "insert into `" . $desttable_prefix . "post2cat` (`post_id`, `category_id`) VALUES ('$currentID', '$topicnum');"; $result = mysql_query($sql, $db_connect) or die("Fatal error: ".mysql_error()); } // print out source information if ($rownum++ % 2 == 0) printf(""); else printf("\n"); printf(" \n \n \n \n \n \n \n", $myrow["pn_sid"], $myrow["pn_title"], $myrow["pn_time"], $myrow["pn_hometext"], $myrow["pn_bodytext"], $myrow["pn_topic"], $myrow["pn_counter"]); // retreive all associated comments $mysid = $myrow["pn_sid"]; mysql_select_db($sourcedb, $db_connect); $comments = mysql_query("select * from nuke_comments where pn_sid = $mysid", $db_connect); print "\n"; print "\n"; } ?>
pn_sid pn_title pn_time pn_hometext pn_bodytext pn_topic pn_counter comments
%s%s%s%s%s%s%s"; print ""; print ""; print " "; print " "; print " "; print " "; print " "; print " "; print " "; print " "; print " "; print ""; $comrownum = 0; while ($comrow = mysql_fetch_array($comments)) { $myname = mysql_escape_string($comrow['pn_name']); $myemail = mysql_escape_string($comrow['pn_email']); $myurl = mysql_escape_string($comrow['pn_url']); $myIP = mysql_escape_string($comrow['pn_host_name']); $mycomment = mysql_escape_string($comrow['pn_comment']); $sql = "INSERT INTO `" . $desttable_prefix . "comments` ( `comment_ID` , `comment_post_ID` , `comment_author` , `comment_author_email` , `comment_author_url` , `comment_author_IP` , `comment_date` , `comment_date_gmt` , `comment_content` , `comment_karma` , `comment_approved` , `user_id` ) VALUES ( '', '$currentID', '$myname', '$myemail', '$myurl', '$myIP', '$comrow[pn_date]', '0000-00-00 00:00:00', '$mycomment', '0', '1', '0' );"; if ($submit) { mysql_select_db($destdb, $db_connect); mysql_query($sql, $db_connect) or die("Fatal Error: ".mysql_error()); } if ($comrownum++ %2 == 0) print ""; else print ""; printf(" \n", $comrow["pn_tid"], $comrow["pn_sid"], $comrow["pn_date"], $comrow["pn_name"], $comrow["pn_email"], $comrow["pn_url"], $comrow["pn_host_name"], $comrow["pn_subject"], $comrow["pn_comment"]); } print "
pn_tidpn_sidpn_datepn_namepn_emailpn_urlpn_host_namepn_subjectpn_comment
%s %s %s %s %s %s %s %s %s
\n"; print "

Updating Comment Counts

0) { echo "\n"; } } ?>
SIDComment count
$mypostid$commentcount

Updating Category Counts

0) { echo "\n"; } } ?>
CategoryCategory count
$mypostid$commentcount