### Eclipse Workspace Patch 1.0
#P simplefeed
Index: simplefeed_item.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/simplefeed/simplefeed_item.module,v
retrieving revision 1.51.2.10
diff -u -r1.51.2.10 simplefeed_item.module
--- simplefeed_item.module	26 Mar 2008 23:39:24 -0000	1.51.2.10
+++ simplefeed_item.module	3 May 2008 19:12:35 -0000
@@ -378,7 +378,8 @@
 
     // unique id for each feed item
     // we don't need serialize() since we already have strings
-    $iid = md5($title . $body);
+    if (!$link = $item->get_permalink()) $link = $feed->get_permalink();
+    $iid = md5($title . $link);
     // make sure we don't already have this feed item
     $duplicate = db_num_rows(db_query("SELECT iid FROM {simplefeed_feed_item} WHERE iid = '%s'", $iid));
 
Index: simplefeed_item.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/simplefeed/simplefeed_item.install,v
retrieving revision 1.9.2.3
diff -u -r1.9.2.3 simplefeed_item.install
--- simplefeed_item.install	21 Feb 2008 20:06:27 -0000	1.9.2.3
+++ simplefeed_item.install	3 May 2008 19:12:35 -0000
@@ -77,4 +77,38 @@
     unset($_SESSION['simplefeed_item_update_1']);
     return array();
   }
+}
+
+function simplefeed_item_update_2() {
+  // How many feed items to process each time.
+  $limit = 50;
+
+  // Set-up multipart update.
+  if (!isset($_SESSION['simplefeed_item_update_2'])) {
+    $_SESSION['simplefeed_item_update_2'] = array(
+      'vid' => 0,
+      'max' => db_result(db_query('SELECT MAX(vid) FROM {simplefeed_feed_item}')),
+      'count' => 0,
+    );
+  }
+  
+  // Fetch up to N feed items and update their iids to new schema
+  $count = $_SESSION['simplefeed_item_update_2']['count'];
+  $feed_items = db_query_range('SELECT r.vid, r.title, s.url FROM {node_revisions} r JOIN {simplefeed_feed_item} s ON r.vid = s.vid ORDER BY r.vid ASC', $count, $limit);
+  while ($feed_item = db_fetch_object($feed_items)) {
+    $iid = md5($feed_item->title . $feed_item->url);
+    db_query("UPDATE {simplefeed_feed_item} SET iid = '%s' WHERE vid = %d", $iid, $feed_item->vid);
+    $_SESSION['simplefeed_item_update_2']['vid'] = $feed_item->vid;    
+  }
+
+  if (db_num_rows($feed_items) == $limit) {
+    $_SESSION['simplefeed_item_update_2']['count'] += $limit;
+    // Return progress (never return 100% here to ensure clean-up is still run last).
+    return array('#finished' => $_SESSION['simplefeed_item_update_2']['vid'] / ($_SESSION['simplefeed_item_update_2']['max'] + 1));
+  }
+  else {
+    // Clean-up.
+    unset($_SESSION['simplefeed_item_update_2']);
+    return array();
+  }
 }
\ No newline at end of file
