Once I promised to release the script that I wrote while migrating from Nucleus CMS to WordPress. Well, here it is. But I doubt that you should start any serious celebrations, since this one is pretty messy and based very much on my setup. Let me try to explain a couple of things to make it easier for you.
Expectations (read: limitations):
- This script expects that all your Nucleus tables have
nucleus_prefix and all your WordPress tables havewp_prefix. These are the defaults anyway, so I don’t think this is much of a problem. - This script expects that all your Nucleus tables and all your WordPress tables are located in the same database. And I really don’t see the reason to separate them anyway. You’ll just delete Nucleus tables after migration.
- This script expects that your WordPress upload directory is
/wordpress/wp-content. This is again one of WordPress defaults, so I don’t think it will matter much. - This script expects that inline images in your Nucleus posts were surrounded by the
<div class="leftbox">...</div>and<div class="rightbox">...</div>. If you had it differently, you’ll have to play with regexps. - This script expects that all authors who posted items in Nucleus have the same username (aka login) in WordPress. Since I was and will be the only user posting items, that was pretty easy for me.
- This script expects that all categories that existed in Nucleus have the same name in WordPress. It does not create these, since WordPress has a more advanced cateogory functionality (with nesting and stuff), so you’ll have to deal with this.
- This script does not create slugs (short-names-with-hyphens) for WordPress items, so if you are using post titles in your permalinks, they won’t work. I was (and still am, for that matter) fixing this with a bunch of other tiny script which I won’t post here for their uglyness. Find your own solution or don’t use post items in the permalinks.
Features (read: things I cared about)
- This script migrates Nucleus posts to WordPress. NOTE: Nucleus uses two database/forms fields for the post body and extended part (aka ‘Read more’). WordPress has only body in database/forms, but provides a
<!--more-->tag to separate the post in parts. My script is using this tag when combining Nucleus post parts into WordPress single post. - This script can migrate either all posts or posts written after the certain date.
- This script migrates Nucleus comments to WordPress. This script will use Nucleus members information (names, URL, email) and information that was provided via comment submission form smartly. Well, as smart as works for me.
Comments are assigned to posts based on the post time AND post title. This should be right most of the times. - This script tries to be as verbose as possible during the migration process, so that you always know what it does. (I consider this to be more of a feature than a limitation.)
Once again, remember that this script wasn’t written to work for the general public, since the amount of customization that can be (and usual is) done to both Nucleus CMS and WordPress is enormous. I wrote this script as a quick hack to help me with a one time task, so don’t expect much. If things go wrong, check the regexp bits first, and the SQL bits second.
Without further ado: nucleus2wordpress.pl
P.S.: If comments in the script appear strange or incorrect, consider the fact that I wrote them few days after I wrote and used the script itself…
Update: If you used this script, you might be also interested in Fixing WordPress slugs post.



