Quantcast
Channel: Topic Tag: MySQL | WordPress.org
Viewing all articles
Browse latest Browse all 5530

tiagobugarin on "Migrate from Nucleus CMS to Wordpress 3.5.1"

$
0
0

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 all articles
Browse latest Browse all 5530

Trending Articles