function notify_cron in Notify 7
Same name and namespace in other branches
- 8 notify.module \notify_cron()
- 5.2 notify.module \notify_cron()
- 5 notify.module \notify_cron()
- 6 notify.module \notify_cron()
- 2.0.x notify.module \notify_cron()
- 1.0.x notify.module \notify_cron()
Implements hook_cron().
File
- ./
notify.module, line 45 - Notify module sends e-mail digests of new content and comments.
Code
function notify_cron() {
$period = variable_get("notify_period", 86400);
if (-2 == $period) {
return;
}
if (-1 == $period) {
return;
// Never notify.
}
$send_last = variable_get('notify_send_last', 0);
$cron_next = variable_get('notify_cron_next', 0);
$doitp = variable_get('notify_users', array());
if ($period >= 86400) {
if ($doitp || $cron_next < REQUEST_TIME) {
$doitp = TRUE;
}
else {
return;
}
}
$next = _notify_next_notificaton($send_last);
if (REQUEST_TIME > $next || $doitp) {
list($num_sent, $num_fail) = _notify_send();
$num_sent += variable_get('notify_num_sent', 0);
$num_fail += variable_get('notify_num_failed', 0);
variable_set('notify_num_sent', $num_sent);
variable_set('notify_num_failed', $num_fail);
$next = _notify_next_notificaton(REQUEST_TIME);
variable_set('notify_cron_next', $next);
}
}