minor improvement for inserting comments
Posted: Thu Apr 16, 2009 4:20 pm
I recently created a new s9y blog, with data imported from a LiveJournal account. I ended up writing a custom importer that I hope to share soon (there are still some loose ends to clean up), but the gist is that instead of using the XML files directly from LiveJournal.com I used the XML files generated by jbackup.pl, which is slightly different (and more importantly, includes data about comments).
However, I ran into an issue where I couldn't easily find out the ID of the comment that I'd just inserted, necessary for importing comments in their threaded state. Adding
as line 896 of include/functions_comments.inc.php (the last line of serendipity_insertComment) seems like the correct fix. Anything expecting a TRUE return from that function will get a value that evaluates to truth, and anything wanting the actual comment ID for whatever reason gets it.
As for the jbackup importer, I basically took the existing LJ importer, added support for comments and changed the name of some expected tags to match the output of jbackup. It doesn't yet support importing the mood or tags of entries (which would require checking whether the appropriate plugin is installed first, that's what I'm looking at), and it doesn't handle comments posted by OpenID-authenticated users either (they show up as users named "ext_NNNN").
However, I ran into an issue where I couldn't easily find out the ID of the comment that I'd just inserted, necessary for importing comments in their threaded state. Adding
Code: Select all
return $cid;As for the jbackup importer, I basically took the existing LJ importer, added support for comments and changed the name of some expected tags to match the output of jbackup. It doesn't yet support importing the mood or tags of entries (which would require checking whether the appropriate plugin is installed first, that's what I'm looking at), and it doesn't handle comments posted by OpenID-authenticated users either (they show up as users named "ext_NNNN").