You are here

function hook_hosting_TASK_TYPE_task_rollback in Hosting 6.2

Same name and namespace in other branches
  1. 7.4 hosting.api.php \hook_hosting_TASK_TYPE_task_rollback()
  2. 7.3 hosting.api.php \hook_hosting_TASK_TYPE_task_rollback()

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.

Parameters

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

$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

drush_hosting_hosting_task_rollback()

drush_backend_output()

Related topics

3 functions implement hook_hosting_TASK_TYPE_task_rollback()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

hosting_site_hosting_import_task_rollback in site/hosting_site.drush.inc
Implementation of the hosting_failed_install hook
hosting_site_hosting_install_task_rollback in site/hosting_site.drush.inc
Implementation of the hosting_failed_install hook
hosting_site_hosting_verify_task_rollback in site/hosting_site.drush.inc
Implementation of the hosting_failed_install hook

File

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

Code

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;
    node_save($task->ref);
  }
}