36 responses so far ↓
1 Weblog Tools Collection » Import from Nucleus CMS to Wordpress // Apr 26, 2005 at 4:01 pm
[...] S to Wordpress Categories - Cool Scripts WordPress Hack LinkyLoo — Mark Import from Nucleus CMS to Wordpress: Leonard gives us a starting point for an impo [...]
2
Constantinos Kouloumbris
// Apr 27, 2005 at 4:32 am
I think, you can change your headers to post id save it and then back to name again and slugs will be created but i am not sure. Since when i imported my posts i think slugs where ok only in some of them there where spaces and stuff, and of course the ones in greek sucked big time. The importand think it work though I deceided to stay with ids
3
Leonid Mamchenkov
// Apr 27, 2005 at 8:21 am
yeah, true - one could use the IDs of the post or even the data/time only for permalinks. But on the other hand, fixing slugs is not that difficult. The routine is already there, one just has to apply it to all posts in the database.
4 Aventuras Informaticas » Archivo » De Nucleus a Wordpress // Apr 28, 2005 at 1:40 am
[...] ucleus a Wordpress
Archivado bajo Miniblog | Wednesday, April 27th, 2005
Script realizado en perl para el traslado de los datos de Nucleus a Wordpress.
[...]
5 semperMagis » Van Nucleus naar WordPress: howto? // Jul 15, 2005 at 1:19 am
[...] Ik heb slechts twee import scriptjes gevonden: wp-convert en nucleus2wordpress. Ik kon zelf niet anders dan wp-convert gebruiken, want nucleus2wordpress is een perl script en kan enkel losgelaten worden op een UNIX server (semperMagis draait op een Windows server). Mocht je de keuze hebben, dan zou het wellicht een goed idee zijn om te opteren voor nucleus2wordpress - al heb ik daar zelf geen ervaringen mee. [...]
6 villatrauma » portierung noch nicht erfolgreich // Aug 6, 2005 at 8:12 pm
[...] was verhindert meinen erfolg? wollt ich doch gestern heute meine blogs aus dem alten Nucleus CMS in Wordpress übernehmen. Dummerweise ist das aber alles andere als trivial, selbst dann nicht wenn man bereit ist sich das perlskript nucleus2wordpress.pl von Leonid entsprechend anzupassen - btw: die wohl einzige auffindbare verwendbare vorlage um dieses problem anzugehen. leider werden alle umlaute und sonderzeichen fehlerhaft übernommen und auch alle grafiken können nicht so einfach übernommen werden. nucleus funktioniert halt leider so komplett anders als wordpress… [...]
7
Kryss
// Sep 30, 2005 at 11:59 pm
I love the script but I see no installation or how to run it. please advise….
I am trying to move over 300 posts from nucleus to WP which I love.
thanks for any assistance
8
Leonid Mamchenkov
// Oct 1, 2005 at 12:28 am
First thing that you need to do is read carefully through this post. This script was written mostly to work once and exactly on my setup. I didn spend any time trying to make it work everywhere and for everyone. So you have to be careful (read: full backup of everything before any other moves).
Secondly, you have to do is edit the first few lines of the script to reflect your configuration. Database configuration variables are the first to take care. Than specify the blog ID to work with, the date to use as a start, and the post status to assign.
Thirdly, just run the script from the command line like
/path/to/script/nucleus2wordpress.pl.If you are extremely lucky, than you should get a bunch of verbose output regarding a successful migration.
9
Squeakypants
// Jan 19, 2006 at 4:38 am
Thank you so much!!!!
10
Leonid Mamchenkov
// Jan 19, 2006 at 4:44 am
Though I am a bit surprised that it actually worked..
11
Nola
// Feb 3, 2006 at 8:43 am
I’ve been struggling with this script all day and I’m hoping you can help me out. I’ve never worked with perl before, but I assumed, from reading your comments above, that I was to make the changes to the database information within the document, upload it to the proper directory, then use my browser window to attempt to activate the script by typing in the correct pathway. I have tried this about a billion times now (roughly, lol) and I keep getting an ‘internal server’ error message.
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, webmaster@onlynola.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
Now, I’ve gone over this repeatedly and found no errors in the database configuration, so I don’t know what else to do. I had installed the wordpress into the same database as my Nucleus to allow me to use this script to transfer my posts. The password and other information should match what is in my Nucleus config file and work, right? But it doesn’t. I’m sure I’m doing something wrong, since I doubt it’s the .pl file’s fault, but I’m at a loss as to what else I can do. Any help would be greatly appreciated.
Sorry for putting up such a long comment. It’s late and I’m a little loopy.
I can’t wait to get this settled… this will save me many hours of work transferring posts manually. I shudder at the thought. Over two hundred posts? GAH!
I input the link to my test wordpress site, in case you need to see it.
Thanks in advance.
12
Leonid Mamchenkov
// Feb 3, 2006 at 12:40 pm
I guess I forgot to mention that this script should be executed from the command line and not from the browser. I don’t know if you have enough access rights with your hosting company to use the command line though.
13
Nola
// Feb 3, 2006 at 4:55 pm
Um. Command line? Okay, I just did some quick reading on the command line thing, and what you’re saying is that I need to enter a command into the .pl document itself, via a prompt? What would be the command I’m supposed to use and exactly how it’s supposed to be entered?
Thanks
14
Nola
// Feb 3, 2006 at 5:00 pm
Oh, by the way… it appears that the server for my site does allow command line access to its clients. That’s what you were talking about, right? I just went to the support forums at my hosting company and people were talking about cron jobs and command line interface and all kinds of other things that I have NO clue about, lol.
Just thought I’d let you know, in case it matters.
15
Leonid Mamchenkov
// Feb 3, 2006 at 5:07 pm
What you need is the following:
1. Ask your hosting company if you have shell access (this is just the name for the command line). If you have, ask them how you can access it (which protocol, which host, which port, which username, and which password to use).
2. If you have access, they will probably tell you to use Secure Shell (or SSH) on port 22 with the username and password that you have for your account already.
3. Now you will need to get yourself a copy of SSH client. One of the good and free programs that does SSH is Putty. Download it. It doesn’t need any installation. Just run it.
4. In Putty specify the hostname, port, username, and password that your hosting company provided. Than click ‘Connect’.
5. If everything went OK, you will a terminal window - a black square with a command prompt, similar to DOS. You can type commands in there.
6. Using commands
ls(list files in the current directory) andcd(change directory to another one) navigate to the place, where you uploaded the Perl script.7. Now you can execute the script by running the command
perl nucleus2wordpress.pl.If everything went good, you’ll have your blog migrated. If something went wrong, something will break.
Alternatively, you could try to find someone who has experience with command line and/or perl to help you out. Try contacting your hosting company with this issue - they might just have the appropriate people, and they shouldn’t charge you a fortune.
Good luck!
16
Leonid Mamchenkov
// Feb 3, 2006 at 5:20 pm
even better - there are support forums!
You can ask people there for help with the script. They will know the specific environment of your hosting company and will probably help you out.
17
Mark Cohen
// Mar 2, 2006 at 12:59 pm
You’re a legend!
Thanks for sharing
18 » numerodix blog « » Blog Archive » blog facelift // Aug 13, 2006 at 4:00 am
[...] Finally (and this post isn’t quite in chronological order), with WordPress set up and configured, it was time to import my posts from BLOG:CMS. As it turns out, WordPress *still* hasn’t developed a script for that, but a few people have tried it. I tried every script I could find, but only one of them worked, and it was Leonid Mamchenkov’s nucleus2wordpress.perl. The script ran without a hitch, actually. I realized I would have to hack it a bit, because the images weren’t showing up (and this is something WordPress is very stupid with - hardcoding image paths in posts). There was also a problem with the charset - WordPress uses utf-8, BLOG:CMS uses iso-latin-1. I had to research how to encode text in perl and surprisingly, I pulled it off with two lines of code that worked (w00t! w00t!). I say that, because I don’t actualy know perl. So now the rare post in Norwegian shows up in all its utf-8 splendor. [...]
19
ReF
// Sep 25, 2006 at 7:45 pm
well..why should we change our CMS? Am I the only one who love NucleusCMS?
It seems to work perfectly to me… maybe I’m wrong.. bhu?!
20
Leonid Mamchenkov
// Sep 25, 2006 at 7:58 pm
There are plenty of comparisons on the web of different CMS engines. There are even places where you can try few of them in demonstration mode… Different things work for different people. If you are happy with NucleusCMS, I’m glad for you. If you are not - look around. The choice is plenty.
21
jon
// Sep 28, 2006 at 10:51 am
love the script but I see no installation or how to run it. please advise….
I am trying to move over 300 posts from nucleus to WP which I love.
thanks for any assistance
thank u very much
jon
Data entry
22
Leonid Mamchenkov
// Sep 28, 2006 at 1:29 pm
the script requires some tweaking, so some perl knowledge and UNIX command line experience are a must. Can you find anyone nearby who can help you?
23
Portrait From Photo
// Oct 28, 2006 at 7:08 am
I don’t have much to say about the idea you have suggested here except that they’re great! What disadvantages can this tags create on my WP blog?
I’ve seen your Flickr photos too. You have a unique choice of subjects. The boat from afar looked COMPLETE and STUNNING as it sails through the vast ocean which was made even more exotic as you changed the hues of one picture to another. Is that your own dog? It looks so clean and as if it never misses its bath time.
John
24
sun bingo
// Dec 12, 2006 at 11:32 pm
thanks, i have been looking for this,
gonna make life much easier. Thanks for that
have a good christmas
25
ituloy angsulong
// Jan 23, 2007 at 11:57 am
I’ll give it a try. Hope I’ll not mess up the codes.Thanks.
26 BlogCMS to Wordpress Migration // Feb 5, 2007 at 6:28 am
[...] Then came the news of impending arrival of WordPress 2.1 , with built-in tool to migrate and consolidate WP blogs. This means that if I somehow migrate my old BlogCMS entries to Wordpress, I can easily consolidate last 6 months of WP entries. The only tools available to move NucleusCMS to Wordpress is Leonid Mamchenkov’s Nucleus2Wordpress Perl script. I had once tried it in the past and miserably failed. This time, I set up a transition blog, in the old server replicating my BlogCMS database. Then I installed a WP 2.0.7 using the same database. This is the big catch, for Leonid’s script to work, both blogs should be sharing the same database. In the past I was using different databases for BlogCMS and WP. This time it was a single database, with their respective prefixes (nucleus for BlogCMS and wp for WordPress). Also important is, the user name and categories name should be identical in both the tools. BlogCMS had truncated one of my categories name and I was unaware of it, which I could spot only on the third run. [...]
27
Baranee
// Feb 13, 2007 at 12:34 am
Thank you very much for this script Leonid Mamchenkov, Migration went like a cakewalk,
Though I had seen your post a while back, was bit skeptical and lazy to do it. After reading a fellow blogger’s
post I was convinced, did it and it really went well like a cakewalk.
Thanks again.
28
Johanna
// Mar 15, 2007 at 1:02 am
Cheers for the code will take a look through…seems daunting tho!
29
Scott Miler
// Mar 18, 2007 at 1:57 am
I used your script to create http://www.the-healthy.com and it worked very well.
Thanks,
30
Paul Francis
// Mar 22, 2007 at 3:14 am
Help I can not get it to work!
31
Gadget Man
// Mar 24, 2007 at 5:30 pm
Thanks for the help! Much appreciated
32
Gadget man
// Mar 26, 2007 at 1:24 pm
Tried submitting a comment but on the next page, the security number was not shown. Tried re-sending and it was flagged as a duplicate.
Original comment:
Good stuff. An ex-colleague of mine tried it and it did good. I think some people use Wordpress over Nucleus cos their’s less hypertext preprocessing to do?
33
James
// Apr 24, 2007 at 5:04 pm
Thanks Leonid. Keep up the good work.
I love this script.
34
bucon
// May 29, 2007 at 1:29 pm
is there a way to hack the nucleus2wordpress to be able to recieve anything other than the posts
35
dc
// Jun 28, 2007 at 12:25 pm
excellent script thanks. will come in handy
36 Nath’s Blog» Blog Archive » Blog migrated! // Oct 25, 2007 at 8:02 am
[...] that there is none). This was relatively simple, once I discovered Leonid Mamchenkov’s nucleus2wordpress perl script. Note that this script only works with earlier versions of wordpress (pre 2.3), since in version [...]
Leave a Comment