protected function FeedsNodeProcessor::clean in Feeds 7.2
Overrides FeedsProcessor::clean().
Allow unpublish instead of delete.
Parameters
FeedsState $state: The FeedsState object for the given stage.
Overrides FeedsProcessor::clean
File
- plugins/
FeedsNodeProcessor.inc, line 474 - Class definition of FeedsNodeProcessor.
Class
- FeedsNodeProcessor
- Creates nodes from feed items.
Code
protected function clean(FeedsState $state) {
// Delegate to parent if not unpublishing or option not set.
if (!isset($this->config['update_non_existent']) || $this->config['update_non_existent'] != FEEDS_UNPUBLISH_NON_EXISTENT) {
return parent::clean($state);
}
$total = count($state->removeList);
if ($total) {
$nodes = node_load_multiple($state->removeList);
foreach ($nodes as &$node) {
$this
->loadItemInfo($node);
// Update the hash value of the feed item to ensure that the item gets
// updated in case it reappears in the feed.
$node->feeds_item->hash = $this->config['update_non_existent'];
node_unpublish_action($node);
node_save($node);
$state->unpublished++;
}
}
}