- b2evolution CMS Support Forums
- b2evolution Support
- General Support
- Moving from wordpress
1 dobroslav Aug 30, 2010 20:16
My b2evolution Version: 3.3.3. stable
My wordpress blog just stopped working, and I decided to change the cms and i chose b2evolution.
I want to import all my posts from wordpress to b2evolution. I have sql databases of both systems.
how to do it?
I found script on the net, here it is, but i don't know how to use it...
sub usage
{
printf( "Usage: DBConvert.pl <WP-File> <Out File>" );
exit 1;
}
if( 2 != scalar(@ARGV) )
{
usage();
}
my $inputFile = shift(@ARGV);
my $outputFile = shift(@ARGV);
open INFILE, $inputFile or die( "Could not open $inputFile" );
open OUTFILE, ">$outputFile" or die( "Could not open $outputFile" );
my $counter = 0;
while( <INFILE> )
{
my $line = $_;
my @feilds = split(/\^/, $line);
$counter ++;
my $wpPostDate = $feilds[3];
my $wpPostContent = $feilds[4];
my $wpPostTitle = $feilds[5];
my $wpPostExcerpt = $feilds[7];
my $wpPostName = $feilds[12];
my $wpPostModified = $feilds[15];
printf( "%d) Size of array is %d\n", $counter, scalar(@feilds) );
my $wpWordCount = 0;
foreach my $word( split(' ', $wpPostContent ) )
{
$wpWordCount++;
}
my $postParentId = "NULL";
my $postCreatorUserId = 5;
my $postLasEditUserId = 5;
my $postAssignedUserId = "NULL";
my $postDateStart = $wpPostDate;
my $postDateDeadline = "NULL";
my $postDateCreated = $wpPostDate;
my $postDateModified = $wpPostModified;
my $postStatus = "'protected'";
my $postPstId = "NULL";
my $postPtypId = 1;
my $postLocal = "'en-US-utf8'";
my $postContent = $wpPostContent;
my $postExcerpt = $wpPostExcerpt;
my $postTitle = $wpPostTitle;
my $postUrlTitle =$wpPostName;
my $postTitleTag = "''";
my $postMetaDesc = "''";
my $postMetaKeywords = "''";
my $postUrl = "''";
my $postMainCatId = 15;
my $postNotificationStatus = "'noreq'";
my $postNotificationCtskId = "NULL";
my $postViews = 0;
my $postWordCount = $wpWordCount;
my $postCommentStatus = "'open'";
my $postCommentsExpire = "NULL";
my $postRenderers = "'b2evALnk.evo_videoplug'";
my $postPriority = 3;
my $postFeatured = 0;
my $postOrder ="NULL";
my $postDouble1 ="NULL";
my $postDouble2 ="NULL";
my $postDouble3 ="NULL";
my $postDouble4 ="NULL";
my $postDouble5 ="NULL";
my $postVarChar1 ="NULL";
my $postVarChar2 ="NULL";
my $postVarChar3 ="NULL";
my $postEditorCode = "NULL";
printf( OUTFILE "(%s, %d, %d, %s, %s, %s, %s, %s, %s, %s, %d, %s, %s, %s,%s, %s, %s, %s, %s, %s, %d, %s, %s, %d, %d, %s, %s, %s, %d, %d, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s ),\n",
$postParentId,
$postCreatorUserId,
$postLasEditUserId,
$postAssignedUserId,
$postDateStart,
$postDateDeadline,
$postDateCreated,
$postDateModified,
$postStatus,
$postPstId,
$postPtypId,
$postLocal,
$postContent,
$postExcerpt,
$postTitle,
$postUrlTitle,
$postTitleTag,
$postMetaDesc,
$postMetaKeywords,
$postUrl,
$postMainCatId,
$postNotificationStatus,
$postNotificationCtskId,
$postViews,
$postWordCount,
$postCommentStatus,
$postCommentsExpire,
$postRenderers,
$postPriority,
$postFeatured,
$postOrder,
$postDouble1,
$postDouble2,
$postDouble3,
$postDouble4,
$postDouble5,
$postVarChar1,
$postVarChar2,
$postVarChar3,
$postEditorCode );
}
close INFILE;
close OUTFILE;
You don't need to do that. Login to the backend of b2evo, go to Tools -> Misc -> Wordpress importer. Follow the instructions from there.