Ticket #4231 (new enhancement)

Opened 2 years ago

Last modified 10 months ago

Change update-links to use RSS feeds instead of pingomatic

Reported by: Otto42 Assigned to: anonymous
Priority: low Milestone: 2.9
Component: Optimization Version: 2.3
Severity: normal Keywords: has-patch
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

4231.diff (2.9 kB) - added by Otto42 on 08/01/07 20:31:41.
Patch for #4230 AND #4231

Change History

08/01/07 20:31:41 changed by Otto42

  • attachment 4231.diff added.

Patch for #4230 AND #4231

08/01/07 20:33:32 changed by Otto42

  • keywords set to has-patch.
  • version set to 2.3.
  • milestone changed from 2.4 (future) to 2.3 (trunk).

Attached patch for #4230 and #4231 (combined patch for both, since they sorta relate). #4230 already has patch attached to it for just that issue (linking updated-links functionality to wp-cron), this does that but also changes update_links to use rss feeds instead of pingomatic.

09/06/07 23:39:56 changed by Nazgul

  • milestone changed from 2.3 to 2.4 (next).

03/19/08 03:41:13 changed by ffemtcj

  • milestone changed from 2.5 to 2.6.