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.
Comments
Comment #1
funkmasterjones CreditAttribution: funkmasterjones commentedin feeds.module, feeds_nodeapi(), add a call to clear() before deleting source
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.
Comment #2
alex_b CreditAttribution: alex_b commentedI 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.
Comment #3
srobert72 CreditAttribution: srobert72 commentedSubscribing
Comment #4
jvieille CreditAttribution: jvieille commentedAny 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.
Comment #5
yeeloon CreditAttribution: yeeloon commented+1
Subscribing.
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?
Comment #6
alex_b CreditAttribution: alex_b commented#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!
Comment #7
Dane Powell CreditAttribution: Dane Powell commentedI'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.
Comment #8
buddaI 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.
Comment #9
twistor CreditAttribution: twistor commentedNeeded 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.
Comment #10
Will White CreditAttribution: Will White commentedHere's my latest patch from #954814: Automatically delete feed items when feed node is deleted.. This adds tests.
Comment #11
alex_b CreditAttribution: alex_b commentedWill'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.
Comment #12
alex_b CreditAttribution: alex_b commented#11 is committed now. Thank you.
http://drupal.org/cvs?commit=443240
#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.
Comment #13
twistor CreditAttribution: twistor commentedCheck and check.
Comment #14
Agence Web CoherActio CreditAttribution: Agence Web CoherActio commentedHi Twistor,
Is there any reason for your (#13) to disable the delete checkbox in case of a standalone form ?
Thanks
Laurent
Comment #15
twistor CreditAttribution: twistor commented@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.
Comment #16
Dane Powell CreditAttribution: Dane Powell commentedThat patch will need to be re-rolled WRT the latest Git head
Comment #17
twistor CreditAttribution: twistor commentedComment #18
Dane Powell CreditAttribution: Dane Powell commentedCool, #17 seems to get the job done.
Comment #19
rashad612 CreditAttribution: rashad612 commentedIs there any other solution to do this in Feeds 7.x-2.x ?
Thanks.
Comment #20
Mohammed J. RazemHere'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.
Comment #21
twistor CreditAttribution: twistor commentedThis needs a test to get in.
Comment #22
anouI 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.
Comment #23
anouHere 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"
Comment #24
MegaChriz CreditAttribution: MegaChriz commented@anou
If you like to get started with writing tests, here is some documentation about it:
https://www.drupal.org/simpletest
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).
Comment #25
nithinkolekar CreditAttribution: nithinkolekar commentedpatch #20 doesn't work with the latest dev i.e all child nodes are still present when feed node is deleted.
Comment #26
anou@nithinkolekar, did you try the patch #23?
Comment #27
nithinkolekar CreditAttribution: nithinkolekar commentedpatch #20 not worked with both 7.x-2.0-beta1+6-dev, 7.x-2.0-beta1+14-dev
@anou
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.
Comment #28
anouNice to read! Then I've still got to jump into making tests... :-)
Comment #29
nithinkolekar CreditAttribution: nithinkolekar commentedwait.. :(
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.)
Comment #30
nithinkolekar CreditAttribution: nithinkolekar commentedJust 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.