When a node is updated via the node processor, the hash is not updated.

I confirmed this by manually hacking the hash in the table to 'xxx' and then running the import for content that I had purposefully changed at the source. The node updated correctly, but the hash remained 'xxx' in the table.

The implication is that as soon as the source content changes, it will be updated every time it is imported.

I was going to try a patch for this but I was not sure if the call to feeds_item_info_save() should go in the FeedsProcessor.inc or in feeds.module on hook_update.

CommentFileSizeAuthor
#1 1011958-feeds_item-replace.patch1.14 KBDavid Goode
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

David Goode’s picture

Priority: Normal » Critical
Status: Active » Needs work
FileSize
1.14 KB

This is a very good catch, and hints at a slightly larger problem, which is that the feeds_item row for an entity is loaded and not changed when the entity is updated. I'm not totally sure on the best behavior for this, but to me it seems reasonable to replace all the information in this row with the stuff relevant to the most recently downloaded entity, with the exception of updating the id. This would include the hash, as well as the url, guid, date, etc. For instance, if some feed element is identified by some random, unforeseen unique key, it could have a changing GUID and URL but remain the same "record," and it would probably be expected to record the most recent information for the URL, GUID, date, etc in this table. Either way, the fix should go where this patch deals with it, in the FeedsProcessor class. An alternative, minimal change would just be to set
<?PHP
$entity->feeds_item->hash = $hash
?>

David Goode’s picture

Status: Needs work » Needs review

Needs review actually. Please post with your thoughts on this issue if you have an opinion. The current patch might be a reasonable solution.

sime’s picture

I'm still a bit rough with feeds, plugins, etc. I'll run this patch on my dev site and take it from there.

twistor’s picture

Status: Needs review » Reviewed & tested by the community

This works for me. One small thing about your explanation. The URL and GUID do get updated if they're not set as unique. They get set in the call to map(). It would be nice to update the imported time though.

tobby’s picture

Status: Reviewed & tested by the community » Closed (fixed)