Problem/Motivation

In #2981392: Comment migration corrupts data with multilingual sites we found out that the comment type language settings are not migrated sensibly when the source content type has multilingual support enabled.

Migrations generate one comment type for each Drupal 6 content type (except Forum which uses the hard coded comment_forum). The D8 comment type has a default language for new comments, see the screenshot below.
D8 comment type language settings

Currently we leave the default language (for new comments created in D8) to site default language. We also do not show the language selector for comments so that users could change the comment language when they are creating / editing the comments.

Proposed resolution

1. If the Drupal 6 content type has multilingual support 'disabled'.
Drupal 6 fixture: story.

  • 'Default language' setting of the comment type: 'Site default'.
  • 'Show language selector' setting of the comment type: disabled.
  • 'Enable translation' setting of the comment type: disabled.

2. If the Drupal 6 content type has multilingual support 'enabled'.
Drupal 6 fixture: sponsor

This means that the nodes can have a language code but the different nodes cannot be linked as translations of each other.

  • 'Default language': 'Interface text language selected for page' instead of 'Site default'.
  • 'Show language selector': enabled. This way the D8 user can see what the language of the new comments will be.
  • 'Enable translation': disabled. This is because the comments in D6 are independent i.e. the comments are not translations of each other.

3. If the Drupal 6 content type has multilingual support 'Enabled, with translation'.
Drupal 6 fixture: article and employee. .

This means that the nodes can have a language code and the nodes with different language codes can be linked as translations of each other. The different node language versions will have their independent comments i.e. the comments are not translations of each other.

  • 'Default language': 'Interface text language selected for page' instead of 'Site default'.
  • 'Show language selector': enabled. This way the D8 user can see what the language of the new comments will be.
  • 'Enable translation': disabled. This is because the comments in D6 are independent i.e. the comments are not translations of each other.

NOTE: The scope of this issue is D6-D8 only. The D7-D8 migration will be handled in #3024460: Migrate D7 comment type language settings.

Remaining tasks

1. Patch
2. Review and test
3. Commit

User interface changes

Enables the comment language selector + changes the default comment language for multilingual sites.

API changes

None.

Data model changes

None.

CommentFileSizeAuthor
#86 2981393-86.patch56.57 KBquietone
#86 interdiff-84-86.txt791 bytesquietone
#84 2981393-84.patch56.57 KBquietone
#84 interdiff-71-84.txt3.5 KBquietone
#71 interdiff-68-71.txt1.37 KBquietone
#71 2981393-71.patch56.53 KBquietone
#68 2981393-68.patch56.34 KBquietone
#62 interdiff-59-62.txt14.98 KBquietone
#62 2981393-62.patch56.55 KBquietone
#59 2981393-59.patch70.65 KBquietone
#54 interdiff-53-54.txt3.01 KBquietone
#54 2981393-54.patch70.83 KBquietone
#53 interdiff-52-53.txt5.46 KBquietone
#53 2981393-53.patch70.27 KBquietone
#52 2981393-52.patch67.5 KBquietone
#52 interdiff-49-52.txt474.15 KBquietone
#51 interdiff-49-53.txt474.15 KBquietone
#51 2981393-53.patch67.5 KBquietone
#49 interdiff-45-49.patch7.08 KBquietone
#49 2981393-49.patch539.48 KBquietone
#46 interdiff-43-45.txt6.33 KBquietone
#46 2981393-45.patch539.46 KBquietone
#43 interdiff-41-43.patch476 KBquietone
#43 2981393-43.patch532.53 KBquietone
#41 2981393-41.patch56.53 KBquietone
#41 interdiff-39-41.txt2.98 KBquietone
#39 interdiff-38-39.txt891 bytesquietone
#39 2981393-39.patch56.67 KBquietone
#38 2981393-38.patch56.67 KBquietone
#34 2981393-34.patch58.01 KBquietone
#34 interdiff-32-34.txt743 bytesquietone
#32 interdiff-30-32.txt681 bytesquietone
#32 2981393-32.patch57.65 KBquietone
#30 interdiff-28-30.txt3.35 KBquietone
#30 2981393-30.patch57.36 KBquietone
#28 interdiff.txt667 bytesquietone
#28 2981393-28.patch56.54 KBquietone
#26 2981393-26-d6dump-only.patch50.5 KBquietone
#24 2981393-24-d6dump-only.patch52.76 KBquietone
#18 interdiff-15-18.txt3.67 KBquietone
#18 2981393-18.patch5.86 KBquietone
#16 interdiff.txt3.19 KBquietone
#16 2981393-16.patch5.92 KBquietone
#16 2981393-16-test-only.patch5.86 KBquietone
#16 2981393-16.patch5.86 KBquietone
#15 2981393-15.patch5.54 KBquietone
#13 interdiff.txt561 bytesquietone
#13 2981393-13.patch5.54 KBquietone
#8 interdiff.txt779 bytesquietone
#8 2981393-8.patch5.55 KBquietone
#6 2981393-6.patch4.79 KBquietone
#2 2981393-D8-comment-type-settings.PNG17.42 KBmasipila
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

