function perfmon_store_results in Performance monitor 8
Same name and namespace in other branches
- 7 perfmon.module \perfmon_store_results()
Store test results.
2 calls to perfmon_store_results()
- perfmon_run_store in ./
perfmon.module - Run the perfmon test and store the results.
- _perfmon_batch_finished in ./
perfmon.module - Finished callback for Batch processing the checklist.
File
- ./
perfmon.module, line 662 - Stand-alone perfmon test system.
Code
function perfmon_store_results($results) {
$saved = $to_save = 0;
foreach ($results as $testname => $test) {
\Drupal::database()
->delete('perfmon')
->condition('testname', $testname)
->execute();
$to_save++;
$record = [
'testname' => $testname,
'result' => $test['result'],
'lastrun' => $test['lastrun'] ? $test['lastrun'] : time(),
];
$result = \Drupal::database()
->insert('perfmon')
->fields($record)
->execute();
_perfmon_log($testname, 'test :@perfmon_reuslt:', [
'@perfmon_reuslt' => $result,
]);
if ($result) {
$saved++;
}
else {
_perfmon_log($testname, 'Unable to store test @testname', [
'@testname' => $testname,
]);
}
}
return $to_save == $saved ? TRUE : FALSE;
}