function hook_hosting_task_update_status

7.x-3.x hosting.api.php hook_hosting_task_update_status($task, $status)

Reacts to tasks ending, with any status.

Parameters

$task: The task that has just completed.

$status: The status of that task. Can be HOSTING_TASK_SUCCESS, etc.

Related topics

1 invocation of hook_hosting_task_update_status()
hosting_task_update_status in task/hosting_task.module
Set a task's status according to its log.

File

./hosting.api.php, line 343
Hooks provided by the hosting module, and some other random ones.

Code

function hook_hosting_task_update_status($task, $status) {

  // A task's "RID" is a node ID for the object the task is run on. (Site, Platform, Server, etc)
  $node = node_load($task->rid);

  // On error, output a new message.
  if ($status == HOSTING_TASK_ERROR) {
    drush_log(dt("!title: !task task ended in an Error", array(
      '!task' => $task->task_type,
      '!title' => $node->title,
    )), 'error');
  }
  else {
    drush_log(" Task completed successfully: " . $task->task_type, 'ok');
    drush_log(dt("!title: !task task ended with !status", array(
      '!task' => $task->task_type,
      '!title' => $node->title,
      '!status' => _hosting_parse_error_code($status),
    )), 'ok');
  }
}