I just installed the scheduler module and now I was wondering how the check for publising/unpublishing is done. Is it done by a cron task or is a database query executed at every page load or perhaps something else?
2 Answers
It is executed by the cron. The cron triggers a query to check wether something should be published. It is a bit contraintuitive though. If your cron runs every hour and you want something published on 22:35 and it is past that time it will be actually published the next time your cron runs. So if your cron runs at 22:30 and 23:30 the publish will be at 23:30.
-
This was very very helpful. I had done all the configuration but was thinking why I am not able to get it working. Great Help. Thanks a lot. Dec 12, 2013 at 10:26
The scheduler run as described by reptilex. When it runs, it registers a record in the wathdog table so you can have a look there to be sure everything worked fine.
However this is not very friendly. There's a better way to check this using an undocumented hook of scheduler: hook_scheduler_api()
.
With this you can write some hook code like this.
function mymodule_scheduler_api($node, $action) {
if ($action == 'publish') {
$message = 'The content ' . $node->title . ' has been published';
//Send an email with $message.
//...
}
}