? 753426_19.patch
? plugins/.FeedsNodeProcessor.inc.rej.swp
Index: feeds.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/feeds/feeds.install,v
retrieving revision 1.7
diff -u -r1.7 feeds.install
--- feeds.install	23 Feb 2010 04:59:06 -0000	1.7
+++ feeds.install	15 Jun 2010 18:59:52 -0000
@@ -178,7 +178,7 @@
         'description' => t('The hash of the item.'),
       ),
     ),
-    'primary key' => array('nid'),
+    'primary key' => array('nid', 'id', 'feed_nid'),
     'indexes' => array(
       'id' => array('id'),
       'feed_nid' => array('feed_nid'),
@@ -492,3 +492,14 @@
   db_create_table($ret, 'feeds_push_subscriptions', $table);
   return $ret;
 }
+
+/**
+ * Change the primary key of {feeds_node_item} from nid to nid, id, feed_nid
+ * to support multiple feeds updating a node.
+ */
+function feeds_update_6010() {
+  $ret = array();
+  db_drop_primary_key($ret, 'feeds_node_item');
+  db_add_primary_key($ret, 'feeds_node_item', array('nid', 'id', 'feed_nid'));
+  return $ret;
+}
\ No newline at end of file
Index: feeds.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/feeds/feeds.module,v
retrieving revision 1.46
diff -u -r1.46 feeds.module
--- feeds.module	16 May 2010 20:59:13 -0000	1.46
+++ feeds.module	15 Jun 2010 18:59:52 -0000
@@ -328,7 +328,7 @@
 function _feeds_nodeapi_node_processor($node, $op) {
   switch ($op) {
     case 'load':
-      if ($result = db_fetch_object(db_query("SELECT imported, guid, url, feed_nid FROM {feeds_node_item} WHERE nid = %d", $node->nid))) {
+      if (isset($node->feeds_node_item) && ($result = db_fetch_object(db_query("SELECT imported, guid, url, feed_nid FROM {feeds_node_item} WHERE nid = %d AND feed_nid = %d AND id = '%s'", $node->nid, $node->feeds_node_item->feed_nid, $node->feeds_node_item->id)))) {
         $node->feeds_node_item = $result;
       }
       break;
@@ -341,7 +341,7 @@
     case 'update':
       if (isset($node->feeds_node_item)) {
         $node->feeds_node_item->nid = $node->nid;
-        drupal_write_record('feeds_node_item', $node->feeds_node_item, 'nid');
+        drupal_write_record('feeds_node_item', $node->feeds_node_item, array('nid', 'feed_nid', 'id'));
       }
       break;
     case 'delete':
Index: plugins/FeedsNodeProcessor.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/feeds/plugins/FeedsNodeProcessor.inc,v
retrieving revision 1.34
diff -u -r1.34 FeedsNodeProcessor.inc
--- plugins/FeedsNodeProcessor.inc	16 May 2010 21:24:50 -0000	1.34
+++ plugins/FeedsNodeProcessor.inc	15 Jun 2010 18:59:52 -0000
@@ -33,7 +33,7 @@
         // If updating check whether item actually has changed and if so,
         // retrieve its nid and vid.
         if (!empty($nid)) {
-          if ($hash == $this->getHash($nid)) {
+          if ($hash == $this->getHash($nid, $source->feed_nid)) {
             continue;
           }
           $node->nid = $nid;
@@ -325,11 +325,11 @@
   }
 
   /**
-   * Retrieve MD5 hash of $nid from DB.
+   * Retrieve MD5 hash of the imported feed item from DB.
    * @return Empty string if no item is found, hash otherwise.
    */
-  protected function getHash($nid) {
-    $hash = db_result(db_query("SELECT hash FROM {feeds_node_item} WHERE nid = %d", $nid));
+  protected function getHash($nid, $feed_nid) {
+    $hash = db_result(db_query("SELECT hash FROM {feeds_node_item} WHERE nid = %d AND feed_nid = %d AND id = '%s'", $nid, $feed_nid, $this->id));
     if ($hash) {
       // Return with the hash.
       return $hash;
