You are here

function _perfmon_run_test in Performance monitor 7

Same name and namespace in other branches
  1. 8 perfmon.module \_perfmon_run_test()

Run a single Security Review check.

2 calls to _perfmon_run_test()
_perfmon_batch_op in ./perfmon.module
Operation function called by Batch.
_perfmon_run in ./perfmon.inc
Private function the review and returns the full results.

File

./perfmon.inc, line 49
Stand-alone perfmon test system.

Code

function _perfmon_run_test($test_name, $test, $log, $store = FALSE) {
  $last_test = array();
  if ($store) {

    // Get the results of the last check.
    $last_test = perfmon_get_last_test($test_name);
  }
  $test_result = array();
  $return = array(
    'result' => NULL,
  );
  $function = $test['callback'];
  if (function_exists($function)) {
    $return = call_user_func($function, $last_test);
  }
  $test_result = array_merge($test, $return);
  $test_result['lastrun'] = REQUEST_TIME;
  if ($log && !is_null($return['result'])) {

    // Do not log if result is NULL.
    $variables = array(
      '!name' => $test_result['title'],
    );
    _perfmon_log($test_name, '!name tested', $variables, WATCHDOG_INFO);
  }
  return $test_result;
}