masipila created an issue. See original summary.

masipila’s picture

Issue summary: View changes
Issue tags: +migrate-d7-d8
FileSize
17.42 KB
masipila’s picture

Title: Comment type language settings not migrated properly for multilingual content types » Migrate comment type language settings

Version: 8.6.x-dev » 8.7.x-dev

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

quietone’s picture

Issue tags: +i18n-migrate

Add tag

quietone’s picture

Status: Active » Needs review
FileSize
4.79 KB

This should fulfill the solution in the proposed resolution.

Status: Needs review » Needs work

The last submitted patch, 6: 2981393-6.patch, failed testing. View results

quietone’s picture

Status: Needs work » Needs review
FileSize
5.55 KB
779 bytes

Update the entity counts for MigrateUpgrade6Test.

Status: Needs review » Needs work

The last submitted patch, 8: 2981393-8.patch, failed testing. View results

quietone’s picture

Status: Needs work » Needs review

Tests pass and there are no coding standard errors, so setting NR

quietone’s picture

This migration is nearly the same as d6_language_content_settings.yml. What is changed is the source of language_alterable, from i18n_lock_node to language_content_type.

+++ b/core/modules/language/migrations/d6_language_content_comment_settings.yml
@@ -0,0 +1,63 @@
+      3: true

This line can be remove

heddn’s picture

Status: Needs review » Needs work

Is this NW for #11?

quietone’s picture

Status: Needs work » Needs review
FileSize
5.54 KB
561 bytes

Remove the unnecessary line, from #11.

maxocub’s picture

Status: Needs review » Needs work

