Commit 73f91709 authored by xjm's avatar xjm

Revert "Issue #2625696 by chx, alexpott, benjy, mikeryan, andypost,...

Revert "Issue #2625696 by chx, alexpott, benjy, mikeryan, andypost, phenaproxima: Make migrations themselves plugins instead of config entities"

This reverts commit 694994fe.
parent 803834c7
......@@ -16,3 +16,15 @@ block_content.type.*:
description:
type: text
label: 'Description'
migrate.source.d6_box:
type: migrate_source_sql
label: 'Drupal 6 box'
mapping:
constants:
type: mapping
label: 'Constants'
mapping:
type:
type: string
label: 'Type'
......@@ -30,7 +30,7 @@ protected function setUp() {
$this->installSchema('book', ['book']);
$this->installSchema('node', ['node_access']);
$this->migrateContent();
$this->executeMigrations(['d6_node', 'd6_book']);
$this->executeMigration('d6_book');
}
/**
......
migrate.source.d6_comment:
type: migrate_source_sql
label: 'Drupal 6 comment'
mapping:
constants:
type: mapping
label: 'Constants'
mapping:
entity_type:
type: string
label: 'Entity type'
migrate.source.d6_comment_variable_per_comment_type:
type: migrate_source_sql
label: 'Drupal 6 comment variable'
mapping:
constants:
type: migrate_entity_constant
label: 'Constants'
migrate.source.d6_comment_entity_form_display_subject:
type: migrate_source_sql
label: 'Drupal 6 comment subject entity form display'
mapping:
constants:
type: migrate_entity_constant
label: 'Constants'
migrate.source.d6_comment_variable:
type: migrate_source_sql
label: 'Drupal 6 comment variable'
mapping:
constants:
type: migrate_entity_constant
label: 'Constants'
......@@ -40,7 +40,6 @@ protected function setUp() {
$this->migrateContent();
$this->executeMigrations([
'd6_node',
'd6_comment_type',
'd6_comment_field',
'd6_comment_field_instance',
......
......@@ -40,12 +40,12 @@ protected function setUp() {
// We only need the test_content_type node migration to run for real, so
// mock all the others.
$this->prepareMigrations(array(
'd7_node' => array(
'd7_node:*' => array(
array(array(0), array(0)),
),
));
$this->executeMigrations([
'd7_node:test_content_type',
'd7_node__test_content_type',
'd7_comment_type',
'd7_comment',
]);
......
......@@ -9,6 +9,7 @@
use Drupal\comment\CommentTypeInterface;
use Drupal\comment\Entity\CommentType;
use Drupal\migrate\Entity\Migration;
use Drupal\migrate_drupal\Tests\d7\MigrateDrupal7TestBase;
/**
......@@ -59,8 +60,9 @@ public function testMigration() {
$this->assertEntity('comment_node_forum', 'Forum topic comment');
$this->assertEntity('comment_node_test_content_type', 'Test content type comment');
$migration = $this->getMigration('d7_comment_type');
// Validate that the source count and processed count match up.
/** @var \Drupal\migrate\Entity\MigrationInterface $migration */
$migration = Migration::load('d7_comment_type');
$this->assertIdentical($migration->getSourcePlugin()->count(), $migration->getIdMap()->processedCount());
}
......
# Schema for the migration source plugins.
migrate.source.contact_settings:
type: migrate_source_sql
label: 'Drupal contact settings'
mapping:
variables:
type: sequence
label: 'Variables'
sequence:
type: string
label: 'Variable'
migrate.source.d6_field_instance_per_form_display:
type: migrate_source_sql
label: 'Drupal 6 field instance form display'
mapping:
constants:
type: migrate_entity_constant
label: 'Constants'
migrate.source.d6_field:
type: migrate_source_sql
label: 'Drupal 6 field'
mapping:
constants:
type: migrate_entity_constant
label: 'Constants'
migrate.source.d6_field_formatter_settings:
type: migrate_source_sql
label: 'Drupal 6 field formatter settings'
mapping:
constants:
type: migrate_entity_constant
label: 'Constants'
migrate.source.d6_field_instance:
type: migrate_source_sql
label: 'Drupal 6 field instance'
mapping:
constants:
type: migrate_entity_constant
label: 'Constants'
migrate.source.d6_field_instance_per_view_mode:
type: migrate_source_sql
label: 'Drupal 6 field formatter'
mapping:
constants:
type: migrate_entity_constant
label: 'Constants'
migrate.source.d7_field:
type: migrate_source_sql
label: 'Drupal 7 field'
mapping:
constants:
type: migrate_entity_constant
label: 'Constants'
migrate.source.d7_field_instance:
type: migrate_source_sql
label: 'Drupal 7 field instance'
mapping:
constants:
type: migrate_entity_constant
label: 'Constants'
migrate.source.d7_field_instance_per_form_display:
type: migrate_source_sql
label: 'Drupal 7 field instance per form display'
mapping:
constants:
type: migrate_entity_constant
label: 'Constants'
migrate.source.d7_field_instance_per_view_mode:
type: migrate_source_sql
label: 'Drupal 7 field instance per view mode'
mapping:
constants:
type: migrate_entity_constant
label: 'Constants'
......@@ -2,8 +2,9 @@ id: d6_field
label: Field configuration
migration_tags:
- Drupal 6
class: Drupal\migrate_drupal\Plugin\migrate\CckMigration
cck_plugin_method: processField
builder:
plugin: d6_cck_migration
cck_plugin_method: processField
source:
plugin: d6_field
constants:
......
......@@ -2,8 +2,9 @@ id: d6_field_formatter_settings
label: Field formatter configuration
migration_tags:
- Drupal 6
class: Drupal\migrate_drupal\Plugin\migrate\CckMigration
cck_plugin_method: processFieldFormatter
builder:
plugin: d6_cck_migration
cck_plugin_method: processFieldFormatter
source:
plugin: d6_field_instance_per_view_mode
constants:
......
......@@ -2,8 +2,9 @@ id: d6_field_instance
label: Field instance configuration
migration_tags:
- Drupal 6
class: Drupal\migrate_drupal\Plugin\migrate\CckMigration
cck_plugin_method: processFieldInstance
builder:
plugin: d6_cck_migration
cck_plugin_method: processFieldInstance
source:
plugin: d6_field_instance
constants:
......
......@@ -2,8 +2,9 @@ id: d6_field_instance_widget_settings
label: Field instance widget configuration
migration_tags:
- Drupal 6
class: Drupal\migrate_drupal\Plugin\migrate\CckMigration
cck_plugin_method: processFieldWidget
builder:
plugin: d6_cck_migration
cck_plugin_method: processFieldWidget
source:
plugin: d6_field_instance_per_form_display
constants:
......
......@@ -8,6 +8,7 @@
namespace Drupal\field\Tests\Migrate\d6;
use Drupal\Core\Entity\Entity\EntityViewDisplay;
use Drupal\migrate\Entity\Migration;
use Drupal\migrate_drupal\Tests\d6\MigrateDrupal6TestBase;
/**
......@@ -180,7 +181,7 @@ public function testEntityDisplaySettings() {
$component = $display->getComponent('field_test_datetime');
$this->assertIdentical($expected, $component);
// Test that our Id map has the correct data.
$this->assertIdentical(array('node', 'story', 'teaser', 'field_test'), $this->getMigration('d6_field_formatter_settings')->getIdMap()->lookupDestinationID(array('story', 'teaser', 'node', 'field_test')));
$this->assertIdentical(array('node', 'story', 'teaser', 'field_test'), Migration::load('d6_field_formatter_settings')->getIdMap()->lookupDestinationID(array('story', 'teaser', 'node', 'field_test')));
}
}
......@@ -8,6 +8,7 @@
namespace Drupal\field\Tests\Migrate\d6;
use Drupal\field\Entity\FieldStorageConfig;
use Drupal\migrate\Entity\Migration;
use Drupal\migrate_drupal\Tests\d6\MigrateDrupal6TestBase;
/**
......@@ -97,7 +98,7 @@ public function testFields() {
// Validate that the source count and processed count match up.
/** @var \Drupal\migrate\Entity\MigrationInterface $migration */
$migration = $this->getMigration('d6_field');
$migration = Migration::load('d6_field');
$this->assertIdentical($migration->getSourcePlugin()->count(), $migration->getIdMap()->processedCount());
// Check that we've reported on a conflict in widget_types.
......
......@@ -9,6 +9,7 @@
use Drupal\field\Entity\FieldStorageConfig;
use Drupal\field\FieldStorageConfigInterface;
use Drupal\migrate\Entity\Migration;
use Drupal\migrate_drupal\Tests\d7\MigrateDrupal7TestBase;
/**
......@@ -115,9 +116,8 @@ public function testFields() {
// Validate that the source count and processed count match up.
/** @var \Drupal\migrate\Entity\MigrationInterface $migration */
$migration = $this->getMigration('d7_field');
$migration = Migration::load('d7_field');
$this->assertIdentical($migration->getSourcePlugin()->count(), $migration->getIdMap()->processedCount());
}
}
migrate.destination.entity:file:
type: migrate_destination
label: 'File'
mapping:
source_path_property:
type: string
label: 'Source path'
urlencode:
type: boolean
label: 'Whether to urlencode incoming file paths'
......@@ -121,3 +121,11 @@ field.formatter.settings.file_extension:
extension_detect_tar:
type: boolean
label: 'Detect tar'
migrate.source.d6_upload_instance:
type: migrate_source_sql
label: 'Drupal 6 upload form display'
mapping:
constants:
type: migrate_entity_constant
label: 'Constants'
<?php
/**
* @file
* Contains \Drupal\file\Tests\Migrate\d6\FileMigrationTestTrait.
*/
namespace Drupal\file\Tests\Migrate\d6;
/**
* Helper for setting up a file migration test.
*/
trait FileMigrationTestTrait {
/**
* Setup and execute d6_file migration.
*/
protected function setUpMigratedFiles() {
$this->installEntitySchema('file');
$this->installConfig(['file']);
/** @var \Drupal\migrate\Entity\MigrationInterface $migration */
$migration_plugin_manager = $this->container->get('plugin.manager.migration');
/** @var \Drupal\migrate\Plugin\migration $migration */
$migration = $migration_plugin_manager->createInstance('d6_file');
$source = $migration->get('source');
$source['site_path'] = 'core/modules/simpletest';
$migration->set('source', $source);
$this->executeMigration($migration);
}
}
......@@ -10,6 +10,7 @@
use Drupal\Component\Utility\Random;
use Drupal\file\Entity\File;
use Drupal\file\FileInterface;
use Drupal\migrate\Entity\Migration;
use Drupal\migrate\Tests\MigrateDumpAlterInterface;
use Drupal\Core\Database\Database;
use Drupal\migrate_drupal\Tests\d6\MigrateDrupal6TestBase;
......@@ -22,8 +23,6 @@
*/
class MigrateFileTest extends MigrateDrupal6TestBase implements MigrateDumpAlterInterface {
use FileMigrationTestTrait;
/**
* The filename of a file used to test temporary file migration.
*
......@@ -37,7 +36,15 @@ class MigrateFileTest extends MigrateDrupal6TestBase implements MigrateDumpAlter
protected function setUp() {
parent::setUp();
$this->setUpMigratedFiles();
$this->installEntitySchema('file');
$this->installConfig(['file']);
/** @var \Drupal\migrate\Entity\MigrationInterface $migration */
$migration = Migration::load('d6_file');
$source = $migration->get('source');
$source['site_path'] = 'core/modules/simpletest';
$migration->set('source', $source);
$this->executeMigration($migration);
}
/**
......@@ -77,9 +84,8 @@ public function testFiles() {
$this->assertEntity(5, 'html-1.txt', '24', 'public://html-1.txt', 'text/plain', '1');
// Test that we can re-import and also test with file_directory_path set.
$migration_plugin_manager = $this->container->get('plugin.manager.migration');
\Drupal::database()
->truncate($migration_plugin_manager->createInstance('d6_file')->getIdMap()->mapTableName())
->truncate(Migration::load('d6_file')->getIdMap()->mapTableName())
->execute();
// Update the file_directory_path.
......@@ -94,7 +100,7 @@ public function testFiles() {
->condition('name', 'file_directory_temp')
->execute();
$migration = $migration_plugin_manager->createInstance('d6_file');
$migration = \Drupal::entityManager()->getStorage('migration')->loadUnchanged('d6_file');
$this->executeMigration($migration);
$file = File::load(2);
......
......@@ -8,6 +8,7 @@
namespace Drupal\file\Tests\Migrate\d6;
use Drupal\Core\Entity\Entity\EntityViewDisplay;
use Drupal\migrate\Entity\Migration;
use Drupal\migrate_drupal\Tests\d6\MigrateDrupal6TestBase;
/**
......@@ -43,7 +44,7 @@ public function testUploadEntityDisplay() {
$component = $display->getComponent('upload');
$this->assertTrue(is_null($component));
$this->assertIdentical(array('node', 'page', 'default', 'upload'), $this->getMigration('d6_upload_entity_display')->getIdMap()->lookupDestinationID(array('page')));
$this->assertIdentical(array('node', 'page', 'default', 'upload'), Migration::load('d6_upload_entity_display')->getIdMap()->lookupDestinationID(array('page')));
}
}
......@@ -8,6 +8,7 @@
namespace Drupal\file\Tests\Migrate\d6;
use Drupal\Core\Entity\Entity\EntityFormDisplay;
use Drupal\migrate\Entity\Migration;
use Drupal\migrate_drupal\Tests\d6\MigrateDrupal6TestBase;
/**
......@@ -43,7 +44,7 @@ public function testUploadEntityFormDisplay() {
$component = $display->getComponent('upload');
$this->assertTrue(is_null($component));
$this->assertIdentical(array('node', 'page', 'default', 'upload'), $this->getMigration('d6_upload_entity_form_display')->getIdMap()->lookupDestinationID(array('page')));
$this->assertIdentical(array('node', 'page', 'default', 'upload'), Migration::load('d6_upload_entity_form_display')->getIdMap()->lookupDestinationID(array('page')));
}
}
......@@ -8,6 +8,7 @@
namespace Drupal\file\Tests\Migrate\d6;
use Drupal\field\Entity\FieldStorageConfig;
use Drupal\migrate\Entity\Migration;
use Drupal\migrate_drupal\Tests\d6\MigrateDrupal6TestBase;
/**
......@@ -31,7 +32,7 @@ protected function setUp() {
public function testUpload() {
$field_storage = FieldStorageConfig::load('node.upload');
$this->assertIdentical('node.upload', $field_storage->id());
$this->assertIdentical(array('node', 'upload'), $this->getMigration('d6_upload_field')->getIdMap()->lookupDestinationID(array('')));
$this->assertIdentical(array('node', 'upload'), Migration::load('d6_upload_field')->getIdMap()->lookupDestinationID(array('')));
}
}
......@@ -8,6 +8,7 @@
namespace Drupal\file\Tests\Migrate\d6;
use Drupal\field\Entity\FieldConfig;
use Drupal\migrate\Entity\Migration;
use Drupal\migrate_drupal\Tests\d6\MigrateDrupal6TestBase;
/**
......@@ -43,7 +44,7 @@ public function testUploadFieldInstance() {
$field = FieldConfig::load('node.article.upload');
$this->assertTrue(is_null($field));
$this->assertIdentical(array('node', 'page', 'upload'), $this->getMigration('d6_upload_field_instance')->getIdMap()->lookupDestinationID(array('page')));
$this->assertIdentical(array('node', 'page', 'upload'), Migration::load('d6_upload_field_instance')->getIdMap()->lookupDestinationID(array('page')));
}
}
......@@ -8,6 +8,7 @@
namespace Drupal\file\Tests\Migrate\d6;
use Drupal\file\Entity\File;
use Drupal\migrate\Entity\Migration;
use Drupal\migrate_drupal\Tests\d6\MigrateDrupal6TestBase;
use Drupal\node\Entity\Node;
......@@ -54,7 +55,7 @@ protected function setUp() {
$this->migrateContent();
// Since we are only testing a subset of the file migration, do not check
// that the full file migration has been run.
$migration = $this->getMigration('d6_upload');
$migration = Migration::load('d6_upload');
$migration->set('requirements', []);
$this->executeMigration($migration);
}
......
......@@ -34,8 +34,8 @@ protected function setUp() {
$fs->mkdir('public://sites/default/files', NULL, TRUE);
file_put_contents('public://sites/default/files/cube.jpeg', str_repeat('*', 3620));
/** @var \Drupal\migrate\Plugin\Migration $migration */
$migration = $this->getMigration('d7_file');
/** @var \Drupal\migrate\Entity\MigrationInterface $migration */
$migration = entity_load('migration', 'd7_file');
// Set the destination plugin's source_base_path configuration value, which
// would normally be set by the user running the migration.
$migration->set('destination', [
......
migrate.source.d6_imagecache_presets:
type: migrate_source_sql
label: 'Drupal 6 ImageCache Presets'
......@@ -9,6 +9,7 @@
use Drupal\Core\Database\Database;
use Drupal\image\Entity\ImageStyle;
use Drupal\migrate\Entity\Migration;
use Drupal\migrate\Entity\MigrationInterface;
use Drupal\migrate\Exception\RequirementsException;
use Drupal\migrate_drupal\Tests\d6\MigrateDrupal6TestBase;
......@@ -41,7 +42,7 @@ public function testMissingTable() {
->execute();
try {
$this->getMigration('d6_imagecache_presets')
Migration::load('d6_imagecache_presets')
->getSourcePlugin()
->checkRequirements();
$this->fail('Did not catch expected RequirementsException.');
......
migrate.source.menu_link:
type: migrate_source_sql
label: 'Menu link'
mapping:
constants:
type: migrate_entity_constant
label: 'Constants'
# Basic data types for Migrate.
migrate_plugin:
type: mapping
mapping:
plugin:
type: string
label: 'Plugin'
migrate_destination:
type: migrate_plugin
label: 'Destination'
mapping:
overwrite_properties:
type: sequence
label: 'Properties to overwrite'
sequence:
type: string
label: 'Property'
migrate_source:
type: migrate_plugin
label: 'Source'
mapping:
constants:
type: ignore
label: 'Constants'
migrate_process:
type: migrate_plugin
label: 'Process'
# Base schema for migrate source plugins that extend
# \Drupal\migrate\Plugin\migrate\source\SqlBase.
migrate_source_sql:
type: migrate_source
mapping:
target:
type: string
label: 'The migration database target'
# Schema for the migrate destination plugins.
migrate.destination.*:
type: migrate_destination
label: 'Default destination'
mapping:
no_stub:
type: boolean
label: 'Whether stubbing is allowed.'
default: false
migrate.destination.config:
type: migrate_destination
label: 'Config'
mapping:
config_name:
type: string
label: 'Configuration name'
# Schema for the migrate process plugins.
migrate.process.*:
type: migrate_process
label: 'Default process'
migrate.process.callback:
type: migrate_process
label: 'Callback process'
mapping:
callback:
type: string
label: 'Callback'
migrate.process.concat:
type: migrate_process
label: 'Concat process'
mapping:
delimiter:
type: string
label: 'Delimiter'
migrate.process.dedupe_entity:
type: migrate_process
label: 'Dedupe Entity process'
mapping:
entity_type:
type: string
label: 'Entity type'
field:
type: string
label: 'Field name'
postfix:
type: string
label: 'Postfix'
start:
type: integer
label: 'Start'
length:
type: integer
label: 'Length'
migrate.process.explode:
type: migrate_process
label: 'Explode process'
mapping:
delimiter:
type: string
label: 'Delimiter'
limit: