You are here

public function MigrationBase::processRollback in Migrate 7.2

Same name and namespace in other branches
  1. 6.2 includes/base.inc \MigrationBase::processRollback()

Perform an operation during the rollback phase.

Parameters

array $options: List of options provided (usually from a drush command). Specific to the derived class.

File

includes/base.inc, line 1100
Defines the base class for migration processes.

Class

MigrationBase
The base class for all objects representing distinct steps in a migration process. Most commonly these will be Migration objects which actually import data from a source into a Drupal destination, but by deriving classes directly from MigrationBase…

Code

public function processRollback(array $options = array()) {
  if ($this->enabled) {
    $return = MigrationBase::RESULT_COMPLETED;
    if (method_exists($this, 'rollback')) {
      $this->options = $options;
      if (!isset($options['force'])) {
        if (!$this
          ->dependenciesComplete(TRUE)) {
          return MigrationBase::RESULT_SKIPPED;
        }
      }
      $this
        ->beginProcess(MigrationBase::STATUS_ROLLING_BACK);
      try {
        $return = $this
          ->rollback();
      } catch (Exception $exception) {

        // If something bad happened, make sure we clear the semaphore
        $this
          ->endProcess();
        throw $exception;
      }
      $this
        ->endProcess();
    }
  }
  else {
    $return = MigrationBase::RESULT_DISABLED;
  }
  return $return;
}