Good work, just a few nits:

  1. +++ b/core/modules/language/tests/src/Kernel/Migrate/d6/MigrateLanguageContentCommentSettingsTest.php
    @@ -0,0 +1,78 @@
    + * Tests migration of language content comment setting variables.
    

    I don't see any variables being migrated, maybe we should just say "Tests migration of language content comment settings."?

  2. +++ b/core/modules/language/tests/src/Kernel/Migrate/d6/MigrateLanguageContentCommentSettingsTest.php
    @@ -0,0 +1,78 @@
    +  public function testLanguageContent() {
    

    This method should be rename to something more specific.

  3. +++ b/core/modules/language/tests/src/Kernel/Migrate/d6/MigrateLanguageContentCommentSettingsTest.php
    @@ -0,0 +1,78 @@
    +    $config = ContentLanguageSettings::loadByEntityTypeBundle('comment', 'comment_node_article');
    +    $this->assertSame('comment', $config->get('target_entity_type_id'));
    +    $this->assertSame('comment_node_article', $config->get('target_bundle'));
    +    $this->assertSame('current_interface', $config->get('default_langcode'));
    +    $third_party_settings = [
    +      'content_translation' => [
    +        'enabled' => TRUE,
    +      ],
    +    ];
    +    $this->assertSame($third_party_settings, $config->get('third_party_settings'));
    +
    +    $config = ContentLanguageSettings::loadByEntityTypeBundle('comment', 'comment_node_employee');
    +    $this->assertSame('comment', $config->get('target_entity_type_id'));
    +    $this->assertSame('comment_node_employee', $config->get('target_bundle'));
    +    $this->assertSame('current_interface', $config->get('default_langcode'));
    +    $this->assertSame($third_party_settings, $config->get('third_party_settings'));
    

    We test the same thing twice. Could we test the other language setting?

  4. +++ b/core/modules/migrate_drupal_ui/tests/src/Functional/d6/MigrateUpgrade6Test.php
    @@ -72,8 +72,8 @@ protected function getEntityCounts() {
    -      'migration' => 105,
    ...
    +      'migration' => 106,
    

    I never saw this 'migration' count. I often added migrations without having to update this count. I put it back to 105 and ran the test and it passed. I think this line is not necessary.

quietone’s picture

Status: Needs work » Needs review
FileSize
5.54 KB

Needs a reroll

quietone’s picture

1. Fixed
2. Fixed
3. Fixed. Thanks I did miss that! Added tests for isLanguageAlterable(). Also changes the tests to use any getters that exist.
4. Interesting. I don't see how it would pass the test when that is changed. If that needs to be removed then it should be a separate issue as it is also in the D7 tests. I'm uploading a test only patch with migrations = 105 instead of 106. Let's see what testbot does with that.

Oh and I ran a full migration and checked that the criteria of the proposed resolution are met.

Status: Needs review » Needs work

The last submitted patch, 16: 2981393-16.patch, failed testing. View results

quietone’s picture

Darn, when I am sick I make even more silly errors. Patch 2981393-16.patch and 2981393-16-test-only.patch are identical and they should not have been but there it is. So, let's just ignore Comment #16 and move on.

And uploading the correct patch so there is no confusion.

14-1. Fixed
14-2. Fixed
14-3. Fixed. Thanks I did miss that! Added tests for isLanguageAlterable(). Also changes the tests to use any getters that exist.
14-4. Interesting. Created a new issue, since this will affect both d6 and d7, to look into why the migration count changes don't cause test failures, #3009137: Migration entity count not tested in MigrateUpgrade Tests

Oh and I ran a full migration and checked that the criteria of the proposed resolution are met.

quietone’s picture

Status: Needs work » Needs review
masipila’s picture

Issue summary: View changes
Status: Needs review » Needs work

I tested this with both D6 and D7 even though I can see from the patch #18 that we are only dealing with D6 stuff at the moment.

D6 test setup

  • I have three content types.
  • First content type has 'Multilingual settings' as 'Disabled'
  • Second content type has 'Multilingual settings' as 'Enabled' i.e. nodes can have a language code defined but the nodes cannot be linked as translations of each other.
  • Third content type has 'Multilingual settings' as 'Enabled, with translation' i.e. nodes can have language codes and the nodes MAY be linked as translations of each other. Each language version can have its independent comments i.e. the comments are NOT translations of eachother.

D6 test result

D6 1. Drupal 6 content type has multilingual support 'disabled'

  • 'Default language': 'Site default'. TEST OK.
  • 'Show language selector': disabled. TEST OK.
  • 'Enable translation': disabled. TEST OK.

D6 2. Drupal 6 content type has multilingual support 'enabled'.
This means that the nodes can have a language code but the different nodes cannot be linked as translations of each other.

  • 'Default language': 'Interface text language selected for page'. TEST OK.
  • 'Show language selector': enabled. TEST OK.
  • 'Enable translation': disabled. TEST OK.

D6 3. Drupal 6 content type has multilingual support 'Enabled, with translation'.
This means that the nodes can have a language code and the nodes with different language codes can be linked as translations of each other. The different node language versions will have their independent comments i.e. the comments are not translations of each other.

  • 'Default language': 'Interface text language selected for page'. TEST OK.
  • 'Show language selector': enabled. TEST OK.
  • 'Enable translation': enabled. TEST FAILED. The comments in D6 are independent on different node language versions i.e. the comments are not translations of each other. This is why this setting should be disabled.

D7 Test setup

Content types 1-3 as above for D6.

4. Fourth content type has 'Multilingual settings' as 'Enabled, with field translation' i.e. Entity Translation.
Comments / Comment fields can be translated using Entity Translation.

D7 test result

D7 1. Drupal 7 content type has multilingual support 'disabled'

  • 'Default language': 'Site default'. TEST OK.
  • 'Show language selector': disabled. TEST OK.
  • 'Enable translation': disabled. TEST OK.

D7 2. Drupal 7 content type has multilingual support 'enabled'.
This means that the nodes can have a language code but the different nodes cannot be linked as translations of each other.

  • 'Default language': 'Site default'. TEST FAILED.
  • 'Show language selector': disabled. TEST FAILED.
  • 'Enable translation': disabled. TEST OK.

D7 3. Drupal 7 content type has multilingual support 'Enabled, with translation'.
This means that the nodes can have a language code and the nodes with different language codes can be linked as translations of each other. The different node language versions will have their independent comments i.e. the comments are not translations of each other.

  • 'Default language': 'Site default'. TEST FAILED.
  • 'Show language selector': disabled. TEST FAILED.
  • 'Enable translation': disabled. TEST OK.

D7 4. Drupal 7 content type has multilingual support 'Enabled, with field translation' i.e. Entity Translation

  • 'Default language': 'Interface text language selected for page'. TEST OK.
  • 'Show language selector': enabled. TEST OK.
  • 'Enable translation': enabled. TEST OK.

Conclusion

Conclusion 1: Patch #18 covers D6 only. I propose that we limit the scope of this issue to D6 only and create a follow-up for D7.

Conculsion 2:

+  'third_party_settings/content_translation/enabled':
+    plugin: static_map
+    source: language_content_type
+    map:
+      # In the case of being 0, it will be skipped. We are not actually setting
+      # a null value.
+      0: NULL
+      1: false
+      2: true

The mapping from 2 to true is incorrect. It should be false. This is because the comments in D6 are independent from each other i.e. it is not possible to translate comments from one language to another.

Conclusion 3: D7 Entity Translation option is correctly covered. This was done in #2073467: Migrate Drupal 7 Entity Translation settings to Drupal 8.

Conclusion 4: D7 multilingual options 'Enabled' and 'Enabled, with translation' are not covered.

masipila’s picture

Oh, and forgot to mention that I updated the issue summary to be more explicit on the different scenarios. It can also be used for ensuring that we have all scenarios covered in the automated tests.

quietone’s picture

@masipila, Thanks! I see you've setup your own d6 an d7 version for testing. Would it be possible for you to add those cases to the d6 and d7 fixtures, if they are not already there?

masipila’s picture

I checked the multilingual settings of the content types in the D6 fixture:

1. Content type with Multilingual support 'Disabled': Most of the content types are like this so there is plenty to choose from.
2. Content type with Multilingual support 'Enabled': There are currently no content types configured like this.
3. Content type with Multilingual support 'Enabled, with translation': Article.

For 2, I propose that we use content type 'Migrate test story'. It does not have any content in the fixture at the moment so changing the multilingual mode of this content type would hopefully not break too many tests (if any).

I also checked the multilingual settings of the content types in the D7 fixture. I'm quite confused because Article content type has nodes which clearly have a defined language but yet the multilingual mode is 'Disabled'.

I propose that we configure the D7 fixture content types as follows:
1. Content type with Multilingual support 'Disabled': page.
2. Content type with Multilingual support 'Enabled': There are currently no content types configured like this. I propose we use blog for this.
3. Content type with Multilingual support 'Enabled, with translation': There are currently no content types configured like this. I propose we use Article for this.
4. Content type with Multilingual support 'Enabled, with field translation': There are currently no content types configured like this.. I propose we use test_content_type for this.

I need to check out from the hotel in less than an hour from now so unfortunately I can't post a patch with these proposed changes right now.

Cheers,
Markus

quietone’s picture

Status: Needs work » Needs review
FileSize
52.76 KB

This patch is only the change to d6_dump suggested in 23 above (changing Migrate test story) content type. I want to see what, if any, tests fail.

Status: Needs review » Needs work

The last submitted patch, 24: 2981393-24-d6dump-only.patch, failed testing. View results

quietone’s picture

Status: Needs work » Needs review
FileSize
50.5 KB

Since that failure is on a test of an absent body field, let's try another content type, this time, Sponsor.

Making the changes to the D7 database via the UI are proving impossible. More details on that later.

Status: Needs review » Needs work

The last submitted patch, 26: 2981393-26-d6dump-only.patch, failed testing. View results

quietone’s picture

Status: Needs work » Needs review
FileSize
56.54 KB
667 bytes

That is better. Now add back in the patch from #18 plus a fix for the MigrateUpgrade6Test

Status: Needs review » Needs work

The last submitted patch, 28: 2981393-28.patch, failed testing. View results

quietone’s picture

Status: Needs work » Needs review
FileSize
57.36 KB
3.35 KB

This changes the content type, Sponsor, to have a multilingual setting of 'Enabled' and updates the test.

Status: Needs review » Needs work

The last submitted patch, 30: 2981393-30.patch, failed testing. View results

quietone’s picture

Status: Needs work » Needs review
FileSize
57.65 KB
681 bytes

I can't get the MigrateUpgrade test to run locally today. Here is an update for the entity count.

Status: Needs review » Needs work

The last submitted patch, 32: 2981393-32.patch, failed testing. View results

quietone’s picture

Also need to update the count in the Incremental as well.

Status: Needs review » Needs work

The last submitted patch, 34: 2981393-34.patch, failed testing. View results

masipila’s picture

Issue tags: +Needs reroll

Thanks @quietone for working on this!

I think this needs to be re-rolled now that #3016011: Reroll all migrate dump files landed...

I've been super-duper busy lately again but I'll try to find time to test the i18n patches.

Question: How do you feel now about the scope of this issue? Should we do D7 in the same issue or open a follow-up on that? I would be leaning towards opening a follow-up so that we would minimize the risk for a need to re-roll fixtures...

Cheers,
Markus

heddn’s picture

Issue tags: +Migrate critical

Triaging the issue queue.

quietone’s picture

Status: Needs work » Needs review
FileSize
56.67 KB

Here is the reroll.

Re the question in #36 about making a follow up for D7. The answer is that I am still on the fence about that. I want to have another look at what is required for D7 and I won't be able to do that for about two days.

Settings NR for the testbot.

quietone’s picture

Issue summary: View changes
Issue tags: -Needs reroll
FileSize
56.67 KB
891 bytes

Did some more testing and had to make some changes to the migration so the result matches what is in the IS. Updated the IS to identify the Drupal 6 content types associated with each language content settings to help testers.

Status: Needs review » Needs work

The last submitted patch, 39: 2981393-39.patch, failed testing. View results

quietone’s picture

Status: Needs work » Needs review
FileSize
2.98 KB
56.53 KB

Silly, forgot to update the test.

quietone’s picture

Status: Needs review » Needs work

Settings to NW to decide about adding the D7 migration here or to do that in a new issue.

quietone’s picture

Status: Needs work » Needs review
FileSize
532.53 KB
476 KB

This is to test what breaks when changing the Drupal 7 basic page from multilingual Disabled to Enable. I tried to do this with the UI but kept getting an error message "An illegal choice has been detected" so I changed the variable directly. Not sure what problems that may cause.

The last submitted patch, 43: 2981393-43.patch, failed testing. View results

Status: Needs review » Needs work

The last submitted patch, 43: interdiff-41-43.patch, failed testing. View results

quietone’s picture

Status: Needs work » Needs review
FileSize
539.46 KB
6.33 KB

Not bad, only 4 errors and after a look it appears they can be corrected and not lose any tests. So, I went ahead and added a migration and test for Drupal7. The test passes but I have not tested it from the UI to be sure nor have I fixed the errors reported in #43.

Status: Needs review » Needs work

The last submitted patch, 46: 2981393-45.patch, failed testing. View results

quietone’s picture

Assigned: Unassigned » quietone

Good, the same tests fail and no new failures. This does look like it will work.

quietone’s picture

Issue summary: View changes
Status: Needs work » Needs review
FileSize
539.48 KB
7.08 KB

Review again and need to revert changes to Drupal 6 version as I misread the IS. First, lets run the tests on this updated version and then attend to the errors.

Status: Needs review » Needs work

The last submitted patch, 49: interdiff-45-49.patch, failed testing. View results

quietone’s picture

Status: Needs work » Needs review
FileSize
67.5 KB
474.15 KB

Now, work on fixes the failures. This has fixes for two tests plus removes unnecessary changes from the fixture which may also fix the others.

This still needs a migration for this case:
4. If the Drupal 7 content type has multilingual support as 'Enabled, with field translation'.
Drupal 7 fixture: test_content_type.

quietone’s picture

Ah a new day and I see I got the number wrong on the patch. Uploading the same patch with correct number of this comment (52) to avoid confusion.

quietone’s picture

Now add in the final migration,
4. If the Drupal 7 content type has multilingual support as 'Enabled, with field translation'.
Drupal 7 fixture: test_content_type.

Assuming this passes tests, it will be ready for review. I do wonder if the new process plugin, content_translation_enabled_setting, show be more generic and handle the other entity type that are translatable with entity translation.

quietone’s picture

Decided to change the new process plugin to be more flexible. This moves the static map from the migration into the process plugin, but I think I like this better.

quietone’s picture

Assigned: quietone » Unassigned

This is ready for review

masipila’s picture

Assigned: Unassigned » masipila

Assigning to self for review

masipila’s picture

Assigned: masipila » Unassigned
Status: Needs review » Needs work

Hi,

I re-tested patch #54 manually, same tests as in #20. Unfortunately I need to kick this back.

Drupal 6

1. D6 Content type with multilingual settings 'disabled': All tests OK
2. D6 Content type with multilingual settings 'enabled': All tests OK
3. D6 Content type with multilingual settings 'enabled, with translations' (Article in D6 fixture): TEST FAILED, details below.

Details for 3:

  • When the D6 content type setting is 'enabled, with translations', the D8 content type setting 'Enable translation' should be false.
  • This is because the D6 comments are **not** conceptually translations of each other.

Drupal 7

4. D7 Content type has multilingual support 'disabled'. All tests OK.
5. D7 Content type has multilingual support 'enabled'. All tests are now OK.
6. D7 content type has multilingual support 'Enabled, with translation'. TEST FAILED. Details below.
7. D7 content type has multilingual support 'Enabled, with field translation'. TEST FAILED. Details below.

Details for 6:

  • This is the same thing as 3. for Drupal 6.
  • When the content type setting is 'enabled, with translations', the D8 content type setting 'Enable translation' should be false.
  • This is because the D7 comments are **not** conceptually translations of each other.

Details for 7:
Issue 7A: D8 'Default Language' is 'Not specified'. Should be 'Interface text language selected for page' as described in the issue summary.

Issue 7B: D8 'Enable translation' does not respect the D7 Entity Translation settings.

  • If the D7 content type has 'Enabled, with field translation' AND the D7 Entity Translation settings have ET enabled for comments, then the D7 comments may be conceptually translations of each other.
  • As described in the issue summary, the D8 should be 'Enabled' in this scenario.
  • Currently this setting is migrated as 'Enabled' regardless of the D7 ET settings.

8. D7 fixture / content type settings
According to #49, the content type language settings were supposed to be modified in the D7 fixture. As @quietone mentioned, there is something strange going on with our fixture (she modified the values directly to the variables because UI didn't allow her to change it). All D7 fixture content types still have their language settings as 'Disabled' at least when you look at them from the D7 UI...

Cheers,
Markus

quietone’s picture

Issue tags: +Needs reroll

Needs reroll

quietone’s picture

Status: Needs work » Needs review
FileSize
70.65 KB

Phew, that didn't involve editing a fixture, just MigrateUpgrade6Test.php.

quietone’s picture

Issue summary: View changes

Making a few things bold in the IS to make it a bit easier to find.

Status: Needs review » Needs work

The last submitted patch, 59: 2981393-59.patch, failed testing. View results

quietone’s picture

Title: Migrate comment type language settings » Migrate D6 comment type language settings
Status: Needs work » Needs review
Issue tags: -migrate-d7-d8, -Needs reroll
FileSize
56.55 KB
14.98 KB

Right, couple of things.

1) I am not getting the failures that masipila reports. I was working in D7 and using the fixture all was well. I went to add a new content type to the fixture and get this error in the UI 'An illegal choice has been detected. Please contact the site administrator.'. The D7 fixture is just too wonky to work with. That needs to be fixed before any more work on D7 migrations and that needs an issue.

2) This issue will be split into a D6 and D7 version because of 1)

