Page 1 of 1

Help needed for switching from Nucleus...

Posted: Sat Jan 29, 2005 2:49 pm
by TheMM
I need some help for switching from Nucleus to Serendipity.

Mainly I have three questions:

1) Has anyone ever switched from Nucleus to Serendipity? How didi you get Nucleus to provide a complete RSS feed with all articles?

2) Is there a way to also import the comments to Serendipity. I do not want to loose them!

3) Is there a script to step through all the imported entries and to batch change specific item texts? For example I have the string :=) that will be converted by my current Nucleus installation to a gif which shows an arrow. I would like to eliminate these strings in all my old blog entries.

Any help would be greatly appreciated!

Best,
TheMM

Re: Help needed for switching from Nucleus...

Posted: Sat Jan 29, 2005 3:09 pm
by garvinhicking
I'm sorry, and don't have any Nucleus experience.

Since Serendipity 0.8 we offer native import for WordPress and MoveableType - if you are basically familiar with some PHP code, you may be able to suit those to read Nucleus Databases? That way you would get to keep your comments as well, since RSS import does NOT cover comments.

If you are a bit familiar with SQL and PHP, you can compare the serendipity_entries and serendipity_comments table with Nucleus. I'm sure they have a somewhat similar structure.

About the third way: There is no script available to do that, but it can be easily done with either SQL or PHP.

SQL:

Code: Select all

UPDATE serendipity_entries SET body = replace(body, 'the_source_string', 'the_target_string);
UPDATE serendipity_entries SET extended = replace(extended, 'the_source_string', 'the_target_string);
with PHP you could to more advanced replacements:

Code: Select all

<?php
mysql_connect('host', 'user', 'password');
$sql = mysql_query('SELECT id, body, extended FROM serendipity_entries');
while ($row = mysql_fetch_array($sql, MYSQL_ASSOC)) {
  $body = str_replace('your source string', 'your target string, $row['body']);
  $extended = str_replace('your source string', 'your target string, $row['extended']);
  $id = $row['id'];
  mysql_query("UPDATE serendipity_entries SET body = '$body', extended='$extended' WHERE id = '$id'");
}
?>
I hope that helps you at least a bit, and maybe some Ex-Nucleus-User does popup here. My time is limited the next weeks, if that weren't the case I'd offer to look into it...

Regards,
Garvin

Re: Help needed for switching from Nucleus...

Posted: Sat Jan 29, 2005 4:44 pm
by garvinhicking
Okay, because it wasn't such a hard thing after all, I quickly hacked together a Nucelus import utility.

It worked with the version I just downloaded (3.15) properly.

The importer will be part of the Snapshot created tomorrow, I hope you can wait that long :-)

Have fun,
Garvin

Re: Help needed for switching from Nucleus...

Posted: Sat Jan 29, 2005 6:10 pm
by TheMM
Thanks Garvin, that was quite more than I expected from my post.
I will send a detailed migration-report tomorrow... :D

Thank you!
TheMM

Posted: Fri Feb 24, 2006 5:14 am
by Brendon K
As an update, at least with version 3.22, the import feature works almost flawlessly. There are only two problems noticed:

1.) If a commenter does not submit a homepage/website link, their DNS entry (reverse IP) is placed in their instead.

2.) If Convert line breaks is turned ON, I think Nucleus will actually store BR tags internally to the database (only thing I can figure) because there are extra whitespace after importing.

I have yet to take a closer look to see exactly how the database is setup in NucleusCMS to find a way to adapt the importer to work completely flawlessly, but I doubt it would be all that troublesome.

Posted: Fri Feb 24, 2006 2:16 pm
by garvinhicking
Hi Brendon!

The first think should be easily fixable, thanks for noticing.

The convert line breaks seems to only cause a problem because nucleus puts a "<br />\n" into the posts. If your serendipity installation has the nl2br marku plugin installed, it doubles the "\n" into another "<br />\n", so that would be the problem. So in your case I'd suggest to nut turn on that option; it is only needed for people that do not use the nl2br s9y markup plugin.

Best regards,
Garvin

Posted: Fri Feb 24, 2006 4:11 pm
by Brendon K
Ah, but I do plan on using it (NL2BR plugin for Serendipity). Although I technically could either use a WYSIWYG editor, or hard-code the HTML line breaks in manually, I prefer having slightly more control over the code created in my entries, but having to place HTML newlines is in fact, still a chore, so this makes things easier.

I will take a look at the database structure of NucleusCMS. If the "Convert line breaks" option is saved in the database, it should be a pretty simple update to your import function that I can report back to you. If not, then I could hard-code a fix for it, and if you wanted I could also send this back to you as a "NucleusCMS Import Tool, Use with Convert Line Breaks" or something like that...however, having two import scripts for the same blogging tool is a bit overkill in my opinion and there's probably a better way to do it.

As stated, I'll take a look, but I wanted to report back to you about it so you're aware.

Enjoy your weekend! :)

Posted: Fri Feb 24, 2006 4:16 pm
by garvinhicking
Hi!

Of course, a patch would be much apreciated. Since I didn't use Nucleus, I don't know much about it; reversing the <br />\n optionally should be easy then with a config option toggle. The importer plugins allow to easily add new options, if you can look into that...

So, yes - it would be great if you patch a workaround for that :)

Have a nice weekend, and I hope you'll have fun with Serendipity. :-)

Best regards,
Garvin

Posted: Wed Aug 30, 2006 4:44 am
by Brendon K
Hi! When it comes to doing things for myself, I'm extremely slow. Sorry! Actually, had my blog not gotten hacked (probably a dictionary attack -- easy password) I probably wouldn't even be back as soon as I am now. I still haven't completely converted over (wow!).

I checked into this a bit more closely. I think if I were to do this, and get it to work properly, I'd have to study the s9y database schema and ALL functions related to importing. So, basically, I don't think it's personally worth it to me. I exported my SQL backup, removed all the <br /> tags when preceeded by a newline character (thank god for REGEX find/replace), uploaded it back into the database, and then did the import.

Nucleus supports multiple blogs that contain different settings, it's not global. I believe s9y's schema for settings is global for all blog "sections". The import does not distinguish between the differently imported blogs -- so basically, for a "flawless" import, the import would require a complete checkup (not necessarily overhaul as most of the current code works, but needs to be tweaked).

With ALL that being said: It still works. :)

Posted: Wed Aug 30, 2006 12:49 pm
by garvinhicking
Hi!

Better late than never ;)

Serendipity does allow to apply specific formatting to specific entries only; but getting that to map properly is, as you put it, a lot of work. It might be too much work and maybe not really worth that hassle...

But you say that it basically works, so I'm happy with that. :) Hope you have fun with Serendipity!

Best regards,
Garvin

Posted: Thu Aug 31, 2006 8:57 pm
by judebert
Although this DID spark me to consider: shouldn't the NL2BR plugin ignore newlines preceeded by a <BR/>? In fact, if we made it ignore all newlines preceeded by common block-level HTML tags, we'd go a long way to reducing the confusion, wouldn't we?