? 608844-11_data_delete_with_nodes.patch ? 608844_10.patch ? libraries/simplepie.inc Index: feeds.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/feeds/feeds.module,v retrieving revision 1.55.2.2 diff -u -p -r1.55.2.2 feeds.module --- feeds.module 26 Sep 2010 17:39:45 -0000 1.55.2.2 +++ feeds.module 28 Oct 2010 19:55:32 -0000 @@ -385,8 +385,12 @@ function feeds_nodeapi(&$node, $op, $for $node_feeds = NULL; break; case 'delete': + $source = feeds_source($importer_id, $node->nid); + if ($source->importer->processor->config['delete_with_source']) { + feeds_batch_set(t('Deleting'), 'clear', $importer_id, $node->nid); + } // Remove attached source. - feeds_source($importer_id, $node->nid)->delete(); + $source->delete(); break; } } Index: plugins/FeedsDataProcessor.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/feeds/plugins/Attic/FeedsDataProcessor.inc,v retrieving revision 1.24.2.1 diff -u -p -r1.24.2.1 FeedsDataProcessor.inc --- plugins/FeedsDataProcessor.inc 21 Sep 2010 13:28:53 -0000 1.24.2.1 +++ plugins/FeedsDataProcessor.inc 28 Oct 2010 19:55:32 -0000 @@ -235,6 +235,7 @@ class FeedsDataProcessor extends FeedsPr 'update_existing' => FEEDS_SKIP_EXISTING, 'expire' => FEEDS_EXPIRE_NEVER, // Don't expire items by default. 'mappings' => array(), + 'delete_with_source' => FALSE, ); } @@ -256,6 +257,13 @@ class FeedsDataProcessor extends FeedsPr '#description' => t('If an existing record is found for an imported record, replace it. Existing records will be determined using mappings that are a "unique target".'), '#default_value' => $this->config['update_existing'], ); + $form['delete_with_source'] = array( + '#type' => 'checkbox', + '#title' => t('Delete items with source'), + '#description' => t('If enabled, any feed items associated with a source node will removed along with the node. Not available for standalone importers.'), + '#default_value' => $this->config['delete_with_source'], + '#disabled' => empty(feeds_importer($this->id)->config['content_type']) ? TRUE : FALSE, + ); return $form; } Index: tests/feeds_processor_data.test =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/feeds/tests/Attic/feeds_processor_data.test,v retrieving revision 1.2 diff -u -p -r1.2 feeds_processor_data.test --- tests/feeds_processor_data.test 15 Sep 2010 19:27:42 -0000 1.2 +++ tests/feeds_processor_data.test 28 Oct 2010 19:55:32 -0000 @@ -108,6 +108,7 @@ class FeedsRSStoDataTest extends FeedsWe array( 'administer data tables', 'administer feeds', + 'administer nodes', ) ) ); @@ -163,6 +164,15 @@ class FeedsRSStoDataTest extends FeedsWe $count = db_result(db_query("SELECT COUNT(*) FROM {feeds_data_rss}")); $this->assertEqual($count, 10, 'Accurate number of items in database.'); + // Test 'Delete items with source' setting. + $this->setSettings('rss', 'FeedsDataProcessor', array('delete_with_source' => 1)); + $this->drupalPost('node/'. $nid .'/delete', array(), 'Delete'); + $this->assertText('Page Development Seed - Technological Solutions for Progressive Organizations has been deleted.'); + + // Assert DB status. + $count = db_result(db_query("SELECT COUNT(*) FROM {feeds_data_rss}")); + $this->assertEqual($count, 0, 'Accurate number of items in database.'); + // @todo Standalone import form testing. // @todo Create a second feed and test. }