On May 27th there was an update to the Scheduler module. I installed this update. A few days later, there was another update. I also installed that.
A little background on how my site is setup. We have a system on the back end for a separate application. PHP was written that exports the data from this database, and imports it into a Drupal database. Nodes are created with status = 0, as they need to go live at a certain time. In this process we also populate the scheduler table. Since the may 27th update none of the nodes are that are imported are set to status = 1 when they should. I read the change log for the 1.13 update and that mentioned a change to the way dates are handled. So I thought our export was not generating the correct date and the SQL insert was silently failing.
When I check the scheduler table after the import, I see just three entries for nodes in 2007. I run cron.php and none of the stories are published. I check the scheduler table and it still only has those three old entries. I then checked with the other member of the team and his script generates a unix timestamp to insert into the scheduler table. This lead me to believe that perhaps something is up with the module itself.
So I manually added six or so entries into the scheduler table. These were nodes that had a status = 0. I ran cron.php. No updated nodes show on the website. I then checked the scheduler table and the entries I added are still there. It is my understanding from looking thru the scheduler.module that after cron is run and nodes are published, and IF they don't need unpublished, they are removed from the scheduler table. None of our nodes are ever unpublished,so after a cron.php run the scheduler table should be empty of those nodes that should have been published. This is not the case.
As a separate test I decided to add a node manually, thru Drupal, setting a publish date, and see if that works. After node submission I checked the scheduler table and I get entry for the newly added node, with the unix timestamp of 1213365300 in publish_on and 0 in unpublish_on. I then run cron.php and the node is published.
Is there some table or something we're missing when we do an import, versus using the Drupal way?
Drupal version: 5.7
PHP: 5.1.6
mySQL 5.0.22
Comments
Comment #1
eric-alexander schaefer commentedAs of release 5.x-1.14 scheduler records the (un-)publishing times as UTC times! Your export script needs to subtract the time zone offset. All internal times in scheduler are now UTC. See issue #252116: Scheduler should persist timestamps in UTC.
Your can verifiy that by creating two nodes. One with your backend and one directly in drupal. Set the publishing times to the same value and you will see that the entries in the scheduler table will differ by 60*60*YOUR_TIMEZONE_OFFSET. e.g. if you are in New York (EST Offset is -0500) the values will differ by 3600*5. If thats the case, my assumption is right and your export script needs to adust the publish_on and unpublish_on values by the time zone offset in seconds.
Comment #2
stevenpatzThinking out loud here. Wouldn't the nodes get published eventually though? The last nodes I have showing up on my page are all May 27th.
From my scheduler table:
cron.php has been run, yet the entry stays in the scheduler table and the node does not get published.
Comment #3
eric-alexander schaefer commentedCan you please post the nodes row in the node table?
Comment #4
stevenpatzI just noticed that the publish_on date is before the created time of the node. Would that make a difference?
Comment #5
eric-alexander schaefer commentedWhen called by cron, scheduler publishes all nodes that have an entry in the scheduler table and have status 0 and publish_on between 0 and now.
All conditions are met. The node really should get published. Did you check if cron is actually running?
Comment #6
stevenpatzThat appears to be the only thing left to verify. I run cron.php, and after awhile, I see "Cron completed successfully" as a status message. Checking the Drupal logs I don't see any errors reported. So I assume cron.php is running and completing, in fact if I manually create a node with a future scheduling date, and run cron.php after that date, the node is published.
Comment #7
eric-alexander schaefer commentedIs it possible to have a look at the source code of your export script?
Comment #8
stevenpatzUnfortunately no. I think that the issue has been tracked down though, to the removal of the offset field from the scheduler table. Tomorrow morning I will check the nodes that should be published at 5PM today, and if they are, I'll set this to fixed.
Comment #9
stevenpatzI am marking this as fixed. The script we were using was still trying to INSERT the timezone. Once that was removed the proper nodes were set as published at the proper time. Thanks for the help.
Comment #10
eric-alexander schaefer commentedComment #12
jonathan1055 commentedIn case anyone is wondering why this old old issue has only just changed from 'fixed' to 'closed(fixed)' - it had been closed back in 2008 comment #10 but due to the Drupal.org upgrade from D6 to D7 on 1st Nov 2013 some issues had their status taken from the comment with the latest timestamp not the latest added comment. Hence this issue suddenly became only 'fixed' again, due to the edit of comment #9 which now has a later timestamp than #10.
See #2125367: Incorrect issue status derived due to out of sequence comments and #2125263: Issue status not taken from last comment during D7 migration for more details.
Jonathan