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.

Comments

eric-alexander schaefer’s picture

$n get loaded via node_load() which results in scheduler_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?

henrrrik’s picture

Version: 6.x-1.3 » 5.x-1.9
Status: Active » Postponed

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.

henrrrik’s picture

Status: Postponed » Active

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.

eric-alexander schaefer’s picture

Maybe we should check the table once in a while for abandoned nodes that can be removed...

henrrrik’s picture

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.

jonathan1055’s picture

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

eric-alexander schaefer’s picture

Status: Active » Needs review
StatusFileSize
new1.07 KB

The logic should be pretty easy. Patch attached.

eric-alexander schaefer’s picture

StatusFileSize
new1.07 KB

Wrong. New patch...

eric-alexander schaefer’s picture

Title: Records don't get removed form scheduler DB table » Records don't get removed from scheduler DB table
Version: 5.x-1.9 » 6.x-1.x-dev
eric-alexander schaefer’s picture

Status: Needs review » Fixed

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...

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.