You are here

function actions_loop_test_watchdog in SimpleTest 7

Implement hook_watchdog().

File

tests/actions_loop_test.module, line 19

Code

function actions_loop_test_watchdog(array $log_entry) {

  // If the triggering actions are not explicitly enabled, abort.
  if (empty($_GET['trigger_actions_on_watchdog'])) {
    return;
  }

  // Get all the action ids assigned to the trigger on the watchdog hook's
  // "run" event.
  $aids = trigger_get_assigned_actions('watchdog');

  // We can pass in any applicable information in $context. There isn't much in
  // this case, but we'll pass in the hook name as the bare minimum.
  $context = array(
    'hook' => 'watchdog',
  );

  // Fire the actions on the associated object ($log_entry) and the context
  // variable.
  actions_do(array_keys($aids), $log_entry, $context);
}