Index: wp-includes/default-filters.php
===================================================================
--- wp-includes/default-filters.php	(revision 5836)
+++ wp-includes/default-filters.php	(working copy)
@@ -190,4 +190,7 @@
 add_action('save_post', '_save_post_hook', 5, 2);
 add_action('transition_post_status', '_transition_post_status', 5, 3);
 
-?>
\ No newline at end of file
+// actions to schedule the update_links call
+add_action('update_links','wp_update_links');
+add_action('update_option_use_linksupdate', 'links_update_change',10,2);
+?>
Index: wp-includes/pluggable.php
===================================================================
--- wp-includes/pluggable.php	(revision 5836)
+++ wp-includes/pluggable.php	(working copy)
@@ -174,7 +174,7 @@
 	if ( empty( $headers ) ) {
 		$headers = array();
 	} elseif ( !is_array( $headers ) ) {
-		// Explode the headers out, so this function can take both 
+		// Explode the headers out, so this function can take both
 		// string headers and an array of headers.
 		$tempheaders = (array) explode( "\n", $headers );
 		$headers = array();
@@ -396,7 +396,7 @@
 	$location = apply_filters('wp_redirect', $location, $status);
 
 	if ( !$location ) // allows the wp_redirect filter to cancel a redirect
-		return false; 
+		return false;
 
 	$location = preg_replace('|[^a-z0-9-~+_.?#=&;,/:%]|i', '', $location);
 	$location = wp_kses_no_null($location);
@@ -548,7 +548,7 @@
 	global $wpdb;
 
 	if( get_option( "moderation_notify" ) == 0 )
-		return true; 
+		return true;
 
 	$comment = $wpdb->get_row("SELECT * FROM $wpdb->comments WHERE comment_ID='$comment_id' LIMIT 1");
 	$post = $wpdb->get_row("SELECT * FROM $wpdb->posts WHERE ID='$comment->comment_post_ID' LIMIT 1");
@@ -653,4 +653,45 @@
 }
 endif;
 
+if ( !function_exists('wp_update_links') ) :
+// the links update function
+function wp_update_links() {
+	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);
+			if ($modtime !== false && $modtime !== -1) { // php 5.1 and up returns false on failure, prev versions return -1
+				$wpdb->query("UPDATE $wpdb->links SET link_updated = FROM_UNIXTIME($modtime) WHERE link_rss = '$rssurl'");
+			}
+		}
+	}
+}
+endif;
+
+if ( !function_exists('wp_links_update_change') ) :
+// the update_links scheduler function
+function wp_links_update_change($oldvalue, $newvalue) {
+
+	if ($oldvalue == $newvalue) return;
+
+	if ($newvalue == 1) {
+		wp_schedule_event(time(), apply_filters('update_links_schedule','daily'), 'update_links');
+	}
+	else {
+		wp_clear_scheduled_hook('update_links');
+	}
+}
+endif;
+
 ?>
