Closed (won't fix)
Project:
Drupal core
Version:
main
Component:
migration system
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
27 Nov 2019 at 00:55 UTC
Updated:
27 Aug 2026 at 09:19 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
wim leersComment #3
huzookaComment #4
huzookaDiscovered an edge case:
An installed Drupal (7) theme not necessarily has a theme settings variable. The settings variable is created only when the theme settings form has submitted.
We also have to make sure that the unnecessary block configs (the blocks that are used by the not migrated theme) aren't migrated to the destination.
Attached a test-only patch that updates the drupal7 database fixture with an enabled Garland theme (and with its block configs), and adds the
theme_garland_settingsvariable as well.Comment #5
wim leers🤔 This adding blocks? Why?
👍 These are the theme settings for
garland, great!🤓 "isn't" → "doesn't"
Comment #6
huzookaRe #5:
#5.1:
This happens if you enable a theme in Drupal7 (and even in Drupal8, but there only some relevant block plugins get a block config entity).
Initially I enabled the theme with drush, but after you asked this question I re-rested this and enabled the theme by using only the Drupal 7 appearance UI – and I got the same result.
#5.2
Yepp, this is what we don't want to be imported.
#5.3
😶I'll fix this.
Comment #7
huzookaOne more failing test expected:
Drupal\Tests\block\Kernel\Migrate\d7\MigrateBlockTest.Garland blocks shouldn't been migrated.
Comment #8
huzookaAdding an initial fix.
Comment #11
huzookaComment #12
huzookaComment #14
wim leers🤓 In the past we used to specify that third parameter with a helpful message. But ever since Drupal migrated from its own SimpleTest infrastructure onto PHPUnit, we've been waning ourselves off of that optional message. Why? Because if you specify an optional message, you don't get actionable test failures: you get *that* error message that you specified. If you don't specify an error message, PHPUnit will automatically show the difference in the two arrays.
So, we should remove that optional message.
🤓 "shouldn't been migrated" → "shouldn't have been migrated"
👍 This is expanding the D7 fixture to place blocks for the Garland theme and configure theme settings. Goal: to test that a source-only theme does not get its settings migrated into the destination (theme settings + blocks).
🙏 Can you confirm this interpretation is correct?
👍 This is placing only blocks specific to the Stark theme. Goal: test that a theme that exists in both source and destination but does not have settings does get migrated to D8, but the destination theme settings will be based on the global theme settings, thereby proving that this architectural difference between D7 and D8/D9 is respected correctly.
🙏 Can you confirm this interpretation is correct?
👍 Thanks for this great comment — otherwise I wouldn't have grokked it :)
👍 Here you specify an optional failure message too, but in this case there are only two possible values so you're not masking anything, plus the comment truly makes it easier to understand what you're testing here.
🤔 I don't understand the reason for this change. Could you explain that here on the issue?
🐛 The FQCN + comment are wrong.
🐛 Blocks whose target theme is not available should not be migrated.
🥳 Nice simplification!
🤔 Just to be clear: this is not an essential change, right?
Comment #15
wim leersThis definitely has tests now!
Comment #16
huzooka@Wim Leers, I'm still working on this, it seems that we can simplify the theme_settings migration with a deriver, and I also noticed few more things:
Comment #17
huzookaUpdated tests and assertions even for Drupal 6 block migration.
Explanation will follow soon.
Comment #18
huzookaExplaining the test changes
We shouldn't migrate block configs whose theme dependency is unavailable. To be able to test this somehow (the single bluemarine block in the Drupal 6 fixture should be skipped), I changed the way how the pre-existing block config ids are calculated.
This means that from this point, block configurations which are migrated from Drupal 6 will get an id that is prefixed with the target theme's machine name.
Migrate maintainers, please examine whether this change is acceptable or not
This is related to the point above: the bluemarine block shouldn't have been migrated.
For testing the Block content translation, the block config's target theme should be installed.
Re #14.3; #14.3:
Exactly! These are the block system related changes made by Drupal 7 after we enabled Garland and Stark themes.
Pages that got accessible after Garland and Stark were enabled. (A single
statuskey in the serialized access_arguments changed from0to1).This is also a test-related fixture: We only saved the theme settings form for Garland, so we will only have
theme_garland_settings.Stark won't have specific configuration, and inherits the global
theme_settings.About the fix
This is how the blocks without the required theme dependency will be skipped; even for Drupal 6 and Drupal 7 migrations.
I added a D7ThemeDeriver deriver class for the theme migrations. It makes possible calculating the
theme_nameand config names both in the source plugin and in the destination plugin as well.Ooops... Well, we don't have
configuration_namenortheme_nameornamein the row... I have to remove these unnecessaryunset()s asap.I hope this change is acceptable: if the
theme_stark_settingsvariable does not exist, the query will be made for the globaltheme_settingsvariable.With this patch, the theme that we want to migrate to Drupal 8 should be enabled even on the source site and even on the destination.
Comment #21
wim leers🤓 Nit: this change adds a few lines, but also moves some existing lines. AFAICT that move is not necessary. Reverting that move will minimize the changes and make this easier to land.
Why "especially for testing purposes"? I think this is just a D8 convention?
Agreed.
I think it is acceptable since any existing migrations continue to work as-is, they just result in different IDs for D8
blockconfig entities. Identifiers are meant to be opaque, especially config entities' identifiers, since there is link rot risk like for content entities.🤓 This is a change that thanks to recent iterations can be reverted.
👍 Like I wrote in #14.4: this matches how the architecture of theme settings evolved in D8.
Unfortunately, the "complete" patch in #18 failed. Looks like it's mostly due to D6 expectations that have not yet been updated, so hopefully it'll be easy to get back to green, like #12 before it!
Comment #22
huzookaComment #23
huzookaAttached the right patches (hopefully).
Re #21:
themeproperty process above theid's process, I cannot use the'@theme'reference (that will be the destination theme's name) – since it wont be calculated at the time theidis calculated.Drupal\Tests\block\Kernel\Migrate\d6\MigrateBlockTest::testBlockMigration, we should know what theme the (previous)block,block_1orblock_2blocks belong to – otherwise we don't know what we are testing.D7ThemeDeriverfor D7 theme settings migrations; and onlyMigrateTestBase::executeMigrations()creates the valid theme settings migrations for us. If I would useinstead of
, I wont be able to test that the garland settings migration was skipped.
See
MigrateTestBase::executeMigrations()andMigrateTestBase::executeMigration()Comment #25
wim leers#23
Patch review
🔎 Übernit: s/a Drupal/a Drupal/ (double space instead of single)
Could be fixed on commit, or … could be ignored. Obviously not important.
👍 Nice cleanup!
This is completely ready now IMHO — the only thing that remains is migration system maintainer review!
Thanks @huzooka, not just for the patch, but for your persistence on this patch that turned out to be far trickier than expected :)
Comment #26
huzookaComment #27
huzookaWith this patch, blocks that were migrated from Drupal7 will get the destination theme's machine name as ID-prefix, and not the source theme.
Comment #28
wim leersI manually tested #27 and it works great on real-world D7 sites, but let's wait and see if core's test coverage also passes 😊
Comment #29
wim leersYay, #27 is still green! 👍
Comment #30
heddnI'm a little worried about the BC implications of this. The way I read this, for older sites that don't have the updated deriver, they will fall on their faces with these changes.
Comment #31
wim leersI wonder if this is a case of my not being awake enough yet or whether this is just me not getting it, but … how can "older sites" get the updated destination plugin but not the updated deriver? 🤔
Comment #32
heddnHere's what I'm looking at... And by the way, these things can be tricky. We don't actually have a new plugin id for the destination. So we use the same destination. But because of generated yml files that get exported, one-time, into migrate_plus... we have many cases where incremental migrations will have the updated destination but not the updated yaml that gets generated by the deriver.
Comment #33
wim leersAh … this is a problem for
migrate_plususers … aka users ofmigrationconfig entities.Interesting. 🤔 Has every single migration plugin improvement or bugfix so far taken the consequences for
migrationconfig entities into account?Comment #34
heddnRe #33: yup. It gets tricky. We haven't always done perfectly, but we try to keep the system stable. One option is to create a new destination that and point to it in the deriver. Then deprecate the old one for removal in 10.x. That would keep BC.
Comment #36
wim leers#27 had to be rebased to apply to
9.0.0-beta3.Comment #37
pradeepjha commentedPatch re-rolled for 9.1.x
Comment #38
pradeepjha commentedComment #40
narendra.rajwar27Comment #41
pradeepjha commentedComment #42
pradeepjha commentedComment #43
pradeepjha commentedComment #44
quietone commentedI've skimmed the issue and reviewed the patch. I didn't apply the patch or run the tests.
This needs work for #34.
Remove all references to D8. As well as the final phrase about skip_on_empty, there is no guarantee that every process pipeline using this plugin will be followed by a skip. I'm thinking something as simple as 'No theme found for this block.'
The process plugin has changed but there is no change to the corresponding test. And the reason is that this process plugin has no test. So, the process plugin isn't tested directly, it gets tested during a migration test.
Let's make this read well for Drupal 9 as well. How about changing to say that Bluemarine was removed in Drupal 8.
Not necessary. At best we track changes to the entity counts as migrations are added. There is no need to attempt to keep a history of changes in the comments.
This deriver needs a test.
Had to read this twice, it is an atypical use of configuration values. Can we structure this the same as d7/node.php?
Can we have more meaningful names than value0 and value1?
Comment #49
omkar.podey commentedRerolled patch for 9.4.x.
Comment #50
omkar.podey commentedRerolled patch for 9.4.x , CS fix.
Comment #51
omkar.podey commentedRerolled for 9.4.x , test fix.
Comment #52
omkar.podey commentedNew patch with reroll for 9.4.x
Comment #53
omkar.podey commentedRerolled for 9.4.x , test fix.
Comment #54
omkar.podey commentedMore info on failing test. added assertion to print blocks
Comment #55
omkar.podey commentedRerolled for 9.4.x , text fix , changed assertion.
Comment #56
omkar.podey commentedComment #57
omkar.podey commented9.4.x rerolled patch , assertion fix.
Comment #58
omkar.podey commentedfixed patch.
Comment #59
quietone commentedThe scope of this issue is very different from the Issue Summary. The IS needs to be updated.
The BC concerns raised in #30 need to be addressed.
Comment #60
wim leers#3281427: Update Block and Theme setting migrations to not use Bartik and Seven broke this in
9.5.x.Comment #61
wim leersWorse, #3219539: Update Drupal 7 migration database fixture also broke this 😬
This reroll already took me well over 30 minutes and I still nowhere near done.
Comment #62
wim leersThis is the most painful rebase I've done in many months.
This does not yet address the BC concerns in #30 that were pointed to in #59. One change caused by #3281427: Update Block and Theme setting migrations to not use Bartik and Seven was impossible to make play nice with the test coverage that this issue was adding; left a
@todothere.Comment #63
wim leers… this patch did not touch that file at all 🤷♂️😬
Comment #64
wim leersAh, this was a regression in
9.5.xthat has now been fixed: #3327853: [10.0.x and 9.5.x backports] Don't allow {@inheritDoc} annotation in PHPDocBlocks.Comment #66
wim leers1 unrelated failure:
1 deprecation notice:
⇒ this works fine, but the BC concerns in #30 still need to be addressed.
Comment #67
wim leerscore/modules/aggregatoris gone.Comment #68
needs-review-queue-bot commentedThe Needs Review Queue Bot tested this issue. It either no longer applies to Drupal core, or fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".
Apart from a re-roll or rebase, this issue may need more work to address feedback in the issue or MR comments. To progress an issue, incorporate this feedback as part of the process of updating the issue. This helps other contributors to know what is outstanding.
Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.
Comment #69
benjifisherComment #21 added the tag for maintainer review, referring to Comment #18. (I think it means #18.1, not #18.2). Before we respond to that question, it will help if the issue summary is updated to explain what the current patch actually does. From Comment #59:
Also, #30 raised concerns about BC, and #34 has a specific suggestion for addressing them.
I am removing the tag for maintainer response and adding a "Remaining tasks" section to the issue summary.
Comment #70
benjifisherFrom Comment #32:
Something similar can happen with any incremental migration, whether it uses core migration plugins or
migrate_plusconfiguration. A developer creates some migrations using the core migrations as a starting point, or the derived migrations. These custom migrations include the destination ID. If we change what that destination ID does, then we can break the custom migrations.Also, a single site migration (not an incremental one) can run into the same problem. A complex project might start today using a target site of Drupal 10.0 (or even 9.5) and the final migration might be into a 10.3 or 11.0 site.
Comment #71
wim leersUpdated #67 for Drupal
10.2.0.Comment #72
quietone commentedThe Migrate Drupal Module was approved for removal in #3371229: [Policy] Migrate Drupal and Migrate Drupal UI after Drupal 7 EOL.
This is Postponed. The status is set according to two policies. The Remove a core extension and move it to a contributed project and the Extensions approved for removal policies.
The deprecation work is in #3522602: [meta] Tasks to remove Migrate Drupal module and the removal work in #3522602: [meta] Tasks to remove Migrate Drupal module.
Migrate Drupal will not be moved to a contributed project. It will be removed from core after the Drupal 12.x branch is open.
Comment #74
quietone commentedThe Migrate Drupal Module and Migrate Drupal UI are deprecated and they are not in Drupal 12.0.0.
Issues for these modules should now be on the 11.x branch. And the changes are limited to critical and major bug fixes. Other changes are allowed at the discretion of the core Release Managers in consultation with the Migrate subsystem maintainers.