Rename the existing migrations to use the migration naming convention where variations of the basic migrations are named in the form basicmigration_variation, e.g., d7_node_translation.yml . The same pattern should be used for the related files like migration plugins and tests.

The files that need renaming are;
./core/modules/config_translation/tests/src/Kernel/Migrate/d6/MigrateI18nUserConfigsTest.php
./core/modules/config_translation/tests/src/Kernel/Migrate/d6/MigrateI18nUserProfileFieldInstanceTest.php
./core/modules/config_translation/tests/src/Kernel/Migrate/d6/MigrateI18nSystemMaintenanceTest.php
./core/modules/config_translation/tests/src/Kernel/Migrate/d6/MigrateI18nSystemSiteTest.php
./core/modules/config_translation/tests/src/Kernel/Plugin/migrate/source/d6/I18nProfileFieldTest.php
./core/modules/config_translation/src/Plugin/migrate/source/d6/I18nProfileField.php
./core/modules/config_translation/migration_templates/d6_i18n_user_profile_field_instance.yml
./core/modules/config_translation/migration_templates/d6_i18n_user_mail.yml
./core/modules/config_translation/migration_templates/d6_i18n_system_site.yml
./core/modules/config_translation/migration_templates/d6_i18n_system_maintenance.yml
./core/modules/config_translation/migration_templates/d6_i18n_user_settings.yml
./core/modules/migrate_drupal/tests/src/Unit/source/d6/i18nVariableTest.php
./core/modules/migrate_drupal/src/Plugin/migrate/source/d6/i18nVariable.php

Comments

quietone created an issue. See original summary.

jofitz’s picture

Status: Active » Needs review
StatusFileSize
new14.44 KB

Renamed the 13 files listed and also came across:

  • core/modules/config_translation/src/Plugin/migrate/source/d6/I18nProfileField.php
  • core/modules/config_translation/tests/src/Kernel/Plugin/migrate/source/d6/I18nProfileFieldTest.php
quietone’s picture

Assigned: Unassigned » quietone

Assigning to myself for review.

quietone’s picture

Status: Needs review » Needs work

Thanks Jo Fitzgerald. Looks great, just one small fix before RTBC.

+++ b/core/modules/migrate_drupal/src/Plugin/migrate/source/d6/VariableTranslation.php
@@ -8,13 +8,13 @@
+ * Drupal variable_translation source from database.

s/variable_translation/variable translation/
The original text was i18n_variable, which is the name of the table. The underscore no longer makes sense.

jofitz’s picture

Status: Needs work » Needs review
StatusFileSize
new634 bytes
new14.44 KB

Corrected the docs.

quietone’s picture

Status: Needs review » Reviewed & tested by the community

Sweet as. Thanks.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 5: 2861383-5.patch, failed testing.

jofitz’s picture

Status: Needs work » Reviewed & tested by the community
quietone’s picture

Assigned: quietone » Unassigned

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 5: 2861383-5.patch, failed testing.

heddn’s picture

Status: Needs work » Needs review
StatusFileSize
new856 bytes
new15.49 KB

There was a missed rename of VariableTranslation/VariableTranslationTest. Hopefully this fixes that up.

quietone’s picture

Status: Needs review » Reviewed & tested by the community

@heddn, thanks.

Applied the patch and grepped for i18n,
grep -ri i18n core/modules/ | grep -v fixture

The remaining occurrences of i18n are not what we are changing here. This is good to go.

gábor hojtsy’s picture

Status: Reviewed & tested by the community » Needs work

Discussed the rename with @catch and @alexpott, they pointed out that altough this is migration templates in stable modules and migrate_drupal and migrate_drupal_ui, it would still be best to provide a BC layer and deprecate the old classes instead of renaming.

pk188’s picture

@Gábor Hojtsy How to deprecate the .yml files? I found an ongoing related issue on this 'https://www.drupal.org/node/2627938'.

catch’s picture

We don't have any standard for deprecating .yml files yet. Since that service deprecation issue, Symfony has added a mechanism to deprecate services, but that doesn't help us here.

I'd suggest:

