Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I'm not sure why but
// Check if the item already exists
$duplicate = db_fetch_array(db_query("SELECT nid FROM {aggregator_node} WHERE guid = '%s'", $node['guid']));
isn't pulling the nid from the database. When I looked at the data visually it looked equal. Changing to
// Check if the item already exists
$duplicate = db_fetch_array(db_query("SELECT nid FROM {aggregator_node} WHERE link = '%s'", $node['link']));
resolved my issue but is this the correct fix?
Comments
Comment #1
buddaA guid is required because the link field is not guaranteed in items (especially with ATOM feeds) so your code will not work in all cases either.
can you display whe generated GUID and see what it looks like compared to ones already in the dbase for the same feed item?
Comment #2
Anonymous (not verified) CreditAttribution: Anonymous commentedAs I said already I visually compared the GUID in the comparison string with the data in the DB and they look identical. It's probably a MySql thing with the GET data in the string; but I'm not savvy with that. I'll do some further digging. At least I was able to begin feeding affiliate data to my site.
Comment #3
Anonymous (not verified) CreditAttribution: Anonymous commentedThe stored GUID contains prefixes that include a timestamp. The generated GUID will never match the database value because the generated GUID contains a new timestamp.
Comment #4
Anonymous (not verified) CreditAttribution: Anonymous commentedWell, it seems that my feed provider is generating a new date and time even though the item is the same. The feed is allowing me to publish affiliate product links and I doubt that I can influence them to make the changes. Should I look at providing a method for not using a timestamp in the feedmanager_generate_guid function? The feed input for would present the creator of the feed an option with the default to create the GUID with the timestamp.
Comment #5
Anonymous (not verified) CreditAttribution: Anonymous commented@budda:
But the LINK column in both the aggregator_node and aggregator_item tables is not allowed to be null and only aggregator_node contains the GUID column. I can see that maybe the link item can come from two different sources and the GUID makes it unique; is that correct? Otherwise if I can guarantee myself that the link is only from one source then GUID isn't important at all; correct?