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

LAsan - April 1, 2008 - 08:58
Version:x.y.z» 7.x-dev

Applies to current version?

#2

lolandese - February 11, 2009 - 12:54

Is there already a patch to accomplish this (D6)?

#3

alex_b - March 11, 2009 - 17:13

Novice task.

#4

sethcohn - March 27, 2009 - 16:26

The fix via form_alter

D5:

<?php
function 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?):

<?php
function custommodule_form_aggregator_admin_settings_alter(&$form, &$form_state) {
   
$form['aggregator_clear']['#options'][157784630]  = "Nearly Never aka 5 years";                  
}
?>

#5

JamesAn - March 30, 2009 - 23:34
Status:active» needs review

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.

AttachmentSizeStatusTest resultOperations
jamesan_60468.patch1.51 KBIdlePassed: 11256 passes, 0 fails, 0 exceptionsView details | Re-test

#6

mr.baileys - March 31, 2009 - 12:41

Thanks for working on this JamesAn!

Strict technical review (haven't tested the functionality):

  1. Strings should be run through t() so they can be translated:
    +    $period[0] = 'Never';
  2. As per Coding Standards, comments should end with a period:
    +  // Check if items should be retained indefinitely
  3. 2 calls to variable_get to retrieve the same value: we can reuse the result from the first variable get instead of calling it a second time (second call below):
       // Remove all items that are older than flush item timer.
       $age = REQUEST_TIME - variable_get('aggregator_clear', 9676800);
  4. Not sure that $aggregator_clear is the best name for the variable, as it doesn't indicate that we are talking about a timespan/period.

Setting back to CNW for #1 and #2. #3 and #4 are just my preference, so feel free to ignore ;)

#7

mr.baileys - March 31, 2009 - 12:55
Status:needs review» needs work

Forgot to actually set it to CNW...

#8

JamesAn - March 31, 2009 - 21:06
Status:needs work» needs review

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*

AttachmentSizeStatusTest resultOperations
jamesan_60468-2.patch1.59 KBIdleFailed: Invalid PHP syntax in modules/aggregator/aggregator.processor.inc .View details | Re-test

#9

System Message - March 31, 2009 - 21:20
Status:needs review» needs work

The last submitted patch failed testing.

#10

JamesAn - March 31, 2009 - 21:35
Status:needs work» needs review

Ok, ok.. I re-rolled the patch.. -.-" This should work now.

AttachmentSizeStatusTest resultOperations
jamesan_60468-3.patch1.62 KBIdlePassed: 11256 passes, 0 fails, 0 exceptionsView details | Re-test

#11

System Message - April 4, 2009 - 00:40
Status:needs review» needs work

The last submitted patch failed testing.

#12

JamesAn - April 4, 2009 - 05:53
Status:needs work» needs review

That's strange. The patch passed last time I checked. Let's re-test!

#13

catch - May 6, 2009 - 18:50

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

alex_b - May 6, 2009 - 22:25

Agreed. 0 should be a constant for clarity's sake: Introduced AGGREGATOR_CLEAR_NEVER and rerolled.

AttachmentSizeStatusTest resultOperations
60468-14_never_discard.patch2.44 KBIdlePassed: 11256 passes, 0 fails, 0 exceptionsView details | Re-test

#15

alex_b - May 6, 2009 - 22:25
Status:needs review» needs work

#16

alex_b - May 6, 2009 - 22:26
Status:needs work» needs review

Nudging the bot.

#17

Dries - May 9, 2009 - 17:36

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

Berdir - May 11, 2009 - 22:00
Status:needs review» needs work

+    $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

akahn - May 16, 2009 - 16:16
Status:needs work» needs review

Correcting db_query() indenting.

AttachmentSizeStatusTest resultOperations
60468-19-aggregator-never-discard.patch2.74 KBIdlePassed: 11256 passes, 0 fails, 0 exceptionsView details | Re-test

#20

akahn - May 16, 2009 - 16:44
Status:needs review» reviewed & tested by the community

Giving this a spin and a more careful look, I think it's good to go.

#21

Dries - May 16, 2009 - 17:58
Status:reviewed & tested by the community» fixed

Committed to CVS HEAD. Thanks!

#22

System Message - May 30, 2009 - 18:00
Status:fixed» closed

Automatically closed -- issue fixed for 2 weeks with no activity.

#23

inspirited - September 25, 2009 - 04:25
Version:7.x-dev» 6.14
Status:closed» active

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

mr.baileys - September 25, 2009 - 07:22
Version:6.14» 7.x-dev
Status:active» closed

@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.

 
 

Drupal is a registered trademark of Dries Buytaert.