CronPlus

Component ID

24208

Component name

CronPlus

Component type

module

Maintenance status

Development status

Component security advisory coverage

not-covered

Downloads

9257

Component created

Component changed

Component body

CronPlus adds more "cron" hooks to Drupal beyond the basic one, with each of the new hooks being called at or near specified time intervals (hourly, daily, weekly, monthly, and yearly).

About CronPlus

CronPlus is meant to relieve application programmers of the need to reinvent the same old wheel of filtering down the Drupal cron calls — which can happen at any interval chosen by the installer — into real-world (approximate) time intervals. CronPlus provides an approximation at each interval. It does not claim, nor even attempt, to be accurate enough for precise applications such as month-end financial processing or real-time control. Instead, it is meant for duties such as routine log cleanup, updating data from external sources, pushing data to other systems, and similar things which require only an approximate time base.

If your application needs precise control over timing, you may still be able to use CronPlus if the database contains the timing information you need. For example, an application that needs to process "all log records for the previous month" could use CronPlus to trigger this function once-per-month. CronPlus will guarantee that the trigger happens "soon after the month changes", and the application can execute an SQL query to filter the records of interest based on their time stamp.

Features

  • Adds hourly, daily, weekly, monthly, and yearly cron hooks to any Drupal module.
  • Implementation of the hooks is totally optional; existing modules that do not use CronPlus will simply be ignored by this module.
  • Administrative preferences allow advisory settings for the preferred time of day and day of week on which the longer-period jobs should be invoked.
  • In the administrative menu, a status page is available showing which installed modules implement CronPlus hooks and when each hook was last invoked.
  • Modules receive parameters indicating how long it has been since the last time each given hook was invoked, and may use these parameters as they wish.
  • A multiplex hook is called for every invocation of any of the other hooks, and receives the name of the time period as an additional parameter. This is useful for modules that want to implement their own sophisticated event handling internally, or which want a single-point hook where they can do some routine logging.

Prerequisites

You must have cron.php being invoked at intervals on your system. CronPlus is believed to be compatible with Poor Man's Cron (a contributed module), but this has not been specifically tested.

CronPlus emphatically does not require that all modules implement its hooks. Application modules implement only the hook functions they need to use, and ignore the rest. CronPlus uses Drupal's module_invoke_all() function to dynamically determine which hooks are implemented in which modules.

Versions are available for Drupal 6.x, Drupal 5.x, and Drupal 4.x. Version 5.x and earlier are no longer maintained. Use at your own risk.

A port to Drupal 7 was begun December 2013 but has not been released yet.

Sponsorship

The creator of this module (Scott Courtney, aka "Syscrusher"), would like to acknowledge the sponsorship of his employer, Sine Nomine Associates. The company has graciously allowed this module to be maintained on company time as an R&D project.