Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
The system_maintenance
migration lists:
source:
plugin: variable
variables:
- site_offline_message
source_module: system
But site_offline_message
hasn't been in use since #201415: Add permission to access site in maintenance mode, which was committed over a decade ago in https://git.drupalcode.org/project/drupal/commit/a9762cd3bf93ac8bbcafec2... 😬
Proposed resolution
Change it to:
source:
plugin: variable
variables:
- maintenance_mode_message
source_module: system
Remove the variable 'site_offline_message' from the d7 fixture and keep the existing 'maintenance_mode_message', which has the same text so there will be no changes to the existing migration test.
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
Comment | File | Size | Author |
---|---|---|---|
#23 | 3096676-23.patch | 2.41 KB | quietone |
#23 | interdiff-20-23.txt | 1.57 KB | quietone |
#20 | 3096676-20.patch | 1.28 KB | quietone |
#20 | interdiff-6-20.txt | 3.18 KB | quietone |
#6 | 3096676-6.patch | 3.33 KB | quietone |
Comments
Comment #3
Wim LeersDiscovered & fixed this together with @gabesullice.
Comment #5
quietone CreditAttribution: quietone as a volunteer commentedThe d7 fixture has a 'site_offline_message' and a 'maintenance_mode_message'. I asked larowlan about this and he thought the site_offline_message is D6 only. And he confirmed this later and posted this in slack
So, ideally we need to remove system_maintenance.yml and create a d6_system_maintenance.yml and a d7_system_maintenance.yml but we don't yet have a way to deprecate migration ymls.
Comment #6
quietone CreditAttribution: quietone as a volunteer commentedSo a d6 and d7 version of the system_maintenance migration is needed. This patch does that but there is still the problem of deprecating system_maintenance.yml.
Comment #7
Wim LeersHm … tricky!
I think that what you're saying is that any existing migration that is referencing the
system_maintenance
migration should continue to work as-is. But it should not be discovered automatically anymore.We could then also remove all migration tags from the
system_maintenance
migration, and instead let the D6 and D7 successors be discovered by theDrupal 6
andDrupal 7
tags respectively instead?Comment #8
Wim LeersRE: deprecating migrations: #3039240: Create a way to declare a plugin as deprecated seems to be the relevant issue.
Comment #9
mikelutzComment #10
mikelutzWe need to explicitly test that the message is migrated.
Comment #11
quietone CreditAttribution: quietone as a volunteer commentedThese messages are already tested in d6/MigrateSystemConfigurationTest and d7/MigrateSystemConfigurationTest. The text of the messages didn't not change so no change was needed to the tests.
Comment #12
mikelutzMy mistake. So the migration was wrong, but the fixture was also wrong, and unfortunatly, in this business two wrongs can definitely make a right... :-(
No real way to add a failing test in this case, as we need to assume the fixture is right.'
Thanks for pointing that out. RTBC
Comment #13
quietone CreditAttribution: quietone as a volunteer commentedUpdated the IS to explain why the test didn't change.
Comment #14
alexpottAt the moment this patch removes core/modules/system/migrations/system_maintenance.yml - can we actually do that and preserve BC? As far as I know most people use migrate plus which copies such templates to config therefore won't be affected.
I looked at #3039240: Create a way to declare a plugin as deprecated and I was wondering where the discussion of the use of deprecating migrations is?
Comment #15
heddnCould we add a test where we run a migration with the template, then remove it and see what happens when we try to rerun the migration again? Could be manual or automated testing.
Comment #16
DamienMcKennaWould renaming the yml files run afoul of the BC standard and require waiting for #3039240: Create a way to declare a plugin as deprecated?
Comment #17
mikelutzTechnically the files can be renamed, it's the plugin ids that we can't remove. If someone is expecting a migration plugin_id to exist, and it disappears then that's a bc break. #3039240: Create a way to declare a plugin as deprecated is an attempt to let us find a way to remove them during major version updates.
Comment #18
mikelutzFor now, we do need to preserve the system_maintenance migration somehow or postpone on #3039240: Create a way to declare a plugin as deprecated, but I think we can refactor, given that 3039240 would require us to keep it in a deprecated state anyway. I'll put this on my task list.
Comment #20
quietone CreditAttribution: quietone as a volunteer commentedRefactoring so the deprecation can be avoided. This works if 'site_offline_message' and 'maintenance_mode_message' are mutually exclusive. If they both exist in a database then 'site_offline_message' (from Drupal 6) will be used.
Comment #21
quietone CreditAttribution: quietone as a volunteer commentedReady for review.
Comment #22
heddnI like it. Not sure about the need for explicit test coverage or not.
Comment #23
quietone CreditAttribution: quietone as a volunteer commentedI was hoping that wouldn't be necessary but since you asked I have altered the existing test. What this does is add the Drupal 6 variable name to the Drupal 7 text fixture, thus verifying that if both exist in a Drupal 7 site for some reason then the correct message is migrated. I realize that this patch removes the d6 variable from the d7 fixture and the test adds it back in. That keeps the d7 fixture 'correct' and makes it easier to see what is being tested. I doubt that a d6 site would have a d7 variable name so only the d7 test is modified. I think this is sufficient and avoids creating a new test.
Oh, I changed the order of the variables in the callback so that the d7 one is the default. And then did so in the source plugin so they are in alpha order.
Comment #24
quietone CreditAttribution: quietone as a volunteer commentedUpdating version
Comment #25
heddnAll feedback addressed.
Comment #26
catchComment #29
catchCommitted/pushed to 9.2.x and cherry-picked to 9.1.x, thanks!