function _notify_next_notificaton in Notify 7
Same name and namespace in other branches
- 8 notify.module \_notify_next_notificaton()
- 2.0.x notify.module \_notify_next_notificaton()
- 1.0.x notify.module \_notify_next_notificaton()
Compute the next time a notification shall be sent by adding to $send_last if required. Update $cron_next if it is has been reset (= 0), otherwise leave it to caller.
Parameters
int $send_last: timestamp of last notification
Return value
int -1 never, 0 send instantly, else next time to notify.
2 calls to _notify_next_notificaton()
- notify_admin_queue in ./
notify.admin.inc - Menu callback, show admin list of queue status.
- notify_cron in ./
notify.module - Implements hook_cron().
File
- ./
notify.module, line 342 - Notify module sends e-mail digests of new content and comments.
Code
function _notify_next_notificaton($send_last) {
$period = variable_get('notify_period', 86400);
// Two special cases: Never and instantly.
if ($period < 0) {
return -1;
}
elseif (!$period) {
return 0;
}
$next_time_to_send = $send_last + $period;
if ($period < 86400) {
if (REQUEST_TIME >= $next_time_to_send) {
return 0;
}
else {
return $next_time_to_send;
}
}
// Interval >= 1 day.
$cron_next = variable_get('notify_cron_next', 0);
if (!$cron_next) {
$cron_next = _notify_cron_next($next_time_to_send);
variable_set('notify_cron_next', $cron_next);
}
return $cron_next;
}