You are here

public function MigrateManager::isComplete in Workbench Moderation to Content Moderation 8

Determine if the migration is complete.

The migration is complete if:

  • It is marked as finished.
  • There are no states left in the state key value store.

Return value

bool True if the migration completed successfully. Otherwise, false.

File

src/MigrateManager.php, line 156

Class

MigrateManager
Manages migrating from WBM to CM.

Namespace

Drupal\wbm2cm

Code

public function isComplete() {
  if ($this
    ->isFinished()) {

    // @todo is there a less costly way to compute that the key value storage is empty?
    $states = $this->stateMapStore
      ->getAll();
    if (empty($states)) {
      $this->logger
        ->debug('isComplete was called, it isFinished, and there are NO states remaining in storage.');
      return TRUE;
    }
    else {
      $this->logger
        ->debug('isComplete was called, it isFinished, but there are %count states remaining in storage.', [
        '%count' => count($states),
      ]);
      return FALSE;
    }
  }
  $this->logger
    ->debug('isComplete was called and returned FALSE.');
  return FALSE;
}