Opened 17 years ago
Closed 15 years ago
#4231 closed enhancement (wontfix)
Change update-links to use RSS feeds instead of pingomatic
Reported by: | Otto42 | Owned by: | |
---|---|---|---|
Milestone: | Priority: | low | |
Severity: | normal | Version: | 2.3 |
Component: | Cron API | Keywords: | needs-patch |
Focuses: | Cc: |
Description
pingomatic appears to not be working at the moment for the updated-batch function. But having these checks centralized in the first place is a bit silly, IMO. Why not have each blog check its own links? There's a space in the links for an RSS feed. While people probably don't fill it in, if they did, you could easily pull the RSS feed and check the last modified header. Just like so:
require_once( dirname( dirname(__FILE__) ) . '/wp-config.php'); require_once( ABSPATH . 'wp-includes/class-snoopy.php'); require_once( ABSPATH . 'wp-includes/rss.php'); if ( !get_option('use_linksupdate') ) wp_die(__('Feature disabled.')); $link_rsses = $wpdb->get_col("SELECT link_rss FROM $wpdb->links"); if ( !$link_rsses ) wp_die(__('No links')); foreach ($link_rsses as $rssurl) { $feed = fetch_rss($rssurl); $mod = $feed->last_modified; if ($mod != null) { $modtime = strtotime($mod); $wpdb->query("UPDATE $wpdb->links SET link_updated = FROM_UNIXTIME($modtime) WHERE link_rss = '$rssurl'"); } }
This uses the built in Magpie reader and checks the Last Modified http header that it finds/returns. Doesn't work with every RSS feed, but it does with all major blog feeds. And for those links without RSS feeds, they just don't get checked at all. No strain of pingomatic, no dependency on a centralized server.
Attachments (1)
Change History (6)
Note: See
TracTickets for help on using
tickets.
Patch for #4230 AND #4231