You are here

function hosting_task_update_status in Hosting 7.4

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

Set a task's status according to its log.

Parameters

object|int $task: A task object or the revision ID of a task node.

Return value

int The task's status error code.

2 calls to hosting_task_update_status()
hosting_task_drush_update_status in task/hosting_task.drush.inc
Shutdown function to catch any task status.
hosting_task_update_status_form_submit in task/hosting_task.module
Submit handler for the 'update status' button.

File

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

Code

function hosting_task_update_status($task) {
  if (is_numeric($task)) {
    $vid = $task;
    $task = node_load(NULL, $task);
  }
  else {
    $vid = $task->vid;
  }

  // Get the status of the task by parsing the log.
  $status = hosting_task_parse_log($vid);
  db_update('hosting_task')
    ->fields(array(
    'task_status' => $status,
  ))
    ->condition('vid', $vid)
    ->execute();

  // Invoke hook_hosting_task_update_status().
  module_invoke_all('hosting_task_update_status', $task, $status);
  return $status;
}