The attached patch will add an option to the node processor settings screen, which will give a user the option to unpublish or delete nodes that were previously created by the feed import that no longer exist in the feed.
This was a request for a client i have that is using the drupal feeds module and i thought that it maybe useful to other developers using the feeds module.

CommentFileSizeAuthor
feeds.patch.zip3.52 KBpsycleDA

Comments

carsonblack’s picture

Hello,

Thanks for this! I had some issue when trying to apply the patch to 6.x-1.0-beta11. I resolved them manually. But nonetheless here's what I got:

patching file feeds.module
Hunk #1 succeeded at 661 (offset 27 lines).
can't find file to patch at input line 107
Perhaps you should have used the -p or --strip option?
The text leading up to this was:
--------------------------
|diff -upr feeds/plugins/FeedsNodeProcessor.inc feeds/plugins/FeedsNodeProcessor.inc
|--- feeds/plugins/FeedsNodeProcessor.inc 2010-10-25 22:43:04.000000000 +0100
|+++ feeds/plugins/FeedsNodeProcessor.inc 2011-07-14 12:29:17.000000000 +0100
--------------------------
File to patch: [path to]/sites/all/modules/feeds/plugins/FeedsNodeProcessor.inc
patching file [path to]/sites/all/modules/feeds/plugins/FeedsNodeProcessor.inc
Hunk #1 succeeded at 14 (offset -1 lines).
Hunk #2 FAILED at 175.
Hunk #3 succeeded at 271 (offset 18 lines).
Hunk #4 succeeded at 283 (offset 18 lines).
Hunk #5 succeeded at 426 (offset 18 lines).
1 out of 5 hunks FAILED -- saving rejects to file [path to]/sites/all/modules/feeds/plugins/FeedsNodeProcessor.inc.rej
can't find file to patch at input line 290
Perhaps you should have used the -p or --strip option?
The text leading up to this was:
--------------------------
|diff -upr feeds/plugins/FeedsProcessor.inc feeds/plugins/FeedsProcessor.inc
|--- feeds/plugins/FeedsProcessor.inc 2010-09-10 15:44:56.000000000 +0100
|+++ feeds/plugins/FeedsProcessor.inc 2011-07-14 10:32:50.000000000 +0100
--------------------------
File to patch: [path to]/sites/all/modules/feeds/plugins/FeedsProcessor.inc
patching file [path to]/sites/all/modules/feeds/plugins/FeedsProcessor.inc
Hunk #1 succeeded at 6 (offset -1 lines).

Thanks again,
Carson

travisc’s picture

Awesome, Maintainer please include this feature in Feeds... Anyway to get an D7 version?

wernerglinka’s picture

I second #2

tobias-’s picture

I also second #2 and also for 7.x

Psycle Interactive’s picture

Assigned: Unassigned » Psycle Interactive

I have created a 6.x-1.0-beta11 version of this patch, it can be found at http://drupal.org/node/1470530.

I will be working on a D7 version of this feature when time allows.

jboese’s picture

Also waiting on D7 version.

-otto-’s picture

bumpy for D7

jeni_dc’s picture

Not sure if these are duplicate efforts, but anyone viewing this thread might want to check this out:

#661314: "Sync" or "cache" mode

Psycle Interactive’s picture

Assigned: Psycle Interactive » Unassigned
Status: Needs review » Active

To those requesting a D7 version, a port of the patch has been created in http://drupal.org/node/1470530
I am currently testing the patch and will post back in the linked thread what i find.

alCHE’s picture

subscribe for D7

jelo’s picture

I am looking for the same feature, but I am not sure if the proposed solution will work in many scenarios. If you e.g. bring in content from sources such as YouTube, the items in the feed are limited to the latest 20 items. I am looking for a solution that can deal with outdated imported content by going to the source itself, instead of the feed who might not include the item anymore just because they only give you the latest few items. After thinking about it, I don't think that feeds should necessarily deal with this because I believe there are better suited other solutions already.

Example:
In the past months I have imported hundreds of videos as nodes based on my criteria. The problem now is that some of these videos get removed from YouTube (sometimes many weeks after the initial upload, i.e. the item is definitely not going to be in the feed anyway). My site is then left with a node that includes description etc. of the video and even the player, but if you try to play the video the user gets an error message. If you tried to use this patch, you would basically disable any item that is not in the feed any more which would restrict it to the same number of items that come through the feed. I rather want to have a record for all items that are still active and only remove items that are not active.

A solution I can see is using the module linkchecker http://drupal.org/project/linkchecker. If you import your content including the source link into a link field, link checker seems to be able to check for 404 errors for CCK fields of type "link". I haven't tried it yet, but based on their feature list on the module page, you should be able to configure it to check all those imported nodes and deactivate the ones that return 404s.

This solution could apply to your scenario as well. If we can assume that an item only gets removed from a feed (that includes all items) when it becomes unavailable, linkchecker would pick up on it and remove that piece of content from your Drupal site.

nedjo’s picture

Status: Active » Closed (duplicate)

Duplicate of #1470530: Unpublish/Delete nodes not included in feed, which has a newer patch.