function _security_review_run_check in Security Review 7
Same name and namespace in other branches
- 6 security_review.inc \_security_review_run_check()
Run a single Security Review check.
2 calls to _security_review_run_check()
- _security_review_batch_op in ./
security_review.module - Operation function called by Batch.
- _security_review_run in ./
security_review.inc - Private function the review and returns the full results.
File
- ./
security_review.inc, line 62 - Stand-alone security checks and review system.
Code
function _security_review_run_check($module, $check_name, $check, $log, $store = FALSE) {
$variables = array(
'@title' => $check['title'],
'@name' => $check_name,
);
_security_review_log($module, $check_name, 'Beginning the @title (@name) security review check.', $variables, WATCHDOG_INFO);
$last_check = array();
if ($store) {
// Get the results of the last check.
$last_check = security_review_get_last_check($module, $check_name);
}
$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'] = REQUEST_TIME;
if ($log && !is_null($return['result'])) {
// Do not log if result is NULL.
if ($check_result['result']) {
_security_review_log($module, $check_name, '@title check passed', $variables, WATCHDOG_INFO);
}
else {
_security_review_log($module, $check_name, '@title check failed', $variables, WATCHDOG_ERROR);
}
}
return $check_result;
}