#2611100: D7 -> D8 migration made it possible to automatically migrate text formats using the filter_markdown filter in Drupal 7 to the markdown filter in Drupal 8.

Great! 🥳

As of #2936365: Migrate UI - allow modules to declare the state of their migrations, modules can declare their upgrade status. See https://www.drupal.org/node/2929443 for details. Let's do that, so that the Markdown module shows up in Migrate Drupal UI for an easy migration!

CommentFileSizeAuthor
#2 3095358-2.patch980 bytesWim Leers
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Wim Leers created an issue. See original summary.

Wim Leers’s picture

FileSize
980 bytes
geerlingguy’s picture

Note: I'm trying to upgrade my D7 site to D8, and it seems like the filter mapping (filter_markdown to markdown) is not working :/

I'm using 8.x-1.3, as it seems it's a newer release than the latest 8.x-2.x alpha... but even there, the markdown_migration_plugins_alter() hook is identical, so I'm not sure why the mapping is not taking affect.

When I run the migration, I get:

 2/5 [===========>----------------]  40% [error]  Missing filter plugin: filter_null. 
 [notice] Processed 5 items (0 created, 5 updated, 0 failed, 0 ignored) - done with 'upgrade_d7_filter_format'

And in the migration logs:

Filter filter_markdown could not be mapped to an existing filter plugin; defaulting to filter_null and dropping all settings. Either redo the migration with the module installed that provides an equivalent filter, or modify the text format after the migration to remove this filter if it is no longer necessary.

I confirmed the Drupal FilterID::transform() call is not getting a transformed plugin ID, it's still filter_markdown.

Wim Leers’s picture

Did you install the markdown module on the Drupal 8 destination site?

geerlingguy’s picture

@Wim - Yes, but I think it could be that after doing so, I have to delete all my migrations and re-run `drush migrate-upgrade` to generate new migrations with the new mapping. We'll see if that works...

geerlingguy’s picture

@Wim - After another hour's debugging, I found what @mdlutz24 said in this comment to be true: the migrate module's hook invocation only works for migrations that are directly running a d7_filter_format migration.

If you upgrade your site from Drupal 6 or 7 using Migrate Upgrade / drush migrate-upgrade, the filter mapping from the Markdown module doesn't apply.

I had to add a custom module with its own hook implementation to be able to have the mapping apply to my auto-generated upgrade_d7_filter_format:

/**
 * Implements hook_migration_plugins_alter().
 *
 * @see https://github.com/geerlingguy/jeffgeerling-com/issues/7
 */
function custom_migration_plugins_alter(array &$migrations) {
  if (isset($migrations['migration_config_deriver:upgrade_d7_filter_format'])) {
    $migration = &$migrations['migration_config_deriver:upgrade_d7_filter_format'];

    // Add mapping from filter_markdown to markdown for D7 migratins.
    $migration['process']['filters'][0]['process']['id']['map']['filter_markdown'] = 'markdown';
  }
}

Tracking this in my own codebase here: https://github.com/geerlingguy/jeffgeerling-com/issues/7

So it seems that for anyone upgrading from Drupal 6 or Drupal 7 using Migrate Upgrade, this module does not work out of the box. I had to spend some time debugging the migrations to find the right array key (migration_config_deriver:upgrade_d7_filter_format) to override in my own custom module.

Wim Leers’s picture

WOAH! If that's the case, then that is IMHO a supercritical bug in migrate_upgrade; it's breaking a lot of customizations out there! Including some in core I think. 🤯

geerlingguy’s picture

@Wim - entire codebase is here: https://github.com/geerlingguy/jeffgeerling-com

If you want I may be able to provide a sanitized D7 codebase to reproduce the issue. I've done a very vanilla upgrade, just using drush migrate-upgrade the whole way.

markhalliwell’s picture

Status: Needs review » Postponed (maintainer needs more info)

I'm confused. Are y'all saying this is actually an issue with https://www.drupal.org/project/migrate_upgrade and not this project?

Wim Leers’s picture

Are y'all saying this is actually an issue with https://www.drupal.org/project/migrate_upgrade and not this project?

That is what I'm saying in #7.

#2 is about Drupal core's migrate_drupal module, which is the core UI to help with migrating from Drupal 7 to 8. The YAML file that the patch in #2 is adding is to ensure that UI shows that an upgrade path is available.

markhalliwell’s picture

Status: Postponed (maintainer needs more info) » Fixed

Ah ok. Just wanted to make sure #2 was still needed is all.

  • markcarver committed fed3698 on 8.x-2.x authored by Wim Leers
    Issue #3095358 by Wim Leers: Declare markdown module's Drupal 8 upgrade...

Status: Fixed » Closed (fixed)

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