public function MigrationBase::processImport in Migrate 6.2
Same name and namespace in other branches
- 7.2 includes/base.inc \MigrationBase::processImport()
Perform an operation during the import phase
Parameters
array $options: List of options provided (usually from a drush command). Specific to the derived class.
File
- includes/
base.inc, line 897 - 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 processImport(array $options = array()) {
if ($this->enabled) {
$return = MigrationBase::RESULT_COMPLETED;
if (method_exists($this, 'import')) {
$this->options = $options;
if (!isset($options['force']) || !$options['force']) {
if (!$this
->dependenciesComplete()) {
return MigrationBase::RESULT_SKIPPED;
}
}
$this
->beginProcess(MigrationBase::STATUS_IMPORTING);
try {
$return = $this
->import();
} catch (Exception $exception) {
// If something bad happened, make sure we clear the semaphore
$this
->endProcess();
throw $exception;
}
if ($return == MigrationBase::RESULT_COMPLETED && isset($this->total_successes)) {
$overallThroughput = round(60 * $this->total_successes / (microtime(TRUE) - $this->starttime));
}
else {
$overallThroughput = 0;
}
$this
->endProcess($overallThroughput);
}
}
else {
$return = MigrationBase::RESULT_DISABLED;
}
return $return;
}