nucleus2wordpress

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 have wp_ 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.

55 thoughts on “nucleus2wordpress”


  1. 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 :P


  2. Hi Constantinos,

    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. ;)


  3. 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


  4. Kryss,

    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. :)


  5. 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.


  6. Hi Nola,

    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.


  7. 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 :)


  8. 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.

    :)


  9. Hi Nola,

    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) and cd (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!


  10. Nola,

    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.


  11. Hi ReF,

    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. :)


  12. 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


  13. 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


  14. 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.


  15. 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?


  16. Hi!

    I checked you Nucleus, a fine script! WordPress has great look (if not the best), however when it comes to security and content management system, I would strongly recommend you to consider converting your CMS to a Perl based script, any chance you may consider using such Perl platform as WebAPP ( http://web-app.net ) or MetaDot ( http://metadot.com ) both are very safer… but I admit not as nice looking as WordPress.

    Good luck!
    Malik


  17. Got any tips for me, I keep getting the error from the perl script:
    DBD::mysql::st execute failed: Field ‘post_excerpt’ doesn’t have a default value at C:\Users\Administrator\Desktop\nucleus2wordpress.pl line 182.


    1. A few people reported that the script is still relevant. Personally, I haven’t tried it in a very long time. In fact, I haven’t tried it since I moved to WordPress back in 2005. :)


  18. I know this was posted a while back now, but the move from CMS to WordPress is one of the best things that has happened. Even though the script is outdated, it works better than most CMS anyway so you can give it a go.

Leave a Comment