You are here

function hook_hosting_task_update_status in Hosting 6.2

Same name and namespace in other branches
  1. 7.4 hosting.api.php \hook_hosting_task_update_status()
  2. 7.3 hosting.api.php \hook_hosting_task_update_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

task/hosting_task.api.php, line 115
Hooks provided by the hosting tasks module.

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');
  }
}