Convalesco

Growing stronger every day!

Archive for the ‘wordpress’ tag

Flying from Mephisto to Wordpress

with one comment

Mephisto is a blogging engine based on “ruby on rails”. Supports a few things and lacks a dose of thousands of plugins and features compared to Wordpress, not to mention that there is “ease of use” as long as you are HTML-savvy. I chose Mephisto because of user comments and because ROR is generally a better choice than PHP. But these two blogging systems are in no way comparable. The fact is that mephisto’s user database is so small that wordpress developers have not add “import” support for Mephisto. It makes sense to me.

I’m using Dreamhost for hosting my websites so, what I needed to do, was move my database from a Mephisto-style to something that Wordpress can read. The solution came from a script and some MySQL extra tweaks. The first trouble was getting the correct encoding, you see I’m Greek and many posts are written in Greek. The default encoding on dreamhost shell is UTF-8 so I assumed that the default encoding on the mysql database *is* UTF-8. Not to mention that when you first login to “PhpMyAdmin” interface you can clearly see the the UTF-8 encoding as the default choice. Anyway, the entire database was in encoding “latin1″. It took me some time, a few forum posts with no answer and a dozen of hours to get over it.

What I did is export the database using mysql dump, install it on a UTF-8 aware mysql database, at my home server, then using the python script to extract that data in a WXR format that wordpress can read, then import the WXR file to wordpress with the build in function.

So here is how I did. First, after Googling *alot* I crossed Jason’s blog. Grab the script and apply the patch you’ll find there, then run it, on a UTF-8 database. If your database is not UTF-8 then do the following:

$ mysqldump --default-character-set=latin1 -u root -p mephisto > test.sql
$ sed 's/latin1/utf8/g' test.sql > ready.sql
$ mysqladmin create mephisto_utf8 -u root -p
$ cat ready.sql | mysql --default-character-set=utf8 -u root -p mephisto_utf8

If you didn’t understand what we’ve did here is:

  • Export the mephisto database using explicitly “latin1″ encoding
  • Substitute latin1 with utf8 (if that doesn’t work, just do it manually, I did with VIM but here’s a handy sed command line, I’m quite positive it works - feel free to correct me)
  • Create a database called “mephisto_utf8″
  • Import our database in a mysql utf8 powered database
  • Now it’s time to run the python script. After downloading the file and the patch for MySQL from Jason’s blog, just type:

    $ python m2wp-ready.py  -d mephisto_utf8 -u user -p <pass> -o ready.wxr

    Now you should be all the set

    Written by Panagiotis Atmatzidis

    July 11th, 2008 at 9:08 pm

    Going wordpress!

    without comments

    Finally the transaction to wordpress went fine. I can see a few wrong dates and the tags/categories are kinda messed up. I’ll fix them the next days. For now I’m happy that I have all my posts, from all my previous blogs since 2006, in one wordpress blog.

    I will be more detailed on why I moved to wordpress from mephisto and how I did it. There are some interesting points, a script and a few mysql tricks in order to bypass lame encoding issues.

    As for now, I’m happy that I managed to do something that at first glance appeared a bit too complicated :-)

    Written by Panagiotis Atmatzidis

    July 10th, 2008 at 8:44 am