3) This patch removes the D7 code and fixes the test, unless I messed things up.

quietone’s picture

Issue summary: View changes
Status: Needs review » Needs work

So the work remaining here, from #57, is to fix this

3. D6 Content type with multilingual settings 'enabled, with translations' (Article in D6 fixture): TEST FAILED, details below.

Details for 3:

When the D6 content type setting is 'enabled, with translations', the D8 content type setting 'Enable translation' should be false.
This is because the D6 comments are **not** conceptually translations of each other.

Updated the IS to remove references to Drupal 7

quietone’s picture

I'm unable to reproduce the error results reported in #57 for 'enabled, with translation'

After the migration both article and employee have the following configuration showing the content_translation is indeed false.

 drush cget language.content_settings.comment.comment_node_article
uuid: 86cbdd23-a666-44db-8105-d93aed364a93
langcode: en
status: true
dependencies:
  config:
    - comment.type.comment_node_article
  module:
    - content_translation
third_party_settings:
  content_translation:
    enabled: false
id: comment.comment_node_article
target_entity_type_id: comment
target_bundle: comment_node_article
default_langcode: current_interface
language_alterable: true

I made another content type and set it to 'enabled, with translation' and got the same results.

@masipila, where you using your own test db? Can you provide more details? How can I reproduce the error?

