Index: feeds.install =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/feeds/feeds.install,v retrieving revision 1.13.2.1 diff -r1.13.2.1 feeds.install 132a133,138 > 'touched' => array( > 'type' => 'int', > 'not null' => TRUE, > 'default' => 0, > 'description' => t('Mark when a feed item has last been touched, even if not updated.'), > ), 569a576,592 > > /** > * Add touched column to feeds_node_item. > */ > function feeds_update_60014() { > $ret = array(); > > $spec = array( > 'type' => 'int', > 'not null' => TRUE, > 'default' => 0, > 'description' => t('Mark when a feed item has last been touched, even if not updated.'), > ); > > db_add_field($ret, 'feeds_node_item', 'touched', $spec); > return $ret; > } \ No newline at end of file Index: includes/FeedsBatch.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/feeds/includes/FeedsBatch.inc,v retrieving revision 1.15.2.1 diff -r1.15.2.1 FeedsBatch.inc 152a153,154 > public $unpublished; > public $deleted; Index: plugins/FeedsNodeProcessor.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/feeds/plugins/FeedsNodeProcessor.inc,v retrieving revision 1.51.2.2 diff -r1.51.2.2 FeedsNodeProcessor.inc 17a18,21 > define('FEEDS_SYNC_REMOVED_IGNORE', 0); > define('FEEDS_SYNC_REMOVED_UNPUBLISH', 1); > define('FEEDS_SYNC_REMOVED_DELETE', 3); > 34a39,40 > // TODO: There might be an existing indicator of when batch processing started? > if (!isset($batch_started)) $batch_started = FEEDS_REQUEST_TIME; 40a47,55 > // To be able to take action on items that have been removed, just indicate that this was still in the feed. > db_query("UPDATE {feeds_node_item} SET touched = %d WHERE nid = %d", FEEDS_REQUEST_TIME, $nid); > > // If this item was previously removed, but has now appeared again, make sure the corresponding node is published. > // TODO: There probably should be a message here for what just happened. > if ($this->config['sync'] != FEEDS_SYNC_REMOVED_IGNORE) { > db_query("UPDATE {node} SET status = 1 WHERE nid = %d", $nid); > } > 70a86,90 > // Handle nodes whose corresponding feed items have been removed. > if ($this->config['sync'] != FEEDS_SYNC_REMOVED_IGNORE) { > $this->syncNodes($batch, $source, $batch_started); > } > 71a92 > $modified = FALSE; 73a95 > $modified = TRUE; 75c97 < elseif ($batch->updated) { --- > if ($batch->updated) { 76a99 > $modified = TRUE; 78,79c101,110 < else { < drupal_set_message(t('There is no new content.')); --- > if ($batch->unpublished) { > drupal_set_message(format_plural($batch->unpublished, 'Unpublished @number @type node.', 'Unpublished @number @type nodes.', array('@number' => $batch->unpublished, '@type' => node_get_types('name', $this->config['content_type'])))); > $modified = TRUE; > } > if ($batch->deleted) { > drupal_set_message(format_plural($batch->deleted, 'Deleted @number @type node.', 'Deleted @number @type nodes.', array('@number' => $batch->deleted, '@type' => node_get_types('name', $this->config['content_type'])))); > $modified = TRUE; > } > if (!$modified) { > drupal_set_message(t('There have been no content changes.')); 140a172,193 > * Keep nodes in sync with feed items. > */ > public function syncNodes($batch, $source, $batch_started) { > $sql = "SELECT n.nid FROM {feeds_node_item} fni LEFT JOIN {node} n ON fni.nid = n.nid WHERE fni.feed_nid = %d AND fni.touched < %d"; > $result = db_query($sql, $source->feed_nid, $batch_started); > > while($node = db_fetch_object($result)) { > if ($this->config['sync'] == FEEDS_SYNC_REMOVED_UNPUBLISH) { > $node = node_load(array('nid' => $node->nid)); > $node->status = 0; > $node->log = 'Unpublished by FeedsNodeProcessor - '. format_date(time()); > node_save($node); > $batch->unpublished++; > } > elseif ($this->config['sync'] == FEEDS_SYNC_REMOVED_DELETE) { > node_delete($node->nid); > $batch->deleted++; > } > } > } > > /** 152a206 > 'sync' => FEEDS_SYNC_REMOVED_IGNORE, 207a262,272 > $form['sync'] = array( > '#type' => 'radios', > '#title' => t('Keep nodes and feed items in sync'), > '#description' => t('Select how nodes corresponding to removed feed items should be handled. This applies if you want to only display nodes that map to items currently in the feed.'), > '#options' => array( > FEEDS_SYNC_REMOVED_IGNORE => 'Do nothing', > FEEDS_SYNC_REMOVED_UNPUBLISH => 'Unpublish the node', > FEEDS_SYNC_REMOVED_DELETE => 'Delete the node', > ), > '#default_value' => $this->config['sync'], > ); 353a419 > $node->status = 1; 360a427 > $node->feeds_node_item->touched = FEEDS_REQUEST_TIME;