You are here

public static function Migration::getActiveStep in CMS Content Sync 2.1.x

Same name and namespace in other branches
  1. 2.0.x src/Controller/Migration.php \Drupal\cms_content_sync\Controller\Migration::getActiveStep()
3 calls to Migration::getActiveStep()
Embed::site in src/Controller/Embed.php
Migration::alwaysUseV2 in src/Controller/Migration.php
Migration::runActiveStep in src/Controller/Migration.php

File

src/Controller/Migration.php, line 155

Class

Migration
Migration Embed provides methods and a UI to migrate from Content Sync v1 to Content Sync v2.

Namespace

Drupal\cms_content_sync\Controller

Code

public static function getActiveStep($avoid_recursion = false) {
  $pools = Pool::getAll();
  foreach ($pools as $pool) {
    if (!$pool
      ->v2Ready()) {
      return self::STEP_EXPORT_POOLS;
    }
  }
  $flows = Flow::getAll();
  foreach ($flows as $flow) {
    if (!$flow
      ->v2Ready()) {
      return self::STEP_EXPORT_FLOWS;
    }
  }
  if ($avoid_recursion) {
    foreach ($pools as $pool) {
      if ($pool->backend_url) {
        return self::STEP_SWITCH;
      }
    }
    return self::STEP_DONE;
  }
  foreach ($pools as $pool) {
    if (!$pool
      ->useV2()) {
      return self::STEP_SWITCH;
    }
  }
  return self::STEP_DONE;
}