hook_cron
- Versions
- 4.6 – 7
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.
This hook will only be called if cron.php is run (e.g. by crontab).
Return value
None.
Related topics
Code
developer/hooks/core.php, line 149
<?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);
}
}
?>Login or register to post comments 