quietone’s picture

Status: Needs work » Needs review

This needs testing from someone else to confirm, or not, the failure reported by masipila.

heddn’s picture

Issue tags: +Needs manual testing

Let's tag for manual testing since we can't seem to reproduce what Markus found.

masipila’s picture

Status: Needs review » Needs work
Issue tags: +Needs re-roll

Patch doesn't apply anymore, needs re-roll

quietone’s picture

Status: Needs work » Needs review
FileSize
56.34 KB

OK, rerolled.

Status: Needs review » Needs work

The last submitted patch, 68: 2981393-68.patch, failed testing. View results

masipila’s picture

Issue tags: -Needs manual testing, -Needs re-roll

I re-tested patch 68.

Test report from Drupal 6 tests:

  • I'm no longer able to reproduce the issue I reported in #57.3.
  • Content type with multilingual settings 'disabled': all three config settings were migrated according to the acceptance criteria of the IS.
  • Content type with multilingual settings 'enabled': all three config settings were migrated according to the acceptance criteria of the IS.
  • Content type with multilingual settings 'enabled, with translation': all three config settings were migrated according to the acceptance criteria of the IS.

The D7 was split to a separate issue from this so no need to test that under this issue.

The previous automated test failed due to a mismatch 92/93. Once you fix that, please also fix this nit from the method description:

