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.
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) 🙂
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?
@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.
Oh, and if you do find that it works okay with another version, please post here saying so.
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?
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.
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?
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.
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):
?????
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
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?
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?
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.
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
Thanks for the great script! I just used it to move all my geeklog posts to my new wordpress blog and it worked great!
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.
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.
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.
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.
That could be. I know I was still on php4 when I did my migration. My site is on php5 now though.
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!
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. 🙁
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.
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
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.
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
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.
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)
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.
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.
It’s very beautifully
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!
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!!!
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!
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
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.
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.
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
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
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?
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.
I am not seeing any buttons other than “Categories”, the other buttons in the geeklog/import (geeklog.php) seem to be missing.
/john
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.
duh.
me=moron.
lol.
i did not see the button when the first import completed.
rm -Rf john*
🙂
/john
Wow, this is incredibly useful. I successfully transferred one of my blogs already =)
Thanks so much Dave for this Geeklog to WordPress converter. This really worked like a charm!