You are here

function perfmon_store_results in Performance monitor 7

Same name and namespace in other branches
  1. 8 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 143
TODO: Enter file description here.

Code

function perfmon_store_results($results) {
  $saved = $to_save = 0;
  foreach ($results as $testname => $test) {
    db_delete('perfmon')
      ->condition('testname', $testname)
      ->execute();
    $to_save++;
    $record = array(
      'testname' => $testname,
      'result' => $test['result'],
      'lastrun' => $test['lastrun'] ? $test['lastrun'] : REQUEST_TIME,
    );
    if (drupal_write_record('perfmon', $record) == SAVED_NEW) {
      $saved++;
    }
    else {
      _perfmon_log($testname, 'Unable to store test !testname', array(
        '!testname' => $testname,
      ), WATCHDOG_ERROR);
    }
  }
  return $to_save == $saved ? TRUE : FALSE;
}