+++ b/core/modules/language/tests/src/Kernel/Migrate/d6/MigrateLanguageContentCommentSettingsTest.php
+  /**
+   * Tests migration of content language settings.
+   */
+  public function testLanguageCommentSettings() {

Should be 'Tests migration of comment language settings.'

Otherwise the patch looks ready to me once the offset by one (92 / 93) is fixed.

Cheers,
Markus

quietone’s picture

Woohoo! Thanks Markus!

Fixes for the two items in #70.

masipila’s picture

Issue summary: View changes

Thanks Vicki!

I have manually tested this, see test report in #70.

I have reviewed the patch and the feedback has been addressed.

The issue summary now describes the scope of this issue (I added the link to the D7 follow-up to the IS).

MySQL and PostgreSQL tests are green. Once the SQLite tests that are currently running are green, this is RTBC.

Markus

quietone’s picture

Status: Needs review » Reviewed & tested by the community

And thanks to you too Markus!

In #72 Markus said this can be RTBC when all tests are passing, they are so I will set it to RTBC.

Gábor Hojtsy’s picture

Status: Reviewed & tested by the community » Needs review
+++ b/core/modules/language/migrations/d6_language_content_comment_settings.yml
@@ -0,0 +1,62 @@
+migration_tags:
+  - Drupal 6
+  - Configuration
...
+migration_dependencies:
+  required:
+    - d6_comment_type

Hm, how is this limited to only multilingual sites? Eg. it attempts to set a content translation 3rd party setting but is apparently not making content translations a requirement?

Also should it have the Multilingual tag on it?

Gábor Hojtsy’s picture

Status: Needs review » Needs work

I looked a bit further and the only language related plugin used, d6_language_content_settings seems to be dependent on locale only. How does this depend on content translation needing to be on the target system?

quietone’s picture

Status: Needs work » Needs review

@Gábor Hojtsy, nice question. I done a little digging and this is what I have found so far.

Content Translation has a listener for the MigrateImportEvent which updates the field storage definitions for the entity type specified in the migrate destination configuration (using property content_translation_update_definitions). This was introduced in #2225775: Migrate Drupal 6 core node translation to Drupal 8 the same patch that brought in d6_language_content_settings.yml. Obviously, if content translation is not enabled the updates will not happen.

I wanted to see what happens when content_translation is not enabled so I commented content_translation out of MigrateLanguageContentCommentSettingsTest and ran it. That results in results in schema errors.

1) Drupal\Tests\language\Kernel\Migrate\d6\MigrateLanguageContentCommentSettingsTest::testLanguageCommentSettings
Schema errors for language.content_settings.comment.comment_node_article with the following errors: language.content_settings.comment.comment_node_article:third_party_settings.content_translation missing schema (/opt/sites/d8/core/lib/Drupal/Core/Config/Development/ConfigSchemaChecker.php:95)

