You are here

protected function Migration::beginProcess in Migrate 7.2

Same name and namespace in other branches
  1. 6.2 includes/migration.inc \Migration::beginProcess()

Override MigrationBase::beginProcess, to make sure the map/message tables are present.

Parameters

int $newStatus: Migration::STATUS_IMPORTING or Migration::STATUS_ROLLING_BACK

Overrides MigrationBase::beginProcess

File

includes/migration.inc, line 488
Defines the base class for import/rollback processes.

Class

Migration
The base class for all import objects. This is where most of the smarts of the migrate module resides. Migrations are created by deriving from this class, and in the constructor (after calling parent::__construct()) initializing at a minimum the name,…

Code

protected function beginProcess($newStatus) {
  parent::beginProcess($newStatus);

  // Do some standard setup
  if (isset($this->options['feedback']) && isset($this->options['feedback']['value']) && isset($this->options['feedback']['unit'])) {
    $this->feedback = $this->options['feedback']['value'];
    $this->feedback_unit = $this->options['feedback']['unit'];
    if ($this->feedback_unit == 'item') {
      $this->feedback_unit = 'items';
    }
    elseif ($this->feedback_unit == 'second') {
      $this->feedback_unit = 'seconds';
    }
  }
  $this->lastfeedback = $this->starttime;
  $this->total_processed = $this->total_successes = $this->processed_since_feedback = $this->successes_since_feedback = 0;

  // Call pre-process methods
  if ($this->status == Migration::STATUS_IMPORTING) {
    $this
      ->preImport();
  }
  elseif ($this->status == Migration::STATUS_ROLLING_BACK) {
    $this
      ->preRollback();
  }
}