• I am trying to migrate a Nucleus CMS blog to WordPress. After failed attempts using what’s listed at WordPress Codex for importing content I got stuck with this last attempt.

    Nucleus-to-Wordpress Migrator was last developed in mid 2009 but since then I believe WordPress has changed and it does not work without some modifications that has a huge impact in the site I am trying to migrate: abandon all categories.

    In 2012 this review was left showing what lines must me commented off so that the script works while compromising the categories names:

    This is the only Nucleus-to-Wordpress Importer that worked for me. If you are using a newer version of WordPress, you have to delete some lines in index.php and classes.php5 to make it work.

    index.php: lines 331-346 (begins with “// Okay, now that’s done” and ends with “flush();”) and lines 367-377 (begins with “// Update post counts” and ends with “flush();”)

    classes.php5: lines 277-279 (begins with “// Insert post2cat” and ends with “$database->query($query);”)

    If you delete these lines, the categories are not created and all items are assigned to the standard category. But if you do not delete these lines, you can’t import anything… So, it’s not a perfect solution, but you will have all items and comments. That’s a good compromise, I think. 🙂

    The mentioned lines goes as folows:

    index.php

    // Okay, now that's done, time for the heavy work.
    // Import the categories
    _e("<p>Importing categories...<br />");
    flush();
    // Get Nucleus categories
    $query = sprintf("SELECT * FROM <code>%s</code>", $nucleus_db->prefix("nucleus_category"));
    $nucleus_categories = $nucleus_db->getResults($query);
    
    foreach ($nucleus_categories as $ncat)
    {
        $wpcat = new Category ($ncat["cname"], $ncat["cdesc"]);
        $categories[$ncat["catid"]] = $wpcat->writeToWp($wordpress_db);
    }
    
    _e(sprintf("&nbsp;&nbsp;&nbsp;&nbsp;%d categories found.</p>", count($categories)));
    flush();

    classes.php5.php

    // Insert post2cat
    $query = sprintf("INSERT INTO <code>%s</code> (<code>post_id</code>, <code>category_id</code>) VALUES (%s, %s)", $database->prefix("post2cat"), $this->ID, $this->post_category);
    $database->query($query);

    Anyone knows what has changed in WordPress so that this code will not work anymore and how to change or where to get a comprehensive changelog of the WP changes?

    Note: Cross-posted in Stack Overflow

Viewing 1 replies (of 1 total)
  • Thread Starter tiagobugarin

    (@tiagobugarin)

    This is an update to the OP. I gave up that job being unable to properly migrate the data from Nucleus to WordPress.

    Shortly after the OP I went to pursue a different approach: export all Nucleus posts and comments into a XML file properly formated for WordPress.
    Since WordPress never documented it’s WXR file format I exported one from another site and used its skeleton to shape an export scheme in Nucleus.

    I did it, I managed to export every post and comment into a big WXR file but something is still not working when importing into WordPress: some posts goes, some doesn’t.
    The WXR file is 22,4mb with 355k lines of code. For this to even import I had to increase many aspects of my PHP environment.

    WordPress fails to import and does not provide a clear message to why it is failing.

    After complete the upload of the WXR file WordPress will ask how to import some authors but for some reason it is only importing the last post in the file.
    It happens differently if using various parts of the original WXR. If posts 1 to 10 fails to import only importing the 10th post, it shall not be a problem when importing posts 7 to 15 or 1 to 6.
    Therefore I could not identify what is causing the errors.

    The feeling I now have is that not only there are many CMS’ around there is no intention in using a common ground so that users can export their data and safely import it anywhere else without errors or problems.
    In WordPress and Nucleus cases, this is an opensource lock-in. There is no modern way of moving from the latest to the former.
    Just by looking at the WordPress Codex for migration from many CMS’ to WordPress shows how scattered this area is with many different methods to do the migration.

    WordPress, as the leading CMS engine, should not exclude it self from this matters and should pave the way for user freedom from any CMS easying the pain for those who want to go to WP and those wanting to part away.

Viewing 1 replies (of 1 total)

The topic ‘Migrate from Nucleus CMS to WordPress 3.5.1’ is closed to new replies.