hook_cron()
docs-4-6/hooks/core.php, line 259
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.
This hook will only be called if cron.php is run (e.g. by crontab).
None.
| Name | Description |
|---|---|
| Hooks | Allow modules to interact with the Drupal core. |
<?php
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);
}
}
?>