function hook_hosting_TASK_TYPE_task_rollback

7.x-3.x hosting.api.php hook_hosting_TASK_TYPE_task_rollback($task, $data)

Perform actions when a task has failed and has been rolled back.

Replace TASK_TYPE with the type of task that if rolled back you will be notified of.


object $task: The hosting task that has failed and has been rolled back.

array $data: An associative array of the drush output of the backend task from drush_backend_output(). The array should contain at least the following:

  • "output": The raw output from the drush command executed.
  • "error_status": The error status of the command run on the backend.
  • "log": The drush log messages.
  • "error_log": The list of errors that occurred when running the command.
  • "context": The drush options for the backend command, this may contain options that were set when the command ran, or options that were set by the command itself.

See also



Related topics


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


function hook_hosting_TASK_TYPE_task_rollback($task, $data) {
  // From hosting_site_hosting_install_task_rollback().

  // @TODO : we need to check the returned list of errors, not the code.
  if (drush_cmp_error('PROVISION_DRUPAL_SITE_INSTALLED')) {
    // Site has already been installed. Try to import instead.
    drush_log(dt("This site appears to be installed already. Generating an import task."));
    hosting_add_task($task->rid, 'import');
  else {
    $task->ref->no_verify = TRUE;
    $task->ref->site_status = HOSTING_SITE_DISABLED;