WordPress.org

Make WordPress Core

Opened 8 years ago

Closed 7 years ago

Last modified 7 years ago

#2864 closed enhancement (invalid)

Magpie falling behind feed developments

Reported by: skeltoac Owned by: link92
Milestone: Priority: normal
Severity: normal Version: 2.0.3
Component: Optimization Keywords: magpie rss atom rdf xml bg|has-patch bg|needs-testing
Focuses: Cc:

Description

MagpieRSS doesn't know how to handle new elements in XML. It doesn't understand Atom 1.0 or RSS 2.0 very well. It is lossy. It doesn't use wp_object_cache. It needs an update.

Rather than tweak Magpie to handle each new thing that comes along, I've put together an XML parser that handles Atom, RSS and RDF feeds and provides an way to add support for new kinds of XML elements. It has default logic to handle any XML data in a feed and can be extended via plugins to add logic for handling special elements. It uses wp_object_cache whenever possible; otherwise it falls back on the database.

fetch_rss is emulated very well and much extra data is available in the array returned but some elements, such as Atom elements with both attributes and inner text, may lose some of their meaning. It may be best to start using a lossless format or tweak the array so that attributes are always preserved.

This code is in use on wordpress.com right now. It needs scrutiny and testing on other platforms as well.

Attachments (4)

rss.php (32.9 KB) - added by skeltoac 8 years ago.
rss.2.php (1.5 KB) - added by link92 8 years ago.
SimplePie-clad wp-includes/rss.php
simplepie.patch (3.6 KB) - added by link92 8 years ago.
rss.3.php (1.5 KB) - added by link92 8 years ago.
Fix breach of WP coding standards in rss.2.php

Download all attachments as: .zip

Change History (16)

comment:1 skeltoac8 years ago

New rss.php uploaded.

Incutio's HTTP client need not be used, but it does an efficient job and allows us to handle HTTP codes >200 ourselves. For instance, we can cache redirects. Proposals welcome.

skeltoac8 years ago

comment:2 filosofo8 years ago

In magpie, the object member 'summary' held the value of whatever was between 'description' or 'content' tags. How about including that feature in your parser, for backwards-compatibility?

comment:3 link928 years ago

Just quickly skimming through the code, I think I can see some pretty major shortcomings within the parser. Atom 1.0 has got a "type" attribute(and Atom 0.3 has "mode"), which must be used to format the data correctly (eg. decoding entities).

I personally am one of the two developers of SimplePie, another PHP feed parser, and I may well try and hack it into WP sometime before term starts (22nd Aug). Catch me on IRC sometime (I'm gsnedders, this is just a nick I used a while ago).

link928 years ago

SimplePie-clad wp-includes/rss.php

link928 years ago

comment:4 link928 years ago

I've attached two files: a new rss.php, and simplepie.patch (which patches wp-admin/index.php, due to the completely different syntax). It assumes there's simplepie.inc in wp-includes, and that needs to be a recent SVN copy, due to it using some features that aren't in the latest release. It's very stable at the moment (it's actually massively less buggy than the latest "stable" release), and probably won't break for quite a while. So, till SP 1.0 Beta 3 is out, just grab the SVN copy.

One of the things about this, and should be obvious from the fact I'm not including simplepie.inc here, is that we now don't need any modifications to the feed parser itself, undoubtedly easier from a maintenance point of view.

comment:5 link928 years ago

  • Keywords bg|has-patch bg|needs-testing added

link928 years ago

Fix breach of WP coding standards in rss.2.php

comment:6 link928 years ago

  • Owner changed from skeltoac to link92
  • Status changed from new to assigned

comment:7 markjaquith8 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

(In [4378]) The changing of the pies. Now using SimplePie. props to gsnedders. fixes #2864

comment:8 matt8 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

This is entirely unacceptable.

We just broke everything that uses our RSS libraries in the world. If simplepie can't maintain the same external functions, like fetch_rss and the old object structure, then we shouldn't use it. Nothing in WP should have changed except the library.

Also, the dashboard is now loading entire posts rather than descriptions.

comment:9 markjaquith8 years ago

Have reverted back, for now.

Will consider patches with full backwards compat.

comment:10 matt7 years ago

  • Milestone changed from 2.1 to 2.2

comment:11 matt7 years ago

  • Resolution set to invalid
  • Status changed from reopened to closed

Closing awaiting new patches.

comment:12 foolswisdom7 years ago

  • Milestone 2.2 deleted
Note: See TracTickets for help on using tickets.