You are here

function computing_last_success in Drupal Computing 7.2

Return the record that has run successfully most recently.

File

./computing.module, line 486

Code

function computing_last_success($app_name, $command) {
  $query = db_select('computing_record')
    ->fields('computing_record', array(
    'id',
  ))
    ->condition('application', $app_name)
    ->condition('command', $command)
    ->condition('status', 'SCF')
    ->orderBy('changed', 'DESC')
    ->orderBy('id', 'DESC')
    ->range(0, 1);
  $id = $query
    ->execute()
    ->fetchField();
  if ($id) {
    return computing_load($id);
  }
  else {
    return FALSE;
  }
}