Move migration code from content_translation to migrate_drupal

Created on 12 January 2023, almost 2 years ago
Updated 23 July 2024, 4 months ago

Problem/Motivation

See the parent issue for context.

This issue is meant to be a first step and a test case. Find out what the challenges are when moving things to the migrate_drupal module.

Proposed resolution

Move code related to Drupal 6/7 migrations from the content_translation module to the migrate_drupal module. That includes migrations, plugins, and tests.

Remaining tasks

Postponed on πŸ“Œ Tasks to deprecate Migrate Drupal Postponed

User interface changes

API changes

Data model changes

Release notes snippet

πŸ“Œ Task
Status

Closed: won't fix

Version

11.0 πŸ”₯

Component
MigrationΒ  β†’

Last updated about 2 hours ago

Created by

πŸ‡ΊπŸ‡ΈUnited States benjifisher Boston area

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡³πŸ‡ΏNew Zealand quietone

    Removing content_translation from the list of installed modules will fix StateFileExistsTest.

    I think all the remaining failures are due to that fact that translation migrations are discovered when previously they were not. And thus effects tests of the migrate UI.

  • πŸ‡³πŸ‡ΏNew Zealand quietone

    Add deprecation of I18NQueryTrait. Also add filtering of the migration definitions so that only those for installed extensions are used.

    Locally, I am getting failures in /d6/NoMultilingualReviewPageTest.php and I am starting think that this work is exposing an existing bug.

  • πŸ‡³πŸ‡ΏNew Zealand quietone

    Ah, it is failing on different tests now.

    Changed MigrationPluginList to not install 'content_translation' at setup, but at the end for testing the entity translation migrations. Also improved the filtering, which is still rough.

    I think we should change d6_ and d7_entity_reference_translation to have a destination_module defined. I just haven't done that yet.

  • πŸ‡³πŸ‡ΏNew Zealand quietone

    This adds destination_module to the entity_reference_translation followup migrations. Also added is filtering of the declared migration state results (those in the state files) to remove those for modules that are not installed on the destination.

  • πŸ‡³πŸ‡ΏNew Zealand quietone

    Fix coding standards.

  • πŸ‡³πŸ‡ΏNew Zealand quietone

    Remove changes that were removing information from the state files. I was trying to make this behave the same as when the data was in content_translation. And manipulating the state data like that isn't the right thing to do. If the state file is correct, the results are different for d6\NoMultilingualReviewPageTest::testMigrateUpgradeReviewPage because it now has all the data available, which it did not before when content_translation was disabled.

    Let's get a fresh test run.

  • πŸ‡³πŸ‡ΏNew Zealand quietone

    This is to fix the 2 Drupal 6 related tests. Remember the source Drupal 6 sites has translations and translation modules enabled. In both of these tests the module content_translation is not enabled. Therefore, the destination will be missing data and this should be reflected on the review page. That fact that it does not on HEAD is a bug.

    Because the Review page is a best effort, I am not inclined to make a separate issue to fix that on HEAD. It also requires some thought about how that applies in all cases. How can a user be informed that they need a destination module installed if that module is not already installed to make the state file available.

    That leaves the failures for Drupal 7 sources, which is simply 2 less path aliases. I presume that content_translation is creating those. I have not fixed that in this patch.

  • πŸ‡³πŸ‡ΏNew Zealand quietone

    I was mistaken, /core/modules/forum/tests/src/Functional/migrate_drupal/d7/Upgrade7Test.php is in the same situation as the Drupal 6 tests fixed in the previous patch.

    Still don't know why the core/modules/migrate_drupal_ui/tests/src/Functional/d7/Upgrade7Test.php has less path_aliases.

  • πŸ‡³πŸ‡ΏNew Zealand quietone

    The reason there are 2 less path_alieses is because the entity_translation migrations, specifically d7_taxonomy_term_entity_translation, is not running. And that is correct because the destination_module is content_translation.

  • Status changed to Needs review over 1 year ago
  • πŸ‡³πŸ‡ΏNew Zealand quietone

    Time to get some feedback on this approach.

    One thing that needs to be done is to search for Kernel migration tests that should move as well. One such would be \Drupal\Tests\taxonomy\Kernel\Migrate\d7\MigrateTaxonomyTermTranslationTest. I think that can wait until there are some reviews on this.

  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    FWIW I think it would be more manageable to breakout separate tickets for moving

    Option 1

    Per module - this includes migration folder and any tests.

    Option 2

    Ticket for per module to migration folder and a separate one for tests.

    I'm also more of a fan of the smaller tickets (easier to review) but not sure how much that comes into play here.

    Just my 2 cents.

  • Status changed to Needs work over 1 year ago
  • The Needs Review Queue Bot β†’ tested this issue. It no longer applies to Drupal core. Therefore, this issue status is now "Needs work".

    This does not mean that the patch needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.

    Consult the Drupal Contributor Guide β†’ to find step-by-step guides for working with issues.

  • πŸ‡³πŸ‡ΏNew Zealand quietone

    Updating tags

  • Status changed to Needs review over 1 year ago
  • last update over 1 year ago
    29,558 pass
  • πŸ‡³πŸ‡ΏNew Zealand quietone

    Just a reroll.

  • πŸ‡³πŸ‡ΏNew Zealand quietone

    This is introducing filtering of migrations, I wonder if that should part should be a separate issue?

  • Status changed to Needs work over 1 year ago
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    @quietone are you referring to

    +  /**
    +   * Gets migrations for installed modules.
    +   *
    +   * @return array
    +   *   Filtered definitions.
    +   */
    +  public function getDefinitions() {
    +    $definitions = parent::getDefinitions();
    +
    +    // Filter out definitions where the destination module is not installed.
    +    $installed = array_keys(\Drupal::service('module_handler')->getModuleList());
    +    $filtered_definitions = array_filter($definitions, function ($definition) use ($installed) {
    +      $destination_module = $definition['destination']['destination_module'] ?? NULL;
    +      if (empty($destination_module)) {
    +        $destination_module = $definition['destination_module'] ?? NULL;
    +      }
    +      if (empty($destination_module)) {
    +        if (is_array($definition['provider'])) {
    +          $destination_module = reset($definition['provider']);
    +        }
    +        else {
    +          $destination_module = $definition['provider'];
    +        }
    +      }
    +      return in_array($destination_module, $installed);
    +    });
    +    return $filtered_definitions;
    +  }
    

    I think it would be nice to have separate just for searching of tickets later.

  • Status changed to Postponed about 1 year ago
  • πŸ‡³πŸ‡ΏNew Zealand quietone

    I am postponing this on the parent. I was assuming we would follow the current policy of removing a module from core. But, as usual, migrate drupal is a 'special snowflake' (I am pretty sure that is a phrase used by chx).

  • Status changed to Closed: won't fix 4 months ago
  • πŸ‡³πŸ‡ΏNew Zealand quietone
Production build 0.71.5 2024