From 493ed0f2bae6c8879d1a0cd2714718ac2ece1ae9 Mon Sep 17 00:00:00 2001
From: Alex Barth <alex_b@53995.no-reply.drupal.org>
Date: Fri, 3 Sep 2010 21:08:51 +0000
Subject: [PATCH] #872772 andrewlevine: Fix buildNode() (and node_load())
 called unnecessarily.

---
 CHANGELOG.txt                  | 1 +
 plugins/FeedsNodeProcessor.inc | 4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index 4e2ac0de..72be12ed 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -3,6 +3,7 @@
 Feeds 6.x 1.0 XXXXXXXXXXXXXXXXXX
 --------------------------------
 
+- #872772 andrewlevine: Fix buildNode() (and node_load()) called unnecessarily.
 - #873240 thsutton: Use isset() to avoid notices.
 - #878528 Sutharsan: Don't show file in UI if file does not exist.
 - #901798 alex_b: Fix time off in SitemapParser.
diff --git a/plugins/FeedsNodeProcessor.inc b/plugins/FeedsNodeProcessor.inc
index 567c3554..114dd6bc 100644
--- a/plugins/FeedsNodeProcessor.inc
+++ b/plugins/FeedsNodeProcessor.inc
@@ -35,13 +35,13 @@ class FeedsNodeProcessor extends FeedsProcessor {
 
       // Create/update if item does not exist or update existing is enabled.
       if (!($nid = $this->existingItemId($item, $source)) || ($this->config['update_existing'] != FEEDS_SKIP_EXISTING)) {
-        $node = $this->buildNode($nid, $source->feed_nid);
-
         // Only proceed if item has actually changed.
         $hash = $this->hash($item);
         if (!empty($nid) && $hash == $this->getHash($nid)) {
           continue;
         }
+
+        $node = $this->buildNode($nid, $source->feed_nid);
         $node->feeds_node_item->hash = $hash;
 
         // Map and save node. If errors occur don't stop but report them.
-- 
GitLab