You are here

public function MigrateBatchExecutable::checkStatus in Migrate Tools 8.4

Same name and namespace in other branches
  1. 8.5 src/MigrateBatchExecutable.php \Drupal\migrate_tools\MigrateBatchExecutable::checkStatus()

Checks for exceptional conditions, and display feedback.

Overrides MigrateExecutable::checkStatus

File

src/MigrateBatchExecutable.php, line 269

Class

MigrateBatchExecutable
Defines a migrate executable class for batch migrations through UI.

Namespace

Drupal\migrate_tools

Code

public function checkStatus() {
  $status = parent::checkStatus();
  if ($status == MigrationInterface::RESULT_COMPLETED) {

    // Do some batch housekeeping.
    $context = $this
      ->getBatchContext();
    if (!empty($context['sandbox']) && $context['sandbox']['operation'] == MigrateBatchExecutable::BATCH_IMPORT) {
      $context['sandbox']['batch_counter']++;
      if ($context['sandbox']['batch_counter'] >= $context['sandbox']['batch_limit']) {
        $status = MigrationInterface::RESULT_INCOMPLETE;
      }
    }
  }
  return $status;
}