Records don't get removed from scheduler DB table
henrrrik - May 4, 2009 - 11:23
| Project: | Scheduler |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Description
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.

#1
$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?
#2
You 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.
#3
I'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.
#4
Maybe we should check the table once in a while for abandoned nodes that can be removed...
#5
I 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.
#6
We 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
#7
The logic should be pretty easy. Patch attached.
#8
Wrong. New patch...
#9
#10
Since 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...
#11
Automatically closed -- issue fixed for 2 weeks with no activity.