B2 to WordPress migration script

Update: There is a new version of the script (Version 1.1) that you should be using. Also, please note that this script is for the older b2 weblog engine not b2evolution.

* * *

I'm releasing the PHP script I wrote to migrate my b2 blog engine installation (version 0.6) to WordPress (version 2.0.2) in hopes that it might be useful to any other bloggers who are still stuck with their b2 installations for various reasons.

I decided to write my own script to carry out the migration as the latest WordPress release doesn't contain one and the only other alternative, apparently, would have been to go through a ridiculous series of upgrades (without any guarantees, as I had heavily hacked my b2 installation.) I wasn't interested in keeping my hacks (in fact, no more hacking -- from now on I can create lovely WordPress plugins if I want to add new functionality) but I did want to keep the list of users, posts, categories and comments.

So, without further ado, here's the b2 to WP migration script (b2towp.zip; 19kb).

INSTRUCTIONS

Important: Make sure you have a backup of your b2 database. I recommend that you carry out this procedure on a development box first to make sure you're happy with the results.

  1. Use PHPMyAdmin to export your b2 database into an SQL file.
  2. Install WP 2.0.2
  3. On the machine you installed WP, use PHPMyAdmin to create a database for your b2 database and inport it from the SQL file you created in Step 1.
  4. Open the b2towp.php file in an editor and enter the database connection info for both the b2 and WP databases at the head of the file.
  5. Run the b2towp.php script

That should be it. Remember that this script migrates your users, posts, categories and comments only.

The script is released under CC-GNU GPL.

Creative Commons LicenseThe B2 to WordPress migration script article by Aral Balkan, unless otherwise expressly stated, is licensed under a Creative Commons Attribution-Noncommercial 2.0 UK: England License.

Post Metadata

Date
May 9th, 2006

Author
Aral

Category

Tags


7 Trackbacks & Pingbacks

  1. May 9, 2006 11:04 pm

    Weblog Tools Collection » b2 to WordPress migration script :

  2. May 12, 2006 3:25 pm

    abioo > an intorweb diary » time for the (r)evolution :

  3. May 18, 2006 3:39 pm

    My Intorweb Diary » Blog Archive » time for the (r)evolution :

  4. September 6, 2006 1:52 pm

    b2 to WordPress migration script « Netlex Toolbox :

  5. January 7, 2009 1:56 pm

    复杂的Blog升级之路 :

  6. January 12, 2009 1:46 pm

    复杂的Blog升级之路 | Geng的技术角落@72pines :

  7. March 17, 2009 12:30 am

    New Engine…Temporary Look « darw1n.net :

11 Comments

  1. Does this also work for HUGE databases? I have a WP blog and a B2 archive that I would like to merge..



  2. aral

    Hey Grobbo — not sure how you define “HUGE” :) The export of my FlashAnt database was 2mb uncompressed. The only issue I can think of as to why it wouldn’t work would be a script timeout or memory issue. You can change the former in the PHP settings and probably add more RAM for the latter :)

    Let me know how you get on good luck!


  3. I have been thinking since forever if I should convert my beloved b2 to Wordpress. I have bookmarked your site for now, and I will most likely give in sooner than later, as the spam is unmanagable with b2. What a shame. Thank you for sharing!


  4. Hi Aral,

    I have decided to give it a shot, and converting went smoothly, except for the comments. I get this error:

    Clearing the comments table… failed.
    Inserting comments and updating comment counts in posts table
    Warning: Invalid argument supplied for foreach() in /…blah…/convert/b2towp.php on line 385

    Which would be // Stats, which again doesnt make much sense to me.

    Do you have any suggestions?

    Thank you so much in advance!



  5. Jen

    Worked beautifully. Thank you so very much!



  6. aral

    You’re very welcome — great to hear! :)



  7. jay

    Worked like a fucking charm, I salute you.



  8. aral

  9. this is fantastic! thank you so much for this! ive been looking high and low for a way to import my old stinky b2 database.



  10. Jeff

    Thanks! Just imported from b2 v0.6pre to Wordpress 2.1.3.



  11. aral

    Hi Jeff, roycifer,

    Great news, guys! :)


Leave a Reply

Anti-Spam Protection by WP-SpamFree