? 753426-8_update_replace.patch
? taxonomy.inc-753426_0.patch
? libraries/PuSHSubscriber
? libraries/simplepie.inc
Index: mappers/content.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/feeds/mappers/content.inc,v
retrieving revision 1.3
diff -u -p -r1.3 content.inc
--- mappers/content.inc	28 Oct 2009 01:08:30 -0000	1.3
+++ mappers/content.inc	29 Mar 2010 02:37:38 -0000
@@ -39,7 +39,7 @@ function content_feeds_node_processor_ta
  */
 function content_feeds_set_target($node, $target, $value) {
 
-  $field = isset($node->$target) ? $node->$target : array();
+  $field = array();
 
   // Handle multiple value fields.
   if (is_array($value)) {
Index: mappers/filefield.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/feeds/mappers/filefield.inc,v
retrieving revision 1.3
diff -u -p -r1.3 filefield.inc
--- mappers/filefield.inc	28 Jan 2010 20:07:08 -0000	1.3
+++ mappers/filefield.inc	29 Mar 2010 02:37:38 -0000
@@ -58,7 +58,7 @@ function filefield_feeds_set_target($nod
   }
 
   // Map enclosures.
-  $items = isset($node->$field_name) ? $node->$field_name : array();
+  $items = array();
   foreach ($enclosures as $enclosure) {
     if ($file = $enclosure->getFile()) {
       $field = content_fields($field_name, $node->type);
Index: mappers/taxonomy.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/feeds/mappers/taxonomy.inc,v
retrieving revision 1.1
diff -u -p -r1.1 taxonomy.inc
--- mappers/taxonomy.inc	5 Dec 2009 01:38:27 -0000	1.1
+++ mappers/taxonomy.inc	29 Mar 2010 02:37:38 -0000
@@ -50,6 +50,15 @@ function taxonomy_feeds_set_target(&$nod
   $vocab_id = (int) str_replace('taxonomy:', '', $key);
   $vocab = taxonomy_vocabulary_load($vocab_id);
 
+  if (isset($node->taxonomy)) {
+    // Remove target vocabulary terms from node before adding new ones
+    foreach ($node->taxonomy as $term) {
+      if ($term->vid == $vocab->vid) {
+        unset($node->taxonomy[$term->tid]);
+      }
+    }
+  }
+
   // Cast a given single string to an array so we can use it.
   if (!is_array($terms)) {
     $terms = array($terms);
Index: plugins/FeedsNodeProcessor.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/feeds/plugins/FeedsNodeProcessor.inc,v
retrieving revision 1.24
diff -u -p -r1.24 FeedsNodeProcessor.inc
--- plugins/FeedsNodeProcessor.inc	23 Feb 2010 22:24:50 -0000	1.24
+++ plugins/FeedsNodeProcessor.inc	29 Mar 2010 02:37:38 -0000
@@ -38,10 +38,17 @@ class FeedsNodeProcessor extends FeedsPr
             continue;
           }
 
-          // If updating populate nid and vid avoiding an expensive node_load().
-          $node->nid = $nid;
-          $node->vid = db_result(db_query('SELECT vid FROM {node} WHERE nid = %d', $nid));
-          $batch->updated++;
+          if ($this->config['update_existing'] == 1) {
+            // Replace existing item nodes
+            $node->nid = $nid;
+            $node->vid = db_result(db_query('SELECT vid FROM {node} WHERE nid = %d', $nid));
+            $batch->replaced++;
+          }
+          else {
+            // Update existing item nodes (slower than replacing them)
+            $node = node_load($nid, NULL, TRUE);
+            $batch->updated++;
+          }
         }
         else {
           $batch->created++;
@@ -81,12 +88,15 @@ class FeedsNodeProcessor extends FeedsPr
 
     // Set messages.
     if ($batch->created) {
-      drupal_set_message(t('Created !number !type nodes.', array('!number' => $batch->created, '!type' => node_get_types('name', $this->config['content_type']))));
+      drupal_set_message(format_plural($batch->created, 'Created one @type node.', 'Created @count @type nodes.', array('@type' => node_get_types('name', $this->config['content_type']))));
     }
-    elseif ($batch->updated) {
-      drupal_set_message(t('Updated !number !type nodes.', array('!number' => $batch->updated, '!type' => node_get_types('name', $this->config['content_type']))));
+    if ($batch->replaced) {
+      drupal_set_message(format_plural($batch->replaced, 'Replaced one @type node.', 'Replaced @count @type nodes.', array('@type' => node_get_types('name', $this->config['content_type']))));
     }
-    else {
+    if ($batch->updated) {
+      drupal_set_message(format_plural($batch->updated, 'Updated one @type node.', 'Updated @count @type nodes.', array('@type' => node_get_types('name', $this->config['content_type']))));
+    }
+    if (!$batch->created && !$batch->replaced && !$batch->updated) {
       drupal_set_message(t('There is no new content.'));
     }
 
@@ -183,9 +193,14 @@ class FeedsNodeProcessor extends FeedsPr
       '#default_value' => $this->config['content_type'],
     );
     $form['update_existing'] = array(
-      '#type' => 'checkbox',
+      '#type' => 'radios',
       '#title' => t('Update existing items'),
-      '#description' => t('Check if existing items should be updated from the feed.'),
+      '#description' => t('Choose how existing items should be updated from the feed.'),
+      '#options' => array(
+        0 => 'Do not update existing item nodes',
+        1 => 'Replace existing item nodes',
+        2 => 'Update existing item nodes (slower than replacing them)',
+      ),
       '#default_value' => $this->config['update_existing'],
     );
     $period = drupal_map_assoc(array(FEEDS_EXPIRE_NEVER, 3600, 10800, 21600, 43200, 86400, 259200, 604800, 604800 * 4, 604800 * 12, 604800 * 24, 31536000), 'feeds_format_expire');