Perhaps this is what vasi is referring to in Issue #2225775- Comment #198 because the next patch in #199 is the first one with the listener. If that is true, there is a dependency on content translation. And even though the source plugin has a source_module of 'locale', it uses i18n variables as well. All indicators that the existing family of '_language_content_settings' migrations are Multilingual and should be moved to content_translations/migrations.

It is now I wish I had more experience with D6/D7 sites. Does this make sense?

TODO:
Another thing to do is to document the destination property, content_translation_update_definitions.

Gábor Hojtsy’s picture

Status: Needs review » Needs work

There is definitely a dependency on content translation if we need to set third party settings for content translation :) That would not be valid in configuration unless content translation module is present. Default langcode and language alterable would be settable / migrateable without content translation, but I don't know if there is a way to make the final part only conditional on content translation.

quietone’s picture

Default langcode and language alterable would be settable / migrateable without content translation, but I don't know if there is a way to make the final part only conditional on content translation

My first reaction is that no, there isn't a way and that two migrations are needed. Ideally, one that does the parts not requiring content translation and one that does that part requiring content translation. This requires more thought than I can give right now.

masipila’s picture

Hmm, why don't we just move this to content_translations?

Gábor Hojtsy’s picture

Based on the source essentially requiring content translation features for these to be there, even though D8 is more flexible and allow part of the features to be present without content translation, this could indeed just expect content translation IMHO. I don't expect that being a problem. IMHO splitting this would be more like hair splitting.

masipila’s picture

My point exactly. These multilang migrations are complex enough without artificially splitting these into two.

heddn’s picture

What if we move the migration? The only implication is we'd need to add a hook update to language.module that if migrate_drupal_multilingual is enabled, then enable content_translation module.

We wouldn't be able to easily change the name of the migration.yml, because the name is part of the API and that would be bad. But we can move it. We cannot rename it because the mapping tables and migrate_drupal_ui has the old names already saved. But we can safely move it.

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

quietone’s picture

Moving the new migration to content_translation.

Do we really need to add a hook_update for a new migration?

heddn’s picture

Status: Needs review » Needs work

No need for an update if this is a new migration. Ignore that part.

+++ b/core/modules/content_translation/migrations/d6_language_content_comment_settings.yml
@@ -0,0 +1,63 @@
+# Ignore i18n_node_options_[node_type] options not available in Drupal 8,
+# i18n_required_node and i18n_newnode_current

I was about to mark this RTBCed since all other feedback is now addressed. But then I noticed this comment in the yml and said, what does this mean? It don't seem to relate to target_bundle. What is it all about? Can we clarify this comment?

quietone’s picture

Yes, that is cryptic. It is from d6_language_content_settings.yml which this one started from and it applies to the whole migration. And worse I added it #2225271: Migrate content type language settings from Drupal 6 & 7 Comment #26 and now think it is unhelpful. Not only is there the confusion you experienced, thinking it had to do with the property it is directly above but it doesn't really give any useful information. Comments in the migrations tend to focus on the variables that are used in a migration, not the ones that are ignored.

It is a difficult call to remove a comment but in this case it should go. If we wish to comment about the i18 variables that are ignored then that should be it's own issue and it should cover all the relevant migrations. Also these variables are not retrieved by the source plugin so maybe not worth the effort. Unless, that is, we want to modify all the relevant source plugins to get more variables even though they are not used in core.

This patch removes the comment.

heddn’s picture

Status: Needs review » Reviewed & tested by the community

We be good now.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 86: 2981393-86.patch, failed testing. View results

heddn’s picture

Status: Needs work » Reviewed & tested by the community

I think a random failure.

  • Gábor Hojtsy committed 53810d2 on 8.8.x
    Issue #2981393 by quietone, masipila, heddn, Gábor Hojtsy, maxocub:...

  • Gábor Hojtsy committed ec0a5f4 on 8.7.x
    Issue #2981393 by quietone, masipila, heddn, Gábor Hojtsy, maxocub:...
Gábor Hojtsy’s picture

Version: 8.8.x-dev » 8.7.x-dev
Status: Reviewed & tested by the community » Fixed

Thanks for resolving my concerns! Woot! Committed.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.