Closed (fixed)
Project:
Drupal core
Version:
9.2.x-dev
Component:
migration system
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
12 May 2021 at 11:25 UTC
Updated:
24 Jun 2021 at 19:39 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
n4r3nThis patch provides datetime module's field formatter mapping.
Comment #3
quietone commented@n4r3n, thanks for the patch.
Since these are king of boilerplate additions I am not so sure this should be done by module. Do you have any idea of how many more modules have formatters that need to be added?
Comment #5
wim leersCurrently we have no knowledge of more core modules where this needs to happen beyond #3212539: Map all Link module's fieldformatters from D7 to D8/D9 and this one. These were the two that surfaced recently.
This updated the D7 test coverage, but the D6 test coverage still needs to be updated:
is failing.
Comment #6
quietone commented@Wim Leers, is there a way to check that? I am not opposed to doing some research.
Comment #7
n4r3nUpdated failing d6 tests.
Comment #8
akhildev.cs commentedhi,
Patch #7 applied cleanly on 9.3.x-dev.
thankyou.
Comment #9
quietone commented@Akhildev.cs, Welcome to Drupal! As a new contributor to Drupal I suggest reading the contribute to Drupal core guide.
I can look in Drupal 7 Date, date.field.inc, and see these formatters. For Drupal 6 I only see default and format_interval, there isn't a date_plain and this plugin is annotated for Drupal 6 and Drupal 7. Since this is a mapping it functionally may not matter but then this patch is also modifying the Drupal 6 tests as if that formatter was available id Drupal 6.
We may need to split the field plugin into a D6 and D7 version.
Comment #10
wim leers#6: The only way to do that is to audit both Drupal 7 core and all Drupal 7 contrib modules moved into Drupal 8 core and audit all net-new field formatters & widgets in Drupal 8.
So … that means a lot of manual auditing. Which is also exactly why this is only being discovered so many years later!
Comment #11
wim leers#9: Good point!
date_default,format_interval,date_plaindefault,format_interval… which means
\Drupal\datetime\Plugin\migrate\field\DateField::getFieldWidgetMap()is already wrong in HEAD!+1
This apparently has been broken since the day this was added to Drupal core, in #2893072: Modify the DateField Field plugin so it's used for D6 & D7.
@quietone How do you propose we continue here? What you say (which makes sense!) basically means bringing back the D6-specific class that #2893072: Modify the DateField Field plugin so it's used for D6 & D7 deprecated — oh irony! 😅
Comment #12
quietone commented@Wim Leers, thanks for the history.
Yes, it is a lot of manual auditing. But it is an unavoidable part of a migration, something I see as a responsibility that should be done as part of any migration. Of course, we are human and mistakes will be made.
I think the next step is to do the research on the d6/d7 date field migrations and see where they are the same and where they differ. We need to determine if the methods in \Drupal\migrate_drupal\Plugin\migrate\field\FieldPluginBase work for both. If it just the mappings (getField*Map) then it may be OK to keep one field plugin. If not, they will have to be split again. Make sense?
Irony, indeed!
Comment #13
wim leersOf course!
But that's why I'm saying I think it's better to do these on a per-discovery basis rather than requiring one or more humans to go scouring the depths of many codebases just to make this issue/patch "as complete as possible" (i.e. cover ALL D9-core-relevant D7 field formatters). If we require that, this is unlikely to ever finish. I'd much prefer more smaller issues that land sooner and help more migrations sooner.
Comment #14
wim leersAFAICT that work done as part of #2893072: Modify the DateField Field plugin so it's used for D6 & D7?
This is what I strongly suspect. That's also why people are not reporting the "D6 date field to D8|9" migration to be broken. All that we're reporting and fixing in this issue is the formatter mapping.
Yes! 😊
IMHO, given that you do think it's okay to keep a single field plugin if the difference is only in
getField*Map(), I think we should go ahead with this issue & patch as-is. If there is a pre-existing problem with the migration of date field data in Drupal 6 (as opposed to date field formatters), we'd have heard about it.Making this issue about that too is a significant expansion in scope.
(Not to mention that the number of remaining Drupal 6 sites has dwindled significantly, so I'd prefer being pragmatic to favor helping the ~600K D7 sites that still need to migrate without slowing it downfor the ~20K D6 sites that remain.)
Comment #15
n4r3nUpdated patch for Drupal 9.1.7:
Comment #16
n4r3nThis patch is `fix-only` for Acquia migrate module specific.
Comment #17
quietone commented@Wim Leers, My comments in #13 about research were not meant to hinder the progress here. At the risk of repeating myself I was trying to say that the research into the formatters, widgets etc it best done at the time a new FieldPlugin is added. Of course, that has to be balanced with getting something working for the majority of cases and having something working sooner rather than later.
So, where are we now? The fix here is fine, adding a formatter to a map will not break a D6 migration. I wast just about to RTBC it when I got conservative and would like a comment added. Something along the lines below:
Let's add a comment, before the return line, so we don't forget why this is here. I don't know, something like
// The date_plain formatter exists in Drupal 7 but not Drupal 6. It is added here because this plugin is declared for Drupal 6 and Drupal 7.Setting to NW for the comment and a reroll.
Comment #18
n4r3nRe-rolling patch #7 with comment from #17.
Comment #19
ravi.shankar commentedComment #20
wim leersWFM! :)
Comment #23
catchCommitted/pushed to 9.3.x and cherry-picked to 9.2.x, thanks!