From b529ed3bc7c12ceba34c07996d56212d412492dc Mon Sep 17 00:00:00 2001 From: Alex Barth <alex_b@53995.no-reply.drupal.org> Date: Tue, 23 Mar 2010 13:22:03 +0000 Subject: [PATCH] #648080 pvhee: FeedsNodeProcessor - static caching of mapping targets makes mapping fail with multiple feed configurations. --- CHANGELOG.txt | 2 ++ plugins/FeedsProcessor.inc | 8 ++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 143ff875..3744d693 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -4,6 +4,8 @@ Feeds 6.x 1.0 xxxxx xx, 2010-xx-xx ---------------------------------- +- #648080 pvhee: FeedsNodeProcessor - static caching of mapping targets makes + mapping fail with multiple feed configurations. - #735444 Doug Preble: PubSubHubbub - Fix "Subscription refused by callback URL" with PHP 5.2.0. - alex_b: Suppress namespace warnings when parsing feeds for subscription in diff --git a/plugins/FeedsProcessor.inc b/plugins/FeedsProcessor.inc index 71a591d1..a95d074d 100644 --- a/plugins/FeedsProcessor.inc +++ b/plugins/FeedsProcessor.inc @@ -84,8 +84,8 @@ abstract class FeedsProcessor extends FeedsPlugin { // Static cache $targets as getMappingTargets() may be an expensive method. static $targets; - if (empty($targets)) { - $targets = $this->getMappingTargets(); + if (!isset($targets[$this->id])) { + $targets[$this->id] = $this->getMappingTargets(); } $parser = feeds_importer($this->id)->parser; if (empty($target_item)) { @@ -104,8 +104,8 @@ abstract class FeedsProcessor extends FeedsPlugin { foreach ($this->config['mappings'] as $mapping) { $value = $parser->getSourceElement($source_item, $mapping['source']); - if (is_array($targets[$mapping['target']]) && isset($targets[$mapping['target']]['callback']) && function_exists($targets[$mapping['target']]['callback'])) { - $callback = $targets[$mapping['target']]['callback']; + if (is_array($targets[$this->id][$mapping['target']]) && isset($targets[$this->id][$mapping['target']]['callback']) && function_exists($targets[$this->id][$mapping['target']]['callback'])) { + $callback = $targets[$this->id][$mapping['target']]['callback']; $callback($target_item, $mapping['target'], $value); } else { -- GitLab