From 1065324baaa9bad10a0e65e8a460c7b3d962085a Mon Sep 17 00:00:00 2001 From: ekes <ekes@10083.no-reply.drupal.org> Date: Thu, 4 Sep 2014 11:36:30 -0700 Subject: [PATCH] Issue #2328605 by ekes, twistor: Fixed Unique item checking: FeedsProcessor::existingEntityId(). --- plugins/FeedsProcessor.inc | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/plugins/FeedsProcessor.inc b/plugins/FeedsProcessor.inc index 3c37872e..1c56f624 100755 --- a/plugins/FeedsProcessor.inc +++ b/plugins/FeedsProcessor.inc @@ -850,12 +850,6 @@ abstract class FeedsProcessor extends FeedsPlugin { * The serial id of an entity if found, 0 otherwise. */ protected function existingEntityId(FeedsSource $source, FeedsParserResult $result) { - $query = db_select('feeds_item') - ->fields('feeds_item', array('entity_id')) - ->condition('feed_nid', $source->feed_nid) - ->condition('entity_type', $this->entityType()) - ->condition('id', $source->id); - $targets = &drupal_static('FeedsProcessor::existingEntityId', array()); if (!isset($targets[$this->id])) { $targets[$this->id] = $this->getMappingTargets(); @@ -867,7 +861,14 @@ abstract class FeedsProcessor extends FeedsPlugin { // the database. foreach ($this->uniqueTargets($source, $result) as $target => $value) { if ($target === 'guid' || $target === 'url') { - $entity_id = $query->condition($target, $value)->execute()->fetchField(); + $entity_id = db_select('feeds_item') + ->fields('feeds_item', array('entity_id')) + ->condition('feed_nid', $source->feed_nid) + ->condition('entity_type', $this->entityType()) + ->condition('id', $source->id) + ->condition($target, $value) + ->execute() + ->fetchField(); } if (!$entity_id && !empty($targets[$this->id][$target]['unique_callbacks'])) { -- GitLab