Allow aggregator feed items to never be discarded
budda - April 26, 2006 - 11:26
| Project: | Drupal |
| Version: | 7.x-dev |
| Component: | aggregator.module |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
| Issue tags: | Novice |
Description
Allow aggregator feed items to never be discarded, by adding an additional option in 'Discard news items older than:'

#1
Applies to current version?
#2
Is there already a patch to accomplish this (D6)?
#3
Novice task.
#4
The fix via form_alter
D5:
<?phpfunction custommodule_form_alter($form_id, &$form) {
if ($form_id == "aggregator_admin_settings"){
$form['aggregator_clear']['#options'][157784630] = "Nearly Never aka 5 years";
}
}
?>
D6 (and D7?):
<?phpfunction custommodule_form_aggregator_admin_settings_alter(&$form, &$form_state) {
$form['aggregator_clear']['#options'][157784630] = "Nearly Never aka 5 years";
}
?>
#5
I've added a 'never' option to the 'Discard news items older than' field.
When aggregator_expire is called, it returns without discarding if the 'never' option is selected.
#6
Thanks for working on this JamesAn!
Strict technical review (haven't tested the functionality):
+ $period[0] = 'Never';+ // Check if items should be retained indefinitely// Remove all items that are older than flush item timer.$age = REQUEST_TIME - variable_get('aggregator_clear', 9676800);
Setting back to CNW for #1 and #2. #3 and #4 are just my preference, so feel free to ignore ;)
#7
Forgot to actually set it to CNW...
#8
Thanks for the review. For #4, I used $aggregator_clear simply because the variable name in Drupal is 'aggregator_clear'. I've tweaked the patch by hand.. let's hope I didn't mess it up! *fingers-crossed*
#9
The last submitted patch failed testing.
#10
Ok, ok.. I re-rolled the patch.. -.-" This should work now.
#11
The last submitted patch failed testing.
#12
That's strange. The patch passed last time I checked. Let's re-test!
#13
I'm wondering if we should define a constant for NEVER rather than using 0. Otherwise this looks good to me. Test bot could use a nudge.
#14
Agreed. 0 should be a constant for clarity's sake: Introduced AGGREGATOR_CLEAR_NEVER and rerolled.
#15
#16
Nudging the bot.
#17
We use 0 as never (or unlimited) in other places, so we could consider making it one (or two) generic constants. I'm happy to do that in a follow-up patch though.
#18
+ $iids = db_query('SELECT iid FROM {aggregator_item} WHERE fid = :fid AND timestamp < :timestamp', array(':fid' => $feed->fid, ':timestamp' => $age))->fetchCol();- $iids = db_query('SELECT iid FROM {aggregator_item} WHERE fid = :fid AND timestamp < :timestamp', array(':fid' => $feed->fid, ':timestamp' => $age))->fetchCol();
If you have multiple arguments, they should be splitted up to multiple lines, see #394586-10: DBTNG: Trigger module ( A)
#19
Correcting db_query() indenting.
#20
Giving this a spin and a more careful look, I think it's good to go.
#21
Committed to CVS HEAD. Thanks!
#22
Automatically closed -- issue fixed for 2 weeks with no activity.
#23
I read your post about how to add a "never" option to the aggregator in the discard setting. I was wondering if you could explail a little more or point me in the right direction. You posted a Patch but I wasn't sure how to implement or install it. I'm interested in having my aggregator keep all of my posts. I would greatly appreciated your help. Thank you for your time. I'm a newb to Drupal but follow directions really well :)
Sincerely,
John
#24
@inspirited: Information about applying patches. However, the patches in this thread are specific to Drupal 7, and it's unlikely that you'll be able to make these work on D6 without some tweaking.
Since this feature was implemented in D7, and new features are not backported to earlier versions, this issue was closed, and it is generally not done to re-open closed issues so I've changed the status back to closed.
If you would still like this feature in D6 you might find help through one of the support channels, especially the forums or irc.