WordPress.org

Ready to get started?Download WordPress

Forums

Disqus Comment System
Posts containing CDATA break WXR/Disqus exports (db -> Disqus), p (4 posts)

  1. archon810
    Member
    Posted 2 years ago #

    Tyler, this is from our email correspondence, but I don't want it to get lost. I had a lot of trouble due to this issue, so I would like to see it fixed in the code.

    Some WXR exports which I believe Disqus uses to sync existing comments back to Disqus are broken and don't validate due to incorrectly escaped CDATA tags (that is, if your post content contains CDATA tags). For example, we have a few posts with Rafflecopter widgets (for giveaways), and those widgets have CDATA tags already, which breaks the WXR.

    See http://core.trac.wordpress.org/ticket/15203. It's fixed in the next revision of WP (3.4), but right now XML isn't valid.

    So, I took the fix from there and applied it manually in my WP's core export.php - it's just a 1 line change (http://core.trac.wordpress.org/changeset/19858). Check this out - the 284MB dump validated after this! So this fix is absolutely necessary for everything to parse.

    I then looked at your code and found that rather than using core export functions, the Disqus plugin uses a modified copy, made from WP 2.8. Specifically, the patch needs to be applied to dsq_export_wxr_cdata() - otherwise the patch made to WP won't have any effect.

    I don't know why you guys are copying core functions straight up like that, but it opens you up to bugs if you don't follow commits to the same functionality in the core. I'm not sure whether the team followed updates since 2.8. I'm going to make this change on my end manually, but this should be committed to the plugin.

    It's worth noting that at the top of export.php in Disqus, we have define('WXR_VERSION', '1.0'); while the core one is now at 1.2.

    http://wordpress.org/extend/plugins/disqus-comment-system/

  2. Disqus Community Support
    Member
    Posted 2 years ago #

    Brilliant find. Thanks Artem.

    Would you prefer adding this code change as a pull request yourself? Otherwise I'd be happy to add it in as a manual hack until 3.4 comes out (and until everyone upgrades to it).

    A bit of background, to your original point: we forked the export functions because we customize the WXR format a bit (e.g., we add a <dsq:thread_identifier> field).

    Thanks,

    Tyler

  3. archon810
    Member
    Posted 2 years ago #

    Hi Tyler, I was looking at pull requests earlier today actually and while I have a github account, I never actually dealt with pull requests before, and it wasn't immediately obvious how to create one. I do want to figure it out though, so let me try to submit one for you.

    As for the fork, I saw that some functions were exactly the same, including the one that got patched by WP, so the way I would have done it is only clone the necessary functions that you changed. Although it does make it safer if WP touches one of the functions that you call, it really isn't any different than relying on using any other core functions - anything can change. As I said, I'm not sure Disqus is following all changes to the original export.php, so by cloning only the functions you need would have netted you not having to do anything at all here.

    Alternatively, maybe not forking at all and using filters instead would have been even better and cleaner.

  4. archon810
    Member
    Posted 2 years ago #

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic