From fd7102aff649eae76f76e252bc215d44708cf382 Mon Sep 17 00:00:00 2001
From: Alex Barth <alex_b@53995.no-reply.drupal.org>
Date: Sun, 16 May 2010 21:51:58 +0000
Subject: [PATCH] #791296 B-Prod: Fix Feeds data processor does update id 0.

---
 CHANGELOG.txt                  | 1 +
 plugins/FeedsDataProcessor.inc | 8 +++++---
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index b90a628b..f93cc7f9 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -3,6 +3,7 @@
 Feeds 6.x 1.0 xxxxxxxxxxxxxxxxxxxx
 ----------------------------------
 
+- #791296 B-Prod: Fix Feeds data processor does update id 0.
 - #759904 lyricnz: Provide a Google Sitemap Parser.
 - #774858 rjbrown99: Fix Node Processor updates node "created" time when
   updating.
diff --git a/plugins/FeedsDataProcessor.inc b/plugins/FeedsDataProcessor.inc
index ddc03860..875c3152 100644
--- a/plugins/FeedsDataProcessor.inc
+++ b/plugins/FeedsDataProcessor.inc
@@ -21,7 +21,9 @@ class FeedsDataProcessor extends FeedsProcessor {
     $expiry_time = $this->expiryTime();
 
     while ($item = $batch->shiftItem()) {
-      if (!($id = $this->existingItemId($item, $source)) || $this->config['update_existing']) {
+      $id = $this->existingItemId($item, $source);
+
+      if ($id === FALSE || $this->config['update_existing']) {
         // Map item to a data record, feed_nid and timestamp are mandatory.
         $data = array();
         $data['feed_nid'] = $source->feed_nid;
@@ -34,7 +36,7 @@ class FeedsDataProcessor extends FeedsProcessor {
         }
 
         // Save data.
-        if ($id) {
+        if ($id !== FALSE) {
           $data['id'] = $id;
           $this->handler()->update($data, 'id');
           $updated++;
@@ -242,7 +244,7 @@ class FeedsDataProcessor extends FeedsProcessor {
         return $records[0]['id'];
       }
     }
-    return 0;
+    return FALSE;
   }
 
   /**
-- 
GitLab