You are here

function migrate_devel_rebuild_migrations in Migrate Devel 8.2

Same name and namespace in other branches
  1. 8 migrate_devel.drush.inc \migrate_devel_rebuild_migrations()

Clears cache for migrations and reverts config of migrations if needed.

1 call to migrate_devel_rebuild_migrations()
migrate_devel_drush_command_alter in ./migrate_devel.drush.inc
Implements hook_drush_command_alter().

File

./migrate_devel.drush.inc, line 38
File for Drush Integration.

Code

function migrate_devel_rebuild_migrations() {

  // @TODO: Remove this legacy support of migrate_plus.
  // After #2752335, it uses the default Migrate Plugin Manager

  /* @var $discovery CachedDiscoveryInterface */
  if (\Drupal::hasService('plugin.manager.config_entity_migration')) {
    $discovery = \Drupal::service('plugin.manager.config_entity_migration');
  }
  else {
    $discovery = \Drupal::service('plugin.manager.migration');
  }

  // Reset cached migrations
  $discovery
    ->clearCachedDefinitions();

  /* @var $discovery CachedDiscoveryInterface */
  if (\Drupal::moduleHandler()
    ->moduleExists('migrate_plus')) {
    migrate_devel_revert_migrate_config($discovery);
  }
  drush_log(dt('Reset Cached Migrations'), LogLevel::DEBUG);
}