Geeklog to WordPress converter

January 16, 2007 by
Filed under: Personal, Work 

I’ve been intending to convert my blog from Geeklog to WordPress for probably the better part of a year.  I’m a stickler for preventing dataloss though, and I really wanted to keep all my old blog posts.  I searched the web on and off for a month or two looking for a way to convert the data, and the best I could find was the RSS import in WordPress.  Unfortunately, the RSS export in Geeklog sucks rocks, and even hacking on it a bit, I couldn’t get all the data out in one piece.

So I finally gave up searching and wrote my own WordPress import module for Geeklog that would copy and translate the data directly from one database to the other. It’s heavily based on the existing importer for TextPattern that’s included with the current WordPress distributions.  It imports categories, users, posts, and comments.  It also stores the Geeklog Story ID (sid) into the post metadata, for use in making the old permalinks keep working.  I have an article.php stub you can drop into your wordpress directory that takes the Geeklog permalinks and redirects to the new WordPress ones.

I’m posting this here so the next person who has to convert a Geeklog to a WordPress can save themselves a bunch of trouble. :)  It’s all been posted to WordPress’ Trac system.  If you make use of it and make any improvements to it while you’re at it, feel free to add them to that bug.

Comments

65 Responses to “Geeklog to WordPress converter”

  1. Smokey Ardisson on January 16th, 2007 9:38 pm

    That’s one of the wonderful things about open source (software and people): someone has a problem, develops a fix, and lets the fix loose on the world (and in the relevant bug-tracker :)) so everyone else can benefit, too. Although many of us see this happening all day long in Bugzilla, there’s something “more tangible” about this wonderful way of working when one can see discreet, useful fixes hitting the “wider world” of the Internet outside of bug-trackers.

    Incidentally, your blog and mine share the same lovely theme (at least for the time being) :)

  2. Peter on February 6th, 2007 9:55 pm

    A Couple questions:

    1. Will this work for Geeklog v1.3? Should there be any issues?

    2. What kind of redirect does this use? 301? I’ve heard google gives a penalty if the posts aren’t properly redirected? Any info?

    3. I have thousands of posts, will this time out or do something harmful to my databes?

  3. justdave on February 7th, 2007 2:39 am

    @Peter:

    > 1. Will this work for Geeklog v1.3? Should there be any issues?

    I wrote and tested it with Geeklog 1.3.9. I do not know if it works with any other version as I didn’t have any other versions to test it with. You’re welcome to try it out (it won’t do anything to the source database, so there’s nothing to lose by trying).

    > 2. What kind of redirect does this use? 301?

    That’s a good question. I basically told PHP to do a redirect, I’m not sure what it uses by default. You’re right, it should be a 301… OK, I just tested it, and it does do a 301 (permanent) redirect.

    > 3. I have thousands of posts, will this time out or do something harmful to my databes?

    It won’t do anything to your geeklog database. It may take a while to import the data into wordpress though. As far as the redirect lookups go, those should be nice and speedy up to a few million posts, MySQL is good at that stuff.

  4. justdave on February 7th, 2007 2:40 am

    Oh, and if you do find that it works okay with another version, please post here saying so.

  5. Peter on February 7th, 2007 2:49 am

    One more question. I have an existing wordpress database now but my old site on the same server is on geeklog. Could running this ruin my current wordpress database? is there a safe way I should test this? Thanks for the advice?

  6. justdave on February 7th, 2007 9:00 am

    It’s always best to test it on a backup copy of the wordpress database first of course. You can take a mysqldump of the existing wordpress DB, and restore it to a different database name and test there. That said, this will add data rather than overwriting what you already have. I believe users with matching usernames will be consolidated, and it’ll probably overwrite their password with the one from geeklog in that case.

  7. Peter on February 8th, 2007 10:45 pm

    Dave,

    I’m running into a problem. The plug in is using the GeekLog Database Name for the import to wordpress. IE:

    [Table 'mygeeklogdatabasename.wp_categories' doesn't exist]

    By wordpress and geeklog are in two seperate databases

    Any Fix?

  8. justdave on February 8th, 2007 11:37 pm

    Yeah, put the correct database names in the correct places on the form when you start. There are two separate fields for the database to look at, one for geeklog and one for wordpress.

  9. Peter on February 8th, 2007 11:51 pm

    The importer I have does not ask for the wordpress database names, just geeklog:

    # GeekLog Database User:
    # GeekLog Database Password:
    # GeekLog Database Name:
    # GeekLog Database Host:
    # GeekLog Table prefix (if any):

    ?????

  10. Peter on February 8th, 2007 11:59 pm

    And to clarify… the importer i have is looking to import stuff into mygeeklogdatabasename.wp_categories

    when wordpressdatabase.wp_categories is the actual wordpress location.

    I enter the correct geeklog database locations into the importer, and it obviously find that data because its trying to import geeklog categories but is unable to since it’s accessing the wrong database

  11. justdave on February 9th, 2007 4:18 am

    yeah, been too long since I actually used it. It already knows where the wp database is because it’s running within wordpress when you run it, so the gl one is the only one it should be asking for. What versions of Geeklog and WordPress are you using?

  12. Peter on February 9th, 2007 5:12 am

    I’m using geeklog 3.1 but thats not the issue because the error messages reference the data that needs to be moved

    my wordpress is 2.0.5

    I can tell you 100% that it is trying to import the geeklog data to me geeklog database

    [Table ‘mygeeklogdatabasename.wp_categories’ doesn’t exist]

    obviously .wp_categories doesn’t exist in mygeeklogdatabase because thats a whole nother database from my wordpress database

    So what can i do to change the script so i can import into the wordpress database?

  13. justdave on February 9th, 2007 7:03 am

    no idea. It worked fine for me. The script doesn’t do any direct database access to the wordpress database, it uses wordpress’ library routines for all the data insertion. So wherever the wordpress config is pointed at probably.

  14. Peter on February 9th, 2007 1:14 pm

    hmmm well i want to use your script but it doesn’t look like that’s going to be possible because what i’m telling you is not usser error, the script is trying to import into the geeklog directory not wordpress

  15. Amy on February 25th, 2007 12:47 am

    Thanks for the great script! I just used it to move all my geeklog posts to my new wordpress blog and it worked great!

  16. SunFrogServices.com » Made the jump from Geeklog to WordPress on February 27th, 2007 8:07 pm

    [...] to Just Dave for the Geeklog to WordPress converter. And thanks to n4th4n for explaining how to use it. Being [...]

  17. Rob G on March 1st, 2007 8:45 pm

    Peter:

    I had the same issues as you, but eventually found a post on the WP Codex that helped greatly: merge the two databases first, then run the script. I imported my GL database into the WP database, then when the script asks for the name of your GL database, give it the name of the WP database.

    Bingo! Then just delete the GL tables when you’re done.

  18. Rob G on March 1st, 2007 8:50 pm

    Script improvement: I wanted to maintain the “Read more…” breaks from Geeklog. So just above this line…

    $Body = $introtext.$bodytext;

    Add this line:

    $more = (strlen($bodytext)) ? ‘‘ : ”;

    And then change the $Body line to this:

    $Body = $introtext.$more.$bodytext;

    This will force the importer to respect those Geeklog stories that were originally split in two parts.

    Thanks so much for this importer; you saved me hours of manual labor that I’d volunteered to do for a buddy!

    -rob.

  19. justdave on March 1st, 2007 10:14 pm

    Interesting. Mine were in two separate databases when I did it. But they were both on the same mysql server. Maybe that’s the issue. I did do a dump of the original database and restore it to the new server along side the wordpress one before running it.

  20. Rob Griffiths on March 1st, 2007 11:49 pm

    I had the same setup — both databases were running on the same machine under the same MySQL server (same user accessing both, in fact). But when I tried to import from Geeklog, I had the exact results shown above — the table names for the Geeklog tables had “wp” in their names. When I merged the databases, it worked as expected.

    I wonder if it might have to do with PHP versions? I was using PHP5 on Apache 1.3.33.

    -rob.

  21. justdave on March 2nd, 2007 1:36 am

    That could be. I know I was still on php4 when I did my migration. My site is on php5 now though.

  22. Chris on May 3rd, 2007 3:04 pm

    Hi Dave,
    Thanks for sharing this useful info. I’ve been on GL v1.4.1 for a while and I can’t take it anymore. I’m tired of trying to find the right place to hack in GL’s codebase just to make it do some basic things that other blogs can do.

    However, I’m not a php/MySQL engineer, nor do I want to be one. I just want to get off of GL and get onto a more friendly platform.

    Question 1: Do you think WP is a “best of breed” alternative? Can I use it (say, with Feedburner) to send out new posts via email automatically?

    Question 2: Would you be willing–or anybody else–to do the migration for hire?

    Any suggestions would be most appreciated!

  23. justdave on May 9th, 2007 10:32 pm

    Chris: in regards to question 1, I can only say that I’m satisfied with it so far. I haven’t gone out of my way to research what’s out there, but I had several friends that liked WP, and their blogs looked nice, to I used it. :)

    For question 2: as much as I’d love to, I find myself already running way short on time to keep up with the stuff I’m already paid to do, so I’d have to decline. :(

  24. PeterR on May 12th, 2007 12:06 pm

    Hey Dave, Thanks! Worked great mostly for my conversion except for post titles that have a ‘ in it… worked on geeklog 1.4.x and wordpress 2.1.3 for those interested.

  25. Chris on May 16th, 2007 9:46 am

    OK, thanks Dave.

    If anybody else reads this and is willing to do a conversion for me for hire, please write me at chris dot nelder at idiotwind dot net.

    Thanks!

    –C

  26. Daniel on May 17th, 2007 10:20 am

    wow. thanks for posting this. it’s just what i’ve been looking for. i’ve been “locked in” geeklog for a long while and i can’t wait to transfer over to wordpress.
    i’m probably going to take my time and really look into how to get migrated over properly but this definitely looks like the answer to my problems. thanks again.
    i’ll let ya know how it goes.

  27. bruce on May 23rd, 2007 11:16 am

    Hi. Here’s a question. I found this while looking for something to convert FROM WordPress TO Geeklog but all I’m finding is stuff about people converting the other way round.

    I’ve been impressed with geeklog although I admit I’ve only had a few hours’ play… what have I missed?

    Thanks for any advice offered.

    Bruce

  28. justdave on May 23rd, 2007 10:59 pm

    For me it was the ease of posting. It’s slightly more difficult to post a new article in Geeklog. And necessarily so, because Geeklog is intended to be a full website CMS rather than blog software. WordPress was designed to be a blog, so that’s what it’s good at. If all you’re doing is a blog, Geeklog is kind of overkill. But if you’re doing a full website with news and articles and whatnot, Geeklog is great.

  29. justdave on May 23rd, 2007 11:05 pm

    Oh, one other thing I like about WordPress is getting an email every time someone posts a comment. I never managed to get Geeklog to do that (at least not in the version I was running at the time – I’d be surprised if that hasn’t been added in a newer version since then)

  30. hirocaster on June 18th, 2007 9:29 pm

    Hello Dave,

    I hope you read this.
    I just imported all articles and users, all done well.
    Works like a charm.

    But i was using a different permalinks in geeklog made bymyself using .htaccess mod rewrite.

    My links were like instead of standar geeklog

    /article.php?story=name-of-article

    i did rewrite to show

    /articles/name-of-article.html

    So…my question is…
    How can i change you article.php file to redirect these links too??
    i already made a test and it doesn’t redirect.

    I don’t move permanently my website…i need to solve this problem first.

    Thanks in advance, any help is welcome.

  31. justdave on June 24th, 2007 1:55 am

    hirocaster: I wouldn’t really be sure without seeing it. Basically, you would need a RewriteRule in your .htaccess to point /article/ at your article.php file, then you would need to change article.php to look up the title instead of the old sid from geeklog. Depending on the formatting of the title, you may need to adjust the import script to save geeklog’s version of the title slug as a meta field (like I did with the sid value) and look that up instead, but if the title slug imports intact in wordpress you can probably just look up wordpress’s version.

  32. Mike on August 5th, 2007 5:37 am

    It’s very beautifully

  33. Benjamin on August 9th, 2007 12:05 am

    Success!

    Thank you, Dave, for creating and posting this. It works great and is much cleaner than I probably would have made it for my own purposes.

    For the record, I migrated a Geeklog 1.3.11 install to WordPress 2.2.2 using your script. This was running on MySQL 4.1.20 and PHP 5.0.4 on a CentOS 4.5 system. Everything just worked!

    One note, as I was a bit ignorant of WordPress; users need to copy the “geeklog.php” file into the “{wordpress}/wp-admin/import/” directory in order to use it. It is accessed from the WordPress admin tool’s “Manage -> Import” menu.

    Very simple, but that took me a bit to figure out.

    Thank you again!

  34. Vera on August 27th, 2007 1:14 pm

    Worked for me, going from Geeklog 1.4 to WordPress 2.2. I did get the same error that Peter got, so I imported the GL data into my WP database and just pointed the importer to the WP database. Worked fine after that.

    Thanks!!!

  35. DanGarion on September 1st, 2007 7:05 pm

    It worked perfectly for my site. Now to figure out how I’m going to import all my media gallery stuff to something!

    http://www.dangarion.com/wp

    Thanks!

  36. Caixa de Brinquedos do Theo » Blog Archive » Êêêêêbaaa! on September 21st, 2007 4:53 pm

    [...] a base de dados do Geeklog para o WordPress. Isso graças à invenção que um cara criou e colocou na Internet de graça! Fica aqui a dica para quem [...]

  37. etegration on October 18th, 2007 9:03 am

    nice plugin but scrolling through the whole page to find out why the errors was kind of tedious. I made this page for quick reference! Thanks to all who have posted here and Dave for kicking this off.

    http://moonshine.homedns.org:2655/wp-gl/articles/migrating-geeklog-to-wordpress

  38. Charles B on November 13th, 2007 8:14 pm

    I also merged the databases and everything almost worked perfectly. The only problem I had was that all of my embedded pictures seemed to disappear. Any ideas on how to proceed with fixing that?

    For the record, I imported into WP 2.3.1 from GL 1.4.

    Thanks for writing a great script — you saved me a ton of heartache because this is a blog that is fairly popular and getting it onto the new platform before dinner (after work) is an awesome piece of coding on your part.

  39. justdave on November 14th, 2007 1:18 am

    I never got as far as fixing images… I only had two at the point when I moved my data over, and I just fixed them by hand. It would involve some URL detection, matching img src links that have your site’s prefix or match Geeklog’s image directory, then snagging the file, putting it where WordPress expects it, and rewriting the URL within the body of the post.

  40. Geeklog To Wordpress Import Script | .SlackbloG on February 28th, 2008 12:23 pm

    [...] to Just Dave for the Geeklog to WordPress converter. Aku pernah make Geeklog sebagai engines blog. Agak ribet [...]

  41. johnh on April 15th, 2008 10:41 am

    Where to start? I am trying to get data imported from an old 1.3.11 geeklog site but I cannot seem to figure out where to start. I have geeklog.php and article.php, a brand-new wordpress installation. What’s the next step? Simply visiting the wordpress/geeklog.php doesn’t seem to work. Should I drop the geeklog.php/article.php into the geeklog site and go from there?

    /john

  42. johnh on April 15th, 2008 10:54 am

    ok, figured out what to do with geeklog.php, you add it to the /wp-admin/import and then manage -> import. however… it only imported my categories and did not grab the articles…. so one must assume, do something with article.php to get that accomplished. working on that now. using this blog comment as a helper for future users. please input if you know something i am missing.

    /john

  43. johnh on April 15th, 2008 11:21 am

    ok, figured out the wp-admin/import thing… put geeklog.php in there…. but, i can’t get the stories in GL to import into the new wordpress database and i have no clue what to do with the article.php.

    help?

  44. justdave on April 15th, 2008 4:25 pm

    article.php isn’t needed as part of the conversion process. You use that after the fact if you want your old permalinks to keep working.

    You did find the correct location for the geeklog.php script. Did it tell you that it finished? There’s several steps to it (users, categories, articles, comments), and all of them need to complete, one at a time, you’ll need to confirm each one, and it’ll tell you that everything is done after the last one.

    Do note the issues mentioned on the bug report on wordpress’ site about memory, make sure you’re not running out of memory before it finishes.

  45. johnh on April 16th, 2008 8:00 am

    I am not seeing any buttons other than “Categories”, the other buttons in the geeklog/import (geeklog.php) seem to be missing.

    /john

  46. justdave on April 16th, 2008 2:29 pm

    The button for each thing to be imported is at the bottom of the screen with the results of the previous thing you imported. There should be a button at the bottom of the results screen from importing the categories to go on to the next thing.

  47. johnh on April 16th, 2008 8:39 pm

    duh.

    me=moron.

    lol.

    i did not see the button when the first import completed.

    rm -Rf john*

    :-)

    /john

  48. Random Kismet » Blog Archive » Made the jump from Geeklog to WordPress on August 3rd, 2008 10:04 am

    [...] to Just Dave for the Geeklog to WordPress converter. And thanks to n4th4n for explaining how to use it. Being [...]

  49. Weight Converter on August 14th, 2008 12:00 pm

    Wow, this is incredibly useful. I successfully transferred one of my blogs already =)

  50. Mike on August 14th, 2008 6:07 pm

    Thanks so much Dave for this Geeklog to WordPress converter. This really worked like a charm!

  51. Alabama fest on September 10th, 2008 2:15 pm

    Beautiful! absolutely brilliant!

  52. Geeklog Importer « Tobi D’s wordpress work on November 16th, 2008 12:06 pm

    [...] While migrating my website from geeklog to wordpress i stumbled upon the geeklog2wp importer from justindave. This is a very nice and handy, but unfortunatley, some parts are not importet (links, static [...]

  53. tobias on November 16th, 2008 12:59 pm

    hi, thanks for the good importer – it helped me a lot.

    following your post on the trac website: “It pretty much does what I needed it to do, and I’m sure someone else can make use of it, and possibly clean it up better.”, i made use of it, extended it in a way that it does pretty much what i needed it to do and i am hoping that someone possibly will clean it up better …

    things i have added are import of links, import of static pages, import of article images, and a list of pages where i have to change geeklog autotags manually.

    as i am new to wordpress, i have no idea where to post an importer so i have put it on an wordpress site: http://tobid.wordpress.com/2008/11/16/geeklog-importer/.

    tobias

  54. Don Winner on January 12th, 2009 2:42 pm

    I’m trying to convert my GL 1.4.1 website to WordPress 2.7 and I’m running into some problems.

    First of all, the database for my existing site is very large with 441.2 MiB total in the tables. I have almost 8,000 articles that I want to import and migrate to WordPress.

    I copied the geeklog.php file into the “{wordpress}/wp-admin/import/” directory, but when I then went there to try to use the script I had this error waiting for me:

    Parse error: syntax error, unexpected T_STATIC, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or ‘}’ in /home/panamax/public_html/wordpress/wp-admin/import/geeklog.php on line 56

    In the geeklog.php file at line 56 there’s this:

    static private function read_url($url) {

    Any comments or ideas?

    Has anyone else successfully converted a GL 1.4.1 site to WP 2.7?

    Should I drop back and use JustDave’s original script?

    Any help would be greatly appreciated. Thanks.

    Don
    http://www.panama-guide.com

  55. Don Winner on January 12th, 2009 4:00 pm

    Update: Tobias contacted me and the problem was that I was running PHP version 4.4.6 and his script is written for PHP 5. I have asked the host sys admins to upgrade PHP, and will try again once that’s been accomplished.

    Don

  56. Kirk McElhearn on March 3rd, 2009 6:09 am

    The script worked fine to convert my GL database to WP, and it runs fine. However, the article.php file doesn’t do anything. All I’m getting is my articles that were done under GL opening in GL. There’s no redirect happening.

    But I’m not sure I’ve understood what to do with it. I have my WP files in /wordpress/, and the article.php at the top level of my server. (I assume I shouldn’t be replacing the WP article.php file…) Is this correct?

  57. justdave on March 3rd, 2009 1:15 pm

    article.php should be in the same directory with WP. I didn’t know WP had one already. If it does, I’m willing to bet it’s the same one and this is actually included in the distribution now. You could always look at it and see.

  58. justdave on March 3rd, 2009 1:21 pm

    Actually, to clarify that, article.php is intended to work as if your wordpress replaced your Geeklog in place, i.e. the root url of your wordpress install is the same as the root url of your geeklog was before you took it down.

  59. Joy on March 4th, 2009 2:19 pm

    I would love to use this script and I went through all the import screens inside WP, but it didn’t actually import anything. It would run correctly and then just report “0 posts imported” or “no categories to import”, things like that. All the way to the end it seemed like the script itself is working great, but it didn’t actually pull anything in from the Geeklog db.

    Any ideas on why this wouldn’t work? I can double check my settings but I’m assuming the script wouldn’t “run” if those were incorrect.

  60. Sculley on November 2nd, 2009 7:21 pm

    Hi Dave,

    Are you available for hire (pay) to convert a Geeklog blog to WordPress? I have a feeling a lot could go wrong and I am definitely not a database person and don’t know much about it.

    Thanks so much,

  61. justdave on November 2nd, 2009 10:10 pm

    @Sculley: unfortunately no. As much as I’d love the idea of making a little money on it, I’m way too busy these days to try to squeeze in anything else and still do a good job of it.

  62. Sculley on November 2nd, 2009 11:06 pm

    Bummer but I understand and happy you’re busy! Do you think someone who has worked with WP before and knows xtml and css (me) will be able to handle the transfer with your tool?

  63. justdave on November 3rd, 2009 3:18 am

    I’m sure they could. I don’t know anyone to recommend to you though. :(

  64. uwonder on May 6th, 2010 3:56 pm

    Just want to say that the import worked fine for me.
    GL v 1.3
    WP v 2.9.2

  65. casey on October 19th, 2010 10:21 am

    export from geeklog to wordpress via MT format.
    see also my blog:
    http://pc.casey.jp/archives/3083
    http://pc.casey.jp/archives/3119

Feel free to leave a comment...
and oh, if you want a pic to show with your comment, go get a gravatar!





  • Find me on Twitter

    Me: @justdavemiller
    The Bugzilla Project: @bugzilla
  • Recent Tweets by @justdavemiller

    justdavemiller The first public release of the Ubuntu OS was 10 years ago today. My memories of it at http://t.co/o2dSKulW5H
    justdavemiller RT @MitchellBaker: Liberia: The Impact of Open Source Software in the Fight Against Ebola: http://t.co/G3BeYnCZLF via https://t.co/hitm28YY
    justdavemiller RT @brianloveswords: If you use homebrew and you plan on upgrading to Yosemite, read this first: https://t.co/eHVFGn2UkC.
    justdavemiller @FCC and most browser block insecure content on secure pages now
    justdavemiller @FCC when viewing your website on https the video player on the live page doesn't work because it tries to load over http instead of https
  • Archives