[wp-trac] [WordPress Trac] #4231: Change update-links to use RSS feeds instead of pingomatic

WordPress Trac wp-trac at lists.automattic.com
Mon May 7 17:13:49 GMT 2007


#4231: Change update-links to use RSS feeds instead of pingomatic
--------------------------+-------------------------------------------------
 Reporter:  Otto42        |       Owner:  anonymous
     Type:  enhancement   |      Status:  new      
 Priority:  low           |   Milestone:  2.4      
Component:  Optimization  |     Version:           
 Severity:  normal        |    Keywords:           
--------------------------+-------------------------------------------------
 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.

-- 
Ticket URL: <http://trac.wordpress.org/ticket/4231>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list