cron.inc in Date Reminder 6
Same filename and directory in other branches
Processing for hook_cron().
File
includes/cron.incView source
<?php
/**
* @file
* Processing for hook_cron().
*/
/**
* Implements hook_cron().
*
* Check to see if we need to send any reminders.
*
* If so, send them and update reminders for next occurrance.
*/
function _datereminder_cron() {
module_load_include('inc', 'datereminder', 'includes/defines');
module_load_include('inc', 'datereminder', 'includes/messaging');
module_load_include('inc', 'datereminder', 'includes/date');
$skew = variable_get('datereminder_cron_frequency', DATEREMINDER_CRON_FREQUENCY);
// Convert to seconds in half of the frequency
$skew *= 30;
// Cron only runs every daterminder_cron_frequency seconds, so
// we'll fire any reminders that are scheduled to be sent
// up to half way to the next cron run.
$now = _datereminder_now($skew);
$dt = _datereminder_date_format_internal($now);
$q = db_query('SELECT * from {datereminder} WHERE next <= \'%s\'', $dt);
$rems = array();
while ($r = db_fetch_object($q)) {
if (!$r->expired) {
_datereminder_send_reminder($r);
}
$rems[$r->rid] = $r;
}
// Re-calculate when the expired reminders should next run.
_datereminder_update_reminder_nexts($rems);
}
Functions
Name![]() |
Description |
---|---|
_datereminder_cron | Implements hook_cron(). |