Right now, feeds does not delete feed items when a feed node is deleted. Optionally, this should be possible.

Here are some challenges for this feature:

- Deleting feed items when deleting feed nodes only makes sense when a configuration is attached to a content type. This can be solved by hiding the option if the config is not attached.
- Will require a processor specific nodeapi() implementation. Right now we evade building nodeapi() infrastructure in FeedsImporter + FeedsPlugins for one exception with _feeds_nodeapi_node_processor(). An additional processor specific nodeapi function will be too much.


funkmasterjones’s picture

Version:» 6.x-1.x-dev

in feeds.module, feeds_nodeapi(), add a call to clear() before deleting source

case 'delete':
        // Remove feed from scheduler and delete source.
        feeds_scheduler()->remove($importer_id, 'import', $node->nid);
        feeds_source($importer_id, $node->nid)->clear();
        feeds_source($importer_id, $node->nid)->delete();

doesn't this accomplish what you want? The challenges you list above I don't quite understand them, are they no longer a problem with the newer feeds version?

this does however force deleting of all items without giving the user and option. This behavior may not be desired (although I can't imagine when), but it is really useful when building and testing feeds.

alex_b’s picture

I do think we should offer the site builder a choice on whether to delete the items imported from a feed (source) or not when deleting the feed node.

srobert72’s picture


jvieille’s picture

Any update on this? Deleting a feed often means we no longer wants news from it, so there must be an option to proceed with items deletion when deleting the feed.

yeeloon’s picture


Has this been fixed? I'm still encountering the feed items being imported, although the feed has been deleted for some time. Is there a solution to fix this?

alex_b’s picture

#5: this issue is about deleting feed items when a feed subscription is deleted, you are reporting sth different, care to open a new issue? I have a hunch that there may be even an existing one, please do a quick search - thanks!

Dane Powell’s picture

I'd love to see this implemented in some form - I'm spending a lot of time writing custom queries to clean up "zombie" feed items that get left behind when users delete parent feed nodes without deleting all of the child feed items first.

The way I envision it, feed items should always be deleted when the parent feed node is deleted. If someone just wants to stop importing new items, there should be an option to disable the feed without deleting it. But a feed item should never exist without a parent feed- that's like a comment existing without a parent node.

Just my humble opinion.

budda’s picture

Category:task» feature

I like Dane #7 idea that all feed items should ALWAYS have a feed node parent. Makes the logic easier to implement so that deleting a feed node deletes all its items.

twistor’s picture

Status:Active» Needs review
new2.07 KB

Needed this myself. The wording could probably use some work on the form item. I currently have the option disabled when the importer isn't bound to a node, but it's trivial to hide it as well.

Will White’s picture

new3.7 KB

Here's my latest patch from #954814: Automatically delete feed items when feed node is deleted.. This adds tests.

alex_b’s picture

Status:Needs review» Reviewed & tested by the community
new3.71 KB

Will's patch introduces delete items with node for data processor. This patch is RTBC as it includes a test.

Minor adjustments:

- Use feeds_batch_set() to delete items in anticipation of supporting this feature for the node processor.
- Remove debug output from tests.

Will commit shortly.

alex_b’s picture

Status:Reviewed & tested by the community» Needs work

#11 is committed now. Thank you.


#9 / twistor: This is what's needed to get the equivalent feature for node processor RTBC:

- Implement equivalent "delete_with_source" option in FeedsNodeProcessor (ie. copy code from #11 data processor to node).
- Add tests - this test should force batching by using tests/feeds/many_items.rss2

The nodeapi implementation should work for both processors.

twistor’s picture

Status:Needs work» Needs review
new4.18 KB

Check and check.

Laurent_’s picture

Hi Twistor,

Is there any reason for your (#13) to disable the delete checkbox in case of a standalone form ?



twistor’s picture

@Laurent_, In the case of the standalone form, there is no feed node to delete. The option could be hidden completely, if that's what you mean, but this makes more sense to me. I think though, that you mean for an option that deletes feed items when the importer is deleted, that would be a separate issue.

Dane Powell’s picture

Status:Needs review» Needs work

That patch will need to be re-rolled WRT the latest Git head

twistor’s picture

Status:Needs work» Needs review
new2.71 KB
Dane Powell’s picture

Status:Needs review» Reviewed & tested by the community

Cool, #17 seems to get the job done.

rashad612’s picture

Status:Reviewed & tested by the community» Patch (to be ported)

Is there any other solution to do this in Feeds 7.x-2.x ?

Mohammed J. Razem’s picture

Version:6.x-1.x-dev» 7.x-2.x-dev
Status:Patch (to be ported)» Needs review
new2.09 KB

Here's a port to 7.x-2.x

We need this in our project and would love to see this rolled out in alpha-5 release.

twistor’s picture

Status:Needs review» Needs work
Issue tags:+Needs tests

This needs a test to get in.

anou’s picture

Issue summary:View changes

I had to apply this patch (from #20) manually, but I must say that it works. I don't know how to make some tests but it works. Thanks.

anou’s picture

Here the patch re-rolled for the last release. Still not knowing how to make tests...

EDIT: sorry my comment was the 23th but I've named my patch "...-22"

MegaChriz’s picture

If you like to get started with writing tests, here is some documentation about it:
A good start would be following the Simpletest tutorial for Drupal 7. The topics about "Unit testing" and "Selenium testing" can be skipped, as they don't apply for this issue (and most other issues in this queue).

nithinkolekar’s picture

patch #20 doesn't work with the latest dev i.e all child nodes are still present when feed node is deleted.

anou’s picture

@nithinkolekar, did you try the patch #23?

nithinkolekar’s picture

patch #20 not worked with both 7.x-2.0-beta1+6-dev, 7.x-2.0-beta1+14-dev

patch #23 not tested with 7.x-2.0-beta1+6-dev , but after updating to 7.x-2.0-beta1+14-dev (oct 11 released) it works fine.

anou’s picture

Nice to read! Then I've still got to jump into making tests... :-)

nithinkolekar’s picture

wait.. :(

something strange with other sites which has xls parser and deletion partially works ie on deletion of feed node only 50 nodes of imported nodes are deleting leaving rest of the node undeleted and also showing only one message "deleted 1 node".

Where as with the csv parser patch works fine and also show two messages "deleted 1 node" and "deleted X nodes" for imported nodes.

I don't know whether nodes are actually deleting because deletion process is finishing fast compare to CSV parser. (Will check database tables for this.)

nithinkolekar’s picture

Just checked by changing xls parser to csv and got the same result : only 50 nodes are deleting. Sorry for my comment #27 where I didn't checked for feed node which had > 50 nodes.