function hook_cron

Same name and namespace in other branches
  1. 7.x drupal-7.x/modules/system/system.api.php \hook_cron()

Perform periodic actions.

Modules that require to schedule some commands to be executed at regular intervals can implement hook_cron(). The engine will then call the hook at the appropriate intervals defined by the administrator. This interface is particularly handy to implement timers or to automate certain tasks. Database maintenance, recalculation of settings or parameters, and automatic mailings are good candidates for cron tasks.

Return value

None.

This hook will only be called if cron.php is run (e.g. by crontab).

Related topics

13 functions implement hook_cron()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

aggregator_cron in drupal-6.x/modules/aggregator/aggregator.module
Implementation of hook_cron().
dblog_cron in drupal-6.x/modules/dblog/dblog.module
Implementation of hook_cron().
filter_cron in drupal-6.x/modules/filter/filter.module
Implementation of hook_cron().
node_cron in drupal-6.x/modules/node/node.module
Implementation of hook_cron().
openid_cron in drupal-6.x/modules/openid/openid.module
Remove expired nonces from the database.

... See full list

1 invocation of hook_cron()
drupal_cron_run in drupal-6.x/includes/common.inc
Executes a cron run when called

Archivo

documentation-6.x/developer/hooks/core.php, line 293
These are the hooks that are invoked by the Drupal core.

Código

function hook_cron() {
  $result = db_query('SELECT * FROM {site} WHERE checked = 0 OR checked
    + refresh < %d', time());

  while ($site = db_fetch_array($result)) {
    cloud_update($site);
  }
}