Example: Cron

  1. examples
    1. 7 cron_example/cron_example.module
    2. 8 cron_example/cron_example.module

Example using Cron API, including hook_cron() and hook_cron_queue_info().

This example is part of the Examples for Developers Project which you can download and experiment with at http://drupal.org/project/examples

Classes

NameDescription
CronExampleTestCasecron_example test class

Functions & methods

NameDescription
cron_example_add_jobs_to_queue#submit function used to add the items to the queue when signaled by the form.
cron_example_cronImplements hook_cron().
cron_example_cron_queue_infoImplements hook_cron_queue_info().
cron_example_formThe form to provide a link to cron.php.
cron_example_form_cron_run_submitAllow user to directly execute cron, optionally forcing it.
cron_example_menuImplements hook_menu().
cron_example_queue_1_workerSimple workers for the two queues.
cron_example_queue_2_worker
cron_example_queue_report_workSimple reporter for the workers.

File

cron_example/cron_example.module, line 8
Demonstrates use of the Cron API in Drupal - hook_cron()

Login or register to post comments