You are here

function hosting_task_parse_log in Hosting 7.3

Same name and namespace in other branches
  1. 6.2 task/hosting_task.module \hosting_task_parse_log()
  2. 7.4 task/hosting_task.module \hosting_task_parse_log()

Parse a task's log, and return its status accordingly.

Parameters

int $vid: The revision ID of a task node.

Return value

int The task's status error code.

1 call to hosting_task_parse_log()
hosting_task_update_status in task/hosting_task.module
Set a task's status according to its log.

File

task/hosting_task.module, line 1935
Web server node type is defined here.

Code

function hosting_task_parse_log($vid) {

  // Assume the best.
  $update = HOSTING_TASK_SUCCESS;
  $result = db_query('SELECT type FROM {hosting_task_log} WHERE vid = :vid', array(
    ':vid' => $vid,
  ));
  foreach ($result as $status) {
    if ($status->type == 'error' || $status->type == 'failed') {
      $update = HOSTING_TASK_ERROR;
    }
    elseif ($update != HOSTING_TASK_ERROR && $status->type == 'warning') {
      $update = HOSTING_TASK_WARNING;
    }
  }
  return $update;
}