You are here

function _acquia_spi_security_review_run_check in Acquia Connector 6.2

Same name and namespace in other branches
  1. 7.3 acquia_spi/security_review.inc \_acquia_spi_security_review_run_check()
  2. 7.2 acquia_spi/security_review.inc \_acquia_spi_security_review_run_check()

Run a single Security Review check.

1 call to _acquia_spi_security_review_run_check()
_acquia_spi_security_review_run in acquia_spi/security_review.inc
Private function run review and returns the full results.

File

acquia_spi/security_review.inc, line 49
Stand-alone security checks and review system.

Code

function _acquia_spi_security_review_run_check($module, $check_name, $check, $log, $store = FALSE) {
  $last_check = array();
  $check_result = array();
  $return = array(
    'result' => NULL,
  );
  if (isset($check['file'])) {

    // Handle Security Review defining checks for other modules.
    if (isset($check['module'])) {
      $module = $check['module'];
    }
    module_load_include('inc', $module, $check['file']);
  }
  $function = $check['callback'];
  if (function_exists($function)) {
    $return = call_user_func($function, $last_check);
  }
  $check_result = array_merge($check, $return);
  $check_result['lastrun'] = time();
  if ($log && !is_null($return['result'])) {

    // Do not log if result is NULL.
    $variables = array(
      '!name' => $check_result['title'],
    );
    if ($check_result['result']) {
      _acquia_spi_security_review_log($module, $check_name, '!name check passed', $variables, WATCHDOG_INFO);
    }
    else {
      _acquia_spi_security_review_log($module, $check_name, '!name check failed', $variables, WATCHDOG_ERROR);
    }
  }
  return $check_result;
}