I found that an aggregator module doens't update a newer feed item. I chased the aggregator.module source code and found out the issue; I believe it seems to be a kind of bug, however, please correct me if I am wrong.

On the line 953 in a function aggregator_save_item, the SQL statement is:

    db_query("UPDATE {aggregator_item} SET title = '%s', link = '%s', author = '%s', description = '%s', guid = '%s', timestamp = %d WHERE iid = %d", $edit['title'], $edit['link'], $edit['author'], $edit['description'], $edit['iid'], $edit['timestamp'], $edit['gid']);

However, it should be:

    db_query("UPDATE {aggregator_item} SET title = '%s', link = '%s', author = '%s', description = '%s', guid = '%s', timestamp = %d WHERE iid = %d", $edit['title'], $edit['link'], $edit['author'], $edit['description'], $edit['guid'], $edit['timestamp'], $edit['iid']);

The position in `iid` and `guid` seems to be wrong, and there would be a misspelling of `guid`.

Comments

yas’s picture

I am sorry that I found that this post is misplaced. Please delete this issue.

Thanks
--- yas

RobRoy’s picture

Project: Aggregator2 » Drupal core
Version: master » 5.x-dev
Component: Code » aggregator.module

Recategorized issue to the right spot.

yas’s picture

Thanks, RobRoy

--- yas

yas’s picture

Status: Active » Needs review
StatusFileSize
new1.17 KB

I created the patch for fixing the function aggregator_save_item and let me submit it.

--- yas

asimmonds’s picture

Version: 5.x-dev » 6.x-dev
Status: Needs review » Reviewed & tested by the community
StatusFileSize
new1.15 KB

Re-rolled for HEAD and tested, appears to fix the problem.

Should be fixed in 6.x-dev first then backported to 5.x-dev

gábor hojtsy’s picture

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

Seems to be a quite logical fix, committed to Drupal 6.x-dev. Needs to be backported to Drupal 5.x.

asimmonds’s picture

Version: 6.x-dev » 5.x-dev
Status: Patch (to be ported) » Reviewed & tested by the community
StatusFileSize
new1.15 KB

Patch applied to 5.x-dev with fuzz, but have re-rolled for 5.x-dev

drumm’s picture

Status: Reviewed & tested by the community » Fixed

Committed to 5.x.

Anonymous’s picture

Status: Fixed » Closed (fixed)
kmartino’s picture

Title: aggregator_save_item doesn't update a feed item » aggregator_save_item updating feed with wrong timestamp
Status: Closed (fixed) » Active

Bug number #107023 (http://drupal.org/node/107023) fixed a bug related to updating previously saved aggregator items.

This update revealed a new bug that is only apparent when feeds are updated containing previously saved items - the timestamp in the feed is not respected and the timestamp being saved is the timestamp generated during the update operation.

Doing this eliminates a very important piece of metadata from the saved aggregator_item, making sorting, finding posts by their date, etc, impossible.

Steps to repeat - update a feed.

mustafau’s picture

Anonymous’s picture

Status: Fixed » Closed (fixed)

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