Closed (fixed)
Project:
SimpleFeed
Version:
5.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
23 Apr 2007 at 23:08 UTC
Updated:
8 May 2007 at 03:46 UTC
Jump to comment: Most recent file
Comments
Comment #1
m3avrck commentedHere is relevant code:
Obviously in that case $item->get_date() is empty so it defaults to the current time. Looks to be an issue with SimplePie...
Comment #2
webchickI did confirm that the following works when executed alone:
So now it's a question of whether the $item->get_date is failing or whether the format_date function is being used incorrectly. It appears to be neither... this is generated from a couple var_dumps right before:
so as you can see, Simplepie seems to be parsing the date properly, and Drupal's sticking it in the $values['date'] field as you'd expect.
Now, it's worth pointing out that above was generated during a manual feed refresh, and not a cron run... and seems to work properly (?!). For some reason, hitting cron.php isn't picking up new feeds even though I know they're there...
I give up on this for tonight. :(
Comment #3
m3avrck commentedTry this, replace line 391 with:
It seems Drupal's format_date() is causing trouble when cron runs...
Comment #4
m3avrck commentedActually, try this
This adjusts for the site timezone since no user is logged in when cron runs.
Comment #5
webchickWow, this patch gets the official 'biggest, most obscure pain in the ass' award. ;)
The short version is that there is code in node_submit() that only changes the $node->created time if you're a node admin. Which means when your cron job is running as an anonymous user, it bypasses this code, and the $node->created stays NULL (which means it'll be the current date/time).
So, to compensate, you need to set the created time sometime after node_submit() does its thing. You have two opportunities: one is simplefeed_item_submit() (which I tried, but it killed feed creation for some reason), and the other is hook_nodeapi op submit, which this patch implements.
Many thanks to Ted for working through the problem w/ me on IRC. :)
Comment #6
webchickAnd actually, you need to fix the uid here as well for the same reason.
Comment #7
m3avrck commentedwhoooooooohoooooo!
commited, thanks Angie!
Comment #8
(not verified) commented