in scheduler_cron() the following line is never true because $n is the loaded node object. It should be looking at the database result object $node.
if (isset($n->unpublish_on) && $n->unpublish_on == 0) {
Should be:
if (isset($node->unpublish_on) && $node->unpublish_on == 0) {
This causes scheduler to fail to delete any records.
| Comment | File | Size | Author |
|---|---|---|---|
| #8 | scheduler6_dead_rows.patch | 1.07 KB | eric-alexander schaefer |
| #7 | scheduler6_dead_rows.patch | 1.07 KB | eric-alexander schaefer |
Comments
Comment #1
eric-alexander schaefer commented$nget loaded vianode_load()which results inscheduler_nodeapi($op=='load')which adds the publish_on and unpublish_on fields to the node if they exist.I just tested it and it work just fine. Node was published and row in {scheduler} was removed.
Do the entries in {scheduler} in your database not get deleted?
Comment #2
henrrrik commentedYou are indeed correct. Our scheduler table currently has 150+ rows, so it hasn't deleted any records for a while. Very peculiar, I'll investigate further.
Comment #3
henrrrik commentedI'm starting to suspect the editors on the site... If you schedule something for publishing and then publish it manually before scheduler kicks in, it never gets removed from the {scheduler} table as far as I can tell.
Comment #4
eric-alexander schaefer commentedMaybe we should check the table once in a while for abandoned nodes that can be removed...
Comment #5
henrrrik commentedI suppose records could be automatically purged if they
a) reference published nodes with an outdated publish_on timestamp and no unpublish date, or
b) reference unpublished nodes with an outdated unpublish_on date.
That way the table is kept tidy regardless of what the users get up to.
Comment #6
jonathan1055 commentedWe could probably include some code in scheduler_nodeapi such that when a node is published manually then we check if there was a row in {scheduler} and update it or delete it (whichever is appropriate depending on whether there is also an unpublish date set). This would fix the problem immediately instead of writing something to periodically tidy up the table.
Jonathan
Comment #7
eric-alexander schaefer commentedThe logic should be pretty easy. Patch attached.
Comment #8
eric-alexander schaefer commentedWrong. New patch...
Comment #9
eric-alexander schaefer commentedComment #10
eric-alexander schaefer commentedSince nobody reported any problem with this patch I assume it is OK. => http://drupal.org/cvs?commit=236078
I don't know if the problem is for real anyways. If you try to manually publish a scheduled node it will not be published if you do not clear the publish_on field. In this case the scheduler table entry will get deleted anyways...