You are here

function audit_log_filter_audit_log_it in Audit Log 7

Implements hook_audit_log_it().

File

modules/audit_log_filter/audit_log_filter.module, line 10
Hook implemenations for the Audit database logging module.

Code

function audit_log_filter_audit_log_it(Auditlog $log, array $context, $account) {
  if (count(array_intersect($log->role_ids, variable_get('audit_log_filter_exclude_roles', array())))) {
    return AUDIT_LOG_DO_NOT_LOG;
  }
  if (drupal_is_cli()) {
    if (variable_get('audit_log_exclude_cli', FALSE)) {
      return AUDIT_LOG_DO_NOT_LOG;
    }
    if (function_exists('drush_main') && variable_get('audit_log_exclude_drush', FALSE)) {
      return AUDIT_LOG_DO_NOT_LOG;
    }
  }
  $alf_exclude = variable_get('audit_log_exclude_entity_types', array());
  if (isset($alf_exclude[$log->entity_type . '-all']) && TRUE == $alf_exclude[$log->entity_type . '-all']) {
    return AUDIT_LOG_DO_NOT_LOG;
  }
  if (isset($alf_exclude[$log->entity_type][$log->bundle . '-all']) && TRUE == $alf_exclude[$log->entity_type][$log->bundle . '-all']) {
    return AUDIT_LOG_DO_NOT_LOG;
  }
  if (isset($alf_exclude[$log->entity_type][$log->bundle][$log->audit_action]) && TRUE == $alf_exclude[$log->entity_type][$log->bundle][$log->audit_action]) {
    return AUDIT_LOG_DO_NOT_LOG;
  }
  return AUDIT_LOG_DO_LOG;
}