function notifications_event_tracker in Notifications 6
Same name and namespace in other branches
- 6.2 notifications.cron.inc \notifications_event_tracker()
- 6.3 notifications.cron.inc \notifications_event_tracker()
Keep track of events and update event counter with processed rows eids
Parameters
$op: count, reset, update
$event: event object to track
2 calls to notifications_event_tracker()
- notifications_process_queue in ./
notifications.cron.inc - Process subscriptions queue
- notifications_process_rows in ./
notifications.cron.inc - Process rows given query conditions
File
- ./
notifications.cron.inc, line 312
Code
function notifications_event_tracker($op, $event = NULL) {
static $events = array();
switch ($op) {
case 'count':
$events[$event->eid] = array_key_exists($event->eid, $events) ? $events[$event->eid] + 1 : 1;
break;
case 'update':
foreach ($events as $eid => $count) {
db_query('UPDATE {notifications_event} SET counter = counter - %d WHERE eid = %d', $count, $eid);
}
// Intentional no break (update will also reset)
case 'reset':
$events = array();
}
}