You are here

protected function Migration::checkStatus in Migrate 6.2

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

Standard top-of-loop stuff, common between rollback and import - check for exceptional conditions, and display feedback.

2 calls to Migration::checkStatus()
Migration::import in includes/migration.inc
Perform an import operation - migrate items from source to destination.
Migration::rollback in includes/migration.inc
Perform a rollback operation - remove migrated items from the destination.

File

includes/migration.inc, line 998
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 checkStatus() {
  if ($this
    ->memoryExceeded()) {
    return MigrationBase::RESULT_INCOMPLETE;
  }
  if ($this
    ->timeExceeded()) {
    return MigrationBase::RESULT_INCOMPLETE;
  }
  if ($this
    ->getStatus() == Migration::STATUS_STOPPING) {
    return MigrationBase::RESULT_STOPPED;
  }

  // If feedback is requested, produce a progress message at the proper time
  if (isset($this->feedback)) {
    if ($this->feedback_unit == 'seconds' && time() - $this->lastfeedback >= $this->feedback || $this->feedback_unit == 'items' && $this->processed_since_feedback >= $this->feedback) {
      $this
        ->progressMessage(MigrationBase::RESULT_INCOMPLETE);
    }
  }
  return MigrationBase::RESULT_COMPLETED;
}