1. Deprecate the classes (they can inherit from the new ones)
2. Copy the yml files instead of rename, and don't explicitly mark them deprecated.

We'll then need a follow-up to figure out how to mark the YAML as deprecated. If it gets used then the classes will throw deprecation notices, so that bit is fine, so we're really just looking for a way to document in the file itself the deprecation so that people landing on the file will be able to figure it out, and so that they're easy to identify for removal when 9.x opens.

heddn’s picture

I don't think we need to deprecate the yml files. Renames for them is fine. Remember that these are templates. And only used a single time during setup of migrate. Once this is committed, then the old templates will never be used. However, it is a good point that we need to think about copy/deprecate. I think that means we need to clone i18nVariable => VariableTranslation, I18nProfileField => ProfileFieldTranslation. Then mark i18nVariable & I18nProfileField as deprecated. And clone the tests for these too.

Even still, I've opened #2884407: [Policy, no patch]: Determine method to deprecate yml files for figuring out a way to mark something in yml as deprecated.

gábor hojtsy’s picture

Would someone building migrations not expect the templates be there and therefore an ongoing migration process would fail with a core update => BC break?

heddn’s picture

Building migrations, folks copy/paste from migrate_templates. Or they run drush migrate-upgrade --configure-only (my personal favorite) or the use the migrate_drupal_ui module. For any of these, once the source code is updated, then folks *should* copy/paste from the non-deprecated template. Or the ui or drush would auto pick the non-deprecated template. The old templates should just go away for new migrations.

For existing migrations already built by one of the above methods, as long as the source classes exist, then the existence of the templates is irrelevant.

gábor hojtsy’s picture

@heddn: ok, I don't personally have experience building migrations. Would be nice to confirm that from another migrate team member and @catch or otherwise get @catch qualify his suggestion.

catch’s picture

. Or they run drush migrate-upgrade --configure-only (my personal favorite) or the use the migrate_drupal_ui module. For any of these, once the source code is updated, then folks *should* copy/paste from the non-deprecated template.

This is a good answer on the templates, so let's remove those.

Copying the classes will mean that existing migrations using them will continue to work (with deprecation messages).

quietone’s picture

Issue tags: +migrate-d6-d8

Add tag.

quietone’s picture

Status: Needs work » Needs review
StatusFileSize
new18.5 KB
new4.89 KB

Adding deprecations for the source plugins.

jofitz’s picture

StatusFileSize
new21.53 KB
new1.91 KB

Tidying up a few coding standards issues.

quietone’s picture

@Jo Fitzgerald, thanks for cleaning up after me!

heddn’s picture

Status: Needs review » Needs work
Issue tags: +Novice, +Needs change record

From #16, I think we are missing test coverage of the legacy i18n classes. Those need to be cloned, not renamed. And we are missing an @see to the CR. See https://www.drupal.org/core/deprecation#how for steps to deprecate.

Tagging novice, because all we need to do is copy, not rename the test cases. We'll also need to write a CR, which is probably less novice. Meaning the writing, not the @see. The link to the CR is definitely novice.

quietone’s picture

Status: Needs work » Needs review
StatusFileSize
new21.67 KB
new13.48 KB

Drafted a change record, added an @see to the deprecation notices and copied the tests.

heddn’s picture

Status: Needs review » Needs work
Issue tags: -Needs change record

I did a quick review of the CR. It looks good. Just a couple small nits and this is good to go. Still leaving the Novice tag, in case someone wants to pick up the nits.

  1. +++ b/core/modules/config_translation/src/Plugin/migrate/source/d6/I18nProfileField.php
    @@ -2,7 +2,9 @@
    +@trigger_error('The ' . __NAMESPACE__ . '\I18nProfileField is deprecated in
    

    Let's put the trigger_error all on a single line, instead of multiples. That's what I see in the rest of core.

  2. +++ b/core/modules/config_translation/src/Plugin/migrate/source/d6/I18nProfileField.php
    @@ -11,43 +13,12 @@
    +class I18nProfileField extends ProfileFieldTranslation {
     }
    

    Nit: the {} can be on the same line.

  3. +++ b/core/modules/config_translation/tests/src/Kernel/Migrate/d6/MigrateSystemMaintenanceTranslationTest.php
    @@ -9,7 +9,7 @@
    -class MigrateI18nSystemMaintenanceTest extends MigrateDrupal6TestBase {
    +class MigrateSystemMaintenanceTranslationTest extends MigrateDrupal6TestBase {
    
    +++ b/core/modules/config_translation/tests/src/Kernel/Migrate/d6/MigrateSystemSiteTranslationTest.php
    @@ -9,7 +9,7 @@
    -class MigrateI18nSystemSiteTest extends MigrateDrupal6TestBase {
    +class MigrateSystemSiteTranslationTest extends MigrateDrupal6TestBase {
    
    +++ b/core/modules/config_translation/tests/src/Kernel/Migrate/d6/MigrateUserConfigsTranslationTest.php
    @@ -10,7 +10,7 @@
    -class MigrateI18nUserConfigsTest extends MigrateDrupal6TestBase {
    +class MigrateUserConfigsTranslationTest extends MigrateDrupal6TestBase {
    
    +++ b/core/modules/config_translation/tests/src/Kernel/Migrate/d6/MigrateUserProfileFieldInstanceTranslationTest.php
    @@ -9,7 +9,7 @@
    -class MigrateI18nUserProfileFieldInstanceTest extends MigrateDrupal6TestBase {
    +class MigrateUserProfileFieldInstanceTranslationTest extends MigrateDrupal6TestBase {
    

    On the old tests, let's add them to an @group of legacy.

    @group legacy

  4. +++ b/core/modules/migrate_drupal/src/Plugin/migrate/source/d6/i18nVariable.php
    @@ -2,10 +2,9 @@
    +@trigger_error('The ' . __NAMESPACE__ . '\i18nVariable is deprecated in
    +Drupal 8.4.0 and will be removed before Drupal 9.0.0. Instead, use
    +' . __NAMESPACE__ . '\VariableTranslation', E_USER_DEPRECATED);
    

    Same as earlier. A single line please.

quietone’s picture

Status: Needs work » Needs review
StatusFileSize
new21.27 KB
new15.45 KB

This patch should address all the points in #27.

Version: 8.4.x-dev » 8.5.x-dev

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

heddn’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: -Novice

Looks good now.

catch’s picture

Status: Reviewed & tested by the community » Needs work

Needs a re-roll.

quietone’s picture

Status: Needs work » Needs review
StatusFileSize
new20.79 KB
new19.41 KB

Reroll.

Status: Needs review » Needs work

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

quietone’s picture

Status: Needs work » Needs review
StatusFileSize
new20.88 KB
new819 bytes

Missed a change from source_provider to source_module and updated a comment to start with a capitalized verb.

heddn’s picture

Status: Needs review » Reviewed & tested by the community

And back to RTBC.

webchick’s picture

Sorry to be "that guy," but what's the justification for changing these machine names around so late in the game? It looks cosmetic to me? Won't this break existing sites?

quietone’s picture

@webchick, yea this is OK.

The same thing was asked in #13, and after the discussion catch summarized #20:

Copying the classes will mean that existing migrations using them will continue to work (with deprecation messages).

Where 'them' means the migration templates.

catch’s picture

Version: 8.5.x-dev » 8.4.x-dev
Status: Reviewed & tested by the community » Fixed

Yes it's a change we'd allow in a minor release even if migrate was fully stable since it's got a bc layer, although the issue title caught me out more than once when looking at this... It's handy that the bc layer for migrations is so simple by the way.

Re-reviewed the patch and it looks fine, so committed/pushed to 8.5.x and cherry-picked to 8.4.x. Thanks!

  • catch committed d44acb4 on 8.5.x
    Issue #2861383 by quietone, Jo Fitzgerald, heddn: Rename i18n migrations...

  • catch committed 32deb87 on 8.4.x
    Issue #2861383 by quietone, Jo Fitzgerald, heddn: Rename i18n migrations...

Status: Fixed » Closed (fixed)

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

quietone’s picture

Publish the change record