From 1a21835959193698b6c1da8d7df50ffcf371f71b Mon Sep 17 00:00:00 2001 From: Chris Leppanen <chris.leppanen@gmail.com> Date: Fri, 16 Nov 2012 16:27:54 -0800 Subject: [PATCH] Always set is_new on node create rather than node_save(). --- plugins/FeedsNodeProcessor.inc | 5 +---- plugins/FeedsProcessor.inc | 4 ---- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/plugins/FeedsNodeProcessor.inc b/plugins/FeedsNodeProcessor.inc index 108eeefb..b84b6124 100644 --- a/plugins/FeedsNodeProcessor.inc +++ b/plugins/FeedsNodeProcessor.inc @@ -34,6 +34,7 @@ class FeedsNodeProcessor extends FeedsProcessor { $node->changed = REQUEST_TIME; $node->created = REQUEST_TIME; $node->language = LANGUAGE_NONE; + $node->is_new = TRUE; node_object_prepare($node); // Populate properties that are set by node_object_prepare(). $node->log = 'Created by FeedsNodeProcessor'; @@ -112,10 +113,6 @@ class FeedsNodeProcessor extends FeedsProcessor { * Save a node. */ public function entitySave($entity) { - // If nid is set and a node with that id doesn't exist, flag as new. - if (!empty($entity->nid) && !node_load($entity->nid)) { - $entity->is_new = TRUE; - } node_save($entity); } diff --git a/plugins/FeedsProcessor.inc b/plugins/FeedsProcessor.inc index 903fe123..bc503ca7 100755 --- a/plugins/FeedsProcessor.inc +++ b/plugins/FeedsProcessor.inc @@ -137,8 +137,6 @@ abstract class FeedsProcessor extends FeedsPlugin { */ public function process(FeedsSource $source, FeedsParserResult $parser_result) { $state = $source->state(FEEDS_PROCESS); - $entity_info = $this->entityInfo(); - $id_key = $entity_info['entity keys']['id']; while ($item = $parser_result->shiftItem()) { @@ -163,8 +161,6 @@ abstract class FeedsProcessor extends FeedsPlugin { try { - $replace_existing = $this->config['update_existing'] == FEEDS_REPLACE_EXISTING; - // Load an existing entity. if ($entity_id) { $entity = $this->entityLoad($source, $entity_id); -- GitLab