Commit c1734c61 authored by Gábor Hojtsy's avatar Gábor Hojtsy

Issue #2936365 by quietone, mikelutz, heddn, larowlan, masipila, effulgentsia,...

Issue #2936365 by quietone, mikelutz, heddn, larowlan, masipila, effulgentsia, maxocub, Gábor Hojtsy, webchick, phenaproxima, jhodgdon, catch: Migrate UI - allow modules to declare the state of their migrations
parent 0d82715b
......@@ -8,7 +8,7 @@ source:
plugin: variable
variables:
- actions_max_stack
source_module: action
source_module: system
process:
recursion_limit: actions_max_stack
destination:
......
finished:
6:
system: action
7:
system: action
finished:
6:
aggregator: aggregator
7:
aggregator: aggregator
finished:
6:
block: block_content
7:
block: block_content
......@@ -11,7 +11,7 @@
*
* @MigrateSource(
* id = "d7_block_custom_translation",
* source_module = "block"
* source_module = "i18n_block"
* )
*/
class BlockCustomTranslation extends DrupalSqlBase {
......
finished:
6:
comment: comment
node: comment
7:
comment: comment
node: comment
finished:
6:
i18nprofile: config_translation
7:
i18n_variable: config_translation
not_finished:
6:
# language content comment settings.
locale: language
# @TODO: Move to finished when remaining Drupal 6 i18n issues are resolved.
# See https://www.drupal.org/project/drupal/issues/2208401
i18n: config_translation
# field labels and descriptions, synchronized fields.
i18ncck: config_translation
# Block, menu, taxonomy, User profiles.
i18nstrings: config_translation
i18ntaxonomy: config_translation
7:
# language content comment settings.
locale: language
# @TODO: Move to finished when remaining Drupal 7 i18n issues are resolved.
# See https://www.drupal.org/project/drupal/issues/2208401
i18n: config_translation
# field labels and descriptions, field options.
i18n_field: config_translation
i18n_string: config_translation
# localized. vocabulary language settings, taxonomy term language.
i18n_taxonomy: config_tanslation
finished:
6:
contact: contact
7:
contact: contact
finished:
6:
i18nblocks:
- block
- block_content
- content_translation
i18nmenu:
- content_translation
- menu_link_content
locale: content_translation
menu: content_translation
statistics: statistics
taxonomy: content_translation
7:
entity_translation: content_translation
i18n_block:
- block
- block_content
- content_translation
locale: content_translation
menu: content_translation
statistics: statistics
not_finished:
# Also D6 and D7 node revision translations.
6:
# @TODO: Move to finished when remaining Drupal 6 i18n issues are resolved.
# See https://www.drupal.org/project/drupal/issues/2208401
i18n: content_translation
# Taxonomy term references.
i18ntaxonomy: content_translation
7:
# @TODO: Move to finished when remaining Drupal 7 i18n issues are resolved.
# See https://www.drupal.org/project/drupal/issues/2208401
i18n: content_translation
# menu links.
i18n_menu: content_translation
# localized.
i18n_taxonomy: content_translation
......@@ -10,6 +10,8 @@ source:
constants:
entity_type: node
langcode: en
# Phone is here since it does not use a migrate field plugin.
source_module: phone
process:
entity_type: 'constants/entity_type'
status: active
......
finished:
6:
content: field
email: core
# Phone does not use a migrate field plugin so it is added here.
phone: field
7:
email: core
entityreference: core
field: field
field_sql_storage: field
number: core
finished:
6:
filefield: file
system: file
upload: file
7:
file: file
system: file
finished:
6:
filter: filter
7:
filter: filter
finished:
6:
imagecache: image
imagefield: image
7:
image: image
......@@ -7,7 +7,7 @@ source:
plugin: variable
variables:
- language_negotiation
source_module: language
source_module: locale
process:
session/parameter:
plugin: default_value
......
......@@ -7,7 +7,7 @@ source:
plugin: variable
variables:
- language_negotiation
source_module: language
source_module: locale
process:
all:
plugin: default_value
......
......@@ -13,7 +13,7 @@ source:
- locale_language_providers_weight_language
- locale_language_providers_weight_language_content
- locale_language_providers_weight_language_url
source_module: language
source_module: locale
process:
all:
plugin: language_types
......
finished:
6:
locale:
- language
- system
system: language
taxonomy: language
7:
locale:
- language
- system
finished:
6:
locale: locale
7:
locale: locale
finished:
6:
menu: menu_link_content
7:
menu: menu_link_content
......@@ -17,7 +17,7 @@ class MigrateStatusTest extends MigrateTestBase {
public function testStatus() {
// Create a minimally valid migration.
$definition = [
'id' => 'migration_status_test',
'id' => 'migrate_status_test',
'migration_tags' => ['Testing'],
'source' => ['plugin' => 'empty'],
'destination' => [
......
......@@ -25,3 +25,6 @@ services:
- '@plugin.manager.migrate.field'
- '@plugin.manager.migration'
- '@logger.channel.migrate_drupal'
migrate_drupal.migration_state:
class: Drupal\migrate_drupal\MigrationState
arguments: ['@plugin.manager.migrate.field', '@module_handler', '@messenger', '@string_translation']
# The modules listed here do not have an migration. A status of finished is
# assigned so that they appear in the will not be upgraded list on the Review
# form.
finished:
6:
nodereference: core
userreference: core
# Blog requires node.
blog: node
# The following do not have an upgrade path.
blogapi: core
calendarsignup: core
color: core
content_copy: core
content_multigroup: core
content_permissions: core
date_api: core
date_locale: core
date_php4: core
date_popup: core
date_repeat: core
date_timezone: core
date_tools: core
datepicker: core
ddblock: core
event: core
fieldgroup: core
filefield_meta: core
help: core
# i18n modules require content_translation.
i18ncontent: content_translation
i18npoll: content_translation
i18nstrings: content_translation
i18nsync: content_translation
imageapi: core
imageapi_gd: core
imageapi_imagemagick: core
imagecache_ui: core
nodeaccess: core
number: core
openid: core
php: core
ping: core
poll: core
throttle: core
tracker: core
translation: core
trigger: core
variable: core
variable_admin: core
views_export: core
views_ui: core
7:
# Blog requires node.
blog: node
# The following do not need have an upgrade path.
bulk_export: core
contextual: core
ctools: core
ctools_access_ruleset: core
ctools_ajax_sample: core
ctools_custom_content: core
dashboard: core
date_all_day: core
date_api: core
date_context: core
date_migrate: core
date_popup: core
date_repeat: core
date_repeat_field: core
date_tools: core
date_views: core
entity: core
entity_feature: core
entity_token: core
entityreference: core
field_ui: core
help: core
openid: core
overlay: core
page_manager: core
php: core
poll: core
search_embedded_form: core
search_extra_type: core
search_node_tags: core
simpletest: core
stylizer: core
term_depth: core
title: core
toolbar: core
translation: core
trigger: core
views_content: core
views_ui: core
This diff is collapsed.
name: Migrate state active test
type: module
description: Tests the 'active' migrate state
package: Testing
version: VERSION
core: 8.x
id: migrate_state_finished_test
label: Block content body field configuration
migration_tags:
- Drupal 6
- Drupal 7
- Configuration
source:
plugin: embedded_data
data_rows:
-
id: 1
ids:
id:
type: string
source_module: action
process: []
destination:
plugin: entity:field_config
destination_module: migrate_state_finished_test
id: migrate_state_finished_test1
label: Block content body field configuration
migration_tags:
- Drupal 6
- Drupal 7
- Configuration
source:
plugin: embedded_data
data_rows:
-
id: 1
ids:
id:
type: string
source_module: action
process: []
destination:
plugin: entity:field_config
destination_module: migrate_state_not_finished_test
finished:
6:
# A field migration
# migrate_state_finished_test: migrate_state_finished_test
aggregator: migrate_state_finished_test
action:
- migrate_state_finished_test
- migrate_state_not_finished_test
7:
# A field migration
# migrate_state_finished_test: migrate_state_finished_test
aggregator: migrate_state_finished_test
# Migrations
action:
- migrate_state_finished_test
- migrate_state_not_finished_test
not_finished:
7:
# Migrations
action: system
<?php
namespace Drupal\migrate_state_active_test\Plugin\migrate\field\d7;
use Drupal\migrate_drupal\Plugin\migrate\field\FieldPluginBase;
/**
* Field migration for testing migration states.
*
* @MigrateField(
* id = "fieldleft",
* core = {6,7},
* source_module = "aggregator",
* destination_module = "migrate_state_finished_test"
* )
*/
class FieldLeft extends FieldPluginBase {
}
<?php
namespace Drupal\migrate_state_active_test\Plugin\migrate\field\d7;
use Drupal\migrate_drupal\Plugin\migrate\field\FieldPluginBase;
/**
* Field migration for testing migration states.
*
* @MigrateField(
* id = "fieldright",
* core = {6,7},
* source_module = "aggregator",
* destination_module = "migrate_state_finished_test"
* )
*/
class FieldRight extends FieldPluginBase {
}
name: Migrate state no migrate_drupal.yml file test
type: module
description: Has a migration but Does not have a migrate_drupal.yml file.
package: Testing
version: VERSION
core: 8.x
id: migrate_state_no_file_test
label: Test
migration_tags:
- Drupal 6
- Drupal 7
- Configuration
source:
plugin: embedded_data
data_rows:
-
id: 1
ids:
id:
type: string
source_module: migrate_state_no_file_test
process: []
destination:
plugin: entity:field_config
destination_module: migrate_state_no_file_test
name: Migrate state no migration and no migrate_drupal.yml file test
type: module
description: Does not have a migration or migrate_drupal.yml file.
package: Testing
version: VERSION
core: 8.x
name: Migrate state incomplete test
type: module
description: Tests the 'incomplete' migrate state
package: Testing
version: VERSION
core: 8.x
id: migrate_state_not_finished_test
label: Migrate state incomplete test
migration_tags:
- Drupal 6
- Drupal 7
- Configuration
source:
plugin: embedded_data
data_rows:
-
entity_type: block_content
ids:
entity_type:
type: string
source_module: block
process:
entity_type: entity_type
destination:
plugin: entity:field_config
destination_module: migrate_state_not_finished_test
not_finished:
6:
block: migrate_state_not_finished_test
7:
# Override any finished declarations for this field plugin.
aggregator: field_left
# Override any finished declarations for this migration.
action: migrate_state_not_finished_test
block: migrate_state_not_finished_test
<?php
namespace Drupal\Tests\migrate_drupal\Kernel;
use Drupal\KernelTests\KernelTestBase;
/**
* Defines a class for testing deprecation error from MigrationState.
*
* @group migrate_drupal
* @group legacy
*/
class MigrationStateDeprecationTest extends KernelTestBase {
/**
* {@inheritdoc}
*/
protected static $modules = [
'migrate_drupal',
'migrate',
'migrate_state_no_file_test',
];
/**
* Tests migration state deprecation notice.
*
* Test that a module with a migration but without a .migrate_drupal.yml
* trigger deprecation errors.
*
* @doesNotPerformAssertions
* @expectedDeprecation Using migration plugin definitions to determine the migration state of the module 'migrate_state_no_file_test' is deprecated in Drupal 8.7. Add the module to a migrate_drupal.yml file. See https://www.drupal.org/node/2929443
*/
public function testUndeclaredDestinationDeprecation() {
$plugin_manager = \Drupal::service('plugin.manager.migration');
$all_migrations = $plugin_manager->createInstancesByTag('Drupal 7');
\Drupal::service('migrate_drupal.migration_state')
->getUpgradeStates(7, [
'module' => [
'migrate_state_no_file_test' => [
'name' => 'migrate_state_no_file_test',
'status' => TRUE,
],
],
], ['import' => $all_migrations['migrate_state_no_file_test']]);
}
}
<?php
namespace Drupal\Tests\migrate_drupal\Kernel;
use Drupal\Component\Discovery\YamlDiscovery;
use Drupal\KernelTests\FileSystemModuleDiscoveryDataProviderTrait;
use Drupal\migrate_drupal\MigrationConfigurationTrait;
/**
* Tests that core modules have a migrate_drupal.yml file as needed.
*
* Checks that each module that requires a migrate_drupal.yml has the file.
* Because more that one migrate_drupal.yml file may have the same entry the
* ValidateMigrationStateTest, which validates the file contents, is not able
* to determine that all the required files exits.
*
* @group migrate_drupal
*/
class StateFileExists extends MigrateDrupalTestBase {
use FileSystemModuleDiscoveryDataProviderTrait;
use MigrationConfigurationTrait;
/**
* {@inheritdoc}
*/
public static $modules = [
// Test migrations states.
'migrate_state_finished_test',
'migrate_state_not_finished_test',
// Test missing migrate_drupal.yml.
'migrate_state_no_file_test',
];
/**
* Modules that should have a migrate_drupal.yml file.
*
* @var array