From 788e0c09cf7b27da7ccaa28216a70837f3f9f8c6 Mon Sep 17 00:00:00 2001
From: Chris Leppanen <chris.leppanen@gmail.com>
Date: Wed, 26 Sep 2012 21:02:52 -0700
Subject: [PATCH] Re-organize FeedsProcessor::process() so that it is clearer.

---
 plugins/FeedsProcessor.inc | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/plugins/FeedsProcessor.inc b/plugins/FeedsProcessor.inc
index 98a4c383..add15455 100644
--- a/plugins/FeedsProcessor.inc
+++ b/plugins/FeedsProcessor.inc
@@ -109,15 +109,15 @@ abstract class FeedsProcessor extends FeedsPlugin {
 
       // Check if this item already exists.
       $entity_id = $this->existingEntityId($source, $parser_result);
-      $update = $this->config['update_existing'] != FEEDS_SKIP_EXISTING;
+      $skip_existing = $this->config['update_existing'] == FEEDS_SKIP_EXISTING;
 
       // If it exists, and we are not updating, pass onto the next item.
-      if ($entity_id && !$update) {
+      if ($entity_id && $skip_existing) {
         continue;
       }
 
       $hash = $this->hash($item);
-      $changed = $hash == $this->getHash($entity_id);
+      $changed = ($hash == $this->getHash($entity_id));
       $force_update = $this->config['skip_hash_check'];
 
       // Do not proceed if the item exists, has not changed, and we're not
@@ -128,15 +128,14 @@ abstract class FeedsProcessor extends FeedsPlugin {
 
       try {
 
+        // Build a new entity.
         if (empty($entity_id)) {
-
-          // Build a new entity.
           $entity = $this->newEntity($source);
           $this->newItemInfo($entity, $source->feed_nid, $hash);
         }
-        else {
 
-          // Load an existing entity.
+        // Load an existing entity.
+        else {
           $entity = $this->entityLoad($source, $entity_id);
 
           // The feeds_item table is always updated with the info for the most recently processed entity.
-- 
GitLab