Closed (fixed)
Project:
Drupal core
Version:
11.x-dev
Component:
migration system
Priority:
Critical
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
25 Oct 2018 at 21:44 UTC
Updated:
2 May 2025 at 12:45 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #7
quietone commentedMaking a child of the deprecation issue.
Comment #8
quietone commentedThis needs to be done in order to deprecate migrate drupal and friends.
Comment #10
danflanagan8Here's an attempt at getting all mentions of
source_moduleout ofmigrate. I didn't think too hard about BC or deprecations or anything like that. Not sure what tests might fail. We'll see. This'll be fun.I ran the test I moved from migrate to migrate_drupal and fixed it up so it would pass. Other than that though I'm flying blind.
As for the
destination_module, I'm not totally sold that it needs to be removed. We'll still be migrating into Drupal even aren't migrating from Drupal. Alas it appears the migration meeting mentioned in the IS is from the before times when the migration meetings were ephemeral calls with no minutes, so I couldn't find anything on the record about the thoughts there.Comment #11
danflanagan8removing un-unused use.
Comment #13
danflanagan8This patch should take care of a lot of those failures. I didn't test all of them locally, but enough to feel like this is progress.
Comment #15
danflanagan8This should make everything green.
Comment #16
danflanagan8It's green!
Comment #17
danflanagan8Here's an updated patch that takes deprecation seriously. It also adds test coverage for the new
DrupalEmbeddedDataclass, for which I had not yet taken the time to add a test.To be clear, I have still only worked on
source_module.Comment #19
danflanagan8Dag nabbit. Fixing the namespace of the new test.
Comment #20
quietone commented@danflanagan8, thanks for moving this along!
I've have a cursory look, intending to update the IS but I have run out of steam.
The change to ResponsiveImageStyles can be removed when #3250582: ResponsiveImageStyles source plugin must extend DrupalSqlBase is done.
nit: s/Instead/Instead,/
Comment #21
mikelutzNW on comma, but also maybe PP on #3250582: ResponsiveImageStyles source plugin must extend DrupalSqlBase
Comment #22
quietone commentedFixing the comma.
Since this is Migrate critical let's not postpone it.
Comment #24
quietone commentedAssigning to myself to update the deprecation message
Comment #25
danflanagan8This one needs a re-roll due to the related issue that has been fixed: #3250582: ResponsiveImageStyles source plugin must extend DrupalSqlBase
Also sounds like @quietone is planning on updating the deprecation notice:
In addition to changing the drupal versions, we should update the link as well. It's pointing at this issue. We should make a change record and point at the change record instead. Tagging for the CR.
Comment #26
ravi.shankar commentedAdded reroll of patch #22 on Drupal 9.5.x. keep the status needs work for change record.
Comment #27
quietone commented@ravi.shankar, thanks for the re-roll. Remember to read the comments, the previous comment said this should be on a new version and that can happen in the reroll.
Made a CR and updated the patch accordingly.
Still need to update the Issue Summary. And the new source plugin, drupal_embedded_data, looks like it is just adding a source_module declaration to the plugin. That isn't needed because you can do that in the yaml. I'll look at the next.
Comment #28
quietone commentedI did run the checks before uploading the patch and there were no errors. Looking again. Oh, it is failing because it is looking for errors from a file that has been renamed. There must be a better way.
Let's see if just removing the offending lines from the baseline file works.
Comment #30
quietone commentedRestore the legacy behavior of \Drupal\migrate\Plugin\migrate\source\SourcePluginBase::getSourceModule() by putting the code instead of pointing to the new method in migrate_drupal.
Comment #31
quietone commentedMissed this one.
Comment #32
quietone commentedFixing #31
Comment #33
quietone commentedNow back to the comment in #27.
I don't see the reason that we need drupal_embedded_data, so I have removed it. Seems to me that anyone needing to embed data can use 'embedded_data'.
This patch also removes the changes to ResponsiveImageStyles. I suspect they were added before ResponsiveImageStyles was fixed to extend from DrupalSqlBase in #3250582: ResponsiveImageStyles source plugin must extend DrupalSqlBase.
Comment #35
quietone commentedThis was discussed at a migrate meeting, discussion 8 in #3307392: [meeting] Migrate Meeting 2022-09-01 2100Z. Essentially, this will continue to allow migration ymls to configure the source plugin with a 'source_module' property. The property can be used in migrate and migrate drupal source plugins. But for plugins extending from DrupalSqlBase (migrate drupal) source_module is required. For those, source_module must be declared either in the definition or in configuration.
This patch is implementing that. I am not updating the IS just yet. Let's make sure all tests pass.
Comment #37
quietone commentedNamespace error.
If we agree to do this we can also deprecate \Drupal\migrate_drupal\Plugin\migrate\source\EmptySource.
Comment #38
quietone commentedUpdated IS and un-assigning.
Ready for review!
Comment #39
danflanagan8I like the new approach, @quietone. I have a couple three comments.
1. There are a couple source plugins that still declare source_module that aren't extending DrupalSqlBase. Specifically:
MigrateExternalTranslatedTestSourceCacheableEmbeddedDataSourceWe should probably remove source_module from their annotations.
2. I like the idea of deprecating the md_empty plugin if possible. :)
3. The CR is still reflecting the old "all source modules must go!" approach. I'll tag for a CR update.
Comment #40
quietone commented@danflanagan8, thanks.
#39
1. Fixed. I also grepped for more instances and didn't find any.
2. Adding tag for a followup
3. I hope to do that now.
Comment #41
quietone commentedFollowup made #3308772: Deprecate Migrate Drupal EmptySource source plugin
CR updated
Next is to look at destination_module. It may be the same type of change.
And this will need a title update.
Comment #42
quietone commentedDoing the same for 'destination_module' is more work. AFAICT migrate_drupal destination plugins would be needed for all the destination plugins in migrate. And that would also mean changing all the migrations. If that is correct then that should be done in another issue.
I'll refrain from updating the IS etc, waiting on other opinions.
Comment #43
smustgrave commentedcan public function getSourceModule() { be typehinted.
Should destination_module be a follow up?
Comment #46
quietone commentedComment #47
quietone commentedComment #48
smustgrave commentedHiding all the patches for clarity.
Applied a typehint suggestion directly to the MR.
Rest appears fine.
Thanks for updating
Opened #3438187: Move destination_module from Migrate to Migrate Drupal as a follow up for destination_module.
Comment #50
alexpottShouldn't we be issuing a deprecation for non migrate drupal source plugins that have a source_provider key?
Comment #51
quietone commented@alexpott, thanks for the improvements.
I don't think a deprecation is needed because the requirement has always been about Drupal source plugins only.
See, for example, the 'Table' source plugin in MigratePlus which does not use source_module, https://git.drupalcode.org/project/migrate_plus/-/blob/6.0.x/src/Plugin/.... This also what is said in the original change record, https://www.drupal.org/node/2911881.
Comment #52
quietone commentedWhile reviewing this I realized that this wasn't taking into account the situation where the source_module is not defined in the source plugin but is defined in the migration yml. This is definitely a feature used in core...
To address that I made a test to show the failure and that made a fix.
Comment #53
needs-review-queue-bot commentedThe 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 necessarily 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.
Comment #54
quietone commentedBack to NR
Comment #55
smustgrave commentedAll feedback appears to be addressed
Comment #56
alexpott@quietone If we don't issue a deprecation as suggested in #50 how is someone to know that they should remove the source_module from their non-drupal plugins - like core has done?
I think we should do something like
Comment #57
smustgrave commentedFor the deprecation.
Comment #58
quietone commented@alexpott, a deprecation is not needed because all source plugins can use
source_moduleif they want to. That is how it is defined in MigrateSource. And in #51, there is a link to thetablesource plugin provided by MigratePlus and that does not define a 'source_module'.I think it is an oversight somewhere that 'source_module' was not removed from the source plugins in the Migrate module.
Comment #59
smustgrave commentedSince this has been 3 months to help it not stale going to mark it for committers queue since only open feedback is around the deprecation or not.
Comment #60
mikelutzI think we need to rethink this, and #3421014: Convert MigrateSource plugin discovery to attributes in light of #3371229: [Policy] Migrate Drupal and Migrate Drupal UI after Drupal 7 EOL
source_module is a migrate_drupal thing, as this issue points out, but despite the work here, the source_module key is still a thing defined in migrate as part of the source plugin annotations, and 3421014 is moving it over to the attributes defined in migrate. I'm working out the order of operations here, but I think the concept of source_module as a source plugin attribute/annotation key needs to be deprecated in Drupal 11 along with everything else migrate_drupal.
I have not followed the raw details on the annotation to attribute conversion for plugins, and I'm not sure what would break if we did this, but my gut says that in 3421014, we should NOT support source_module as a source plugin attribute, nor should we convert the d7 source plugins that we are deprecating in D11 over to attributes. I'm sure there's some core test somewhere that ensures core plugins which support attributes use them, and we may have to find a way around that for the sources we are deprecating, but I feel like it's worth it, and it saves us from having to deprecate source_module as it can just go away with annotations.
Comment #61
benjifisherWe (@benjifisher, @godotislate, @mikelutz, and @quietone, with some input from @larowlan) discussed this issue on Slack (https://drupal.slack.com/archives/C226VLXBP/p1736647603190789).
Despite Comment #60, we agreed to convert annotations to attributes first, and then to deal with
source_module, so I am postponing this issue on #3421014: Convert MigrateSource plugin discovery to attributes. Once that issue is done, we will have to completely rewrite the MR here, but I think that will not be hard. We have already done the work of deciding what has to be done, and all we will have to do is re-implement it.When I am feeling really optimistic, I think that if we can get both issues done before 11.2.0 is released, then we can skip the deprecation step. If
source_modulenever exists as an attribute in a release of Drupal core, do we have to deprecate it?Comment #62
benjifisherNow that #3258581: Move I18nQueryTrait from content_translation to migrate_drupal is Fixed, we can change this one from PP-2 to PP-1.
Comment #63
catchComment #64
benjifisherNow that #3421014: Convert MigrateSource plugin discovery to attributes is fixed, we can return to this issue. In an earlier comment, I suggested that we would have to rewrite the MR for this issue, but I changed my mind. I rebased the MR, resolving conflicts between this issue and #3421014.
I think we need to update the issue summary with the current proposed resolution.
I think that
Drupal\migrate_drupal\MigrationPluginManager::processDefinition()needs some further work. I have to think about whether @alexpott's comment on that issue is still valid, or if the recent changes make it obsolete.Comment #65
benjifisherComment #66
benjifisherI implemented @alexpott's suggestion: trigger a deprecation warning if there is a
source_moduleannotation on a source plugin (or in its configuration) if it is not needed. That led to a complete rewrite ofDrupal\migrate_drupal\MigrationPluginManager::processDefinition().Then I created the
MigrateDrupalSourceattribute class, extendingMigrateSource, and moved thesource_moduleproperty to the new class. And I updated most code source plugins to use the new attribute class. This change breaks BC, but that is OK if we get it done before Drupal 11.2.0 is released.Let's see what the testbot thinks.
Comment #67
godotislateThe unfortunate issue with an attribute being defined in a module separate from the one that has the the main attribute is this:
migrateandmy_modulemodules installed, but not migrate_drupalMigrateSourceattribute. TheMigrateDrupalSourceattribute on any class is ignored as a comment, since the attribute class does not exist with the module uninstalled. This all works as expected without errorDrupal\my_module\Plugin\migrate\source\MyMigrateDrupalSourcethat uses theMigrateDrupalSourceattribute, the entry associated with the class saved in the file cache will beNULLNULLvalue forMyMigrateDrupalSourceis retrieved from cache.MyMigrateDrupalSource.phpdoesn't get parsed for the attribute data, and the definition is not discoveredThere are some attempts to deal with a very similar problem in #3443882: Allow attribute-based plugins to discover supplemental attributes to set additional properties.
Comment #68
mikelutzCan we manually clear that apcu cache in migrate drupal's hook_install? along with the source plugin discovery cache?
Comment #69
benjifisher@godotislate:
Thanks for explaining that!
In Comment #66, I wrote:
The
MigrateSourceattribute was defined in #3421014: Convert MigrateSource plugin discovery to attributes (I know you know, but I want a convenient link), and that was committed to the 11.x branch only (not to 11.1.x, not in any release).I was going to say that any module that uses
MigrateDrupalSourceshould declare a dependency onmigrate_drupal, and that we should say so in the change record. Then I realized that there are a bunch of core modules that define D6/D7 sources, and those modules should not depend onmigrate_drupal.I see your point.
What options do we have?
migrate_drupal'shook_install(Comment #68).Any others?
I think the third option is the simplest. We discussed that option on #3421014, but I (and maybe others) did not understand the implications.
Comment #70
catch@mikelutz we can't rely on clearing the apcu cache because e.g. if apcu is cleared from the command line it won't affect web requests and vice versa.
However, the cache key is set in
AttributeDiscoveryWithAnnotations::getFileCacheSuffixand I think we could key that byrootNamespaceswhich is iirc more or less the module list, that way it will always depend on the combination of modules enabled.I was about to write that this might slow down the installer, but we barely/ever discover plugins during install so it shouldn't make much difference at all.
Comment #71
godotislateGetting #3443882: Allow attribute-based plugins to discover supplemental attributes to set additional properties would be great, but I think it's at an impasse for now on what approach to go forward with.
Another idea would be to remove the
source_moduleproperty from theMigrateSourceattribute, and usehook_migrate_source_info_alter()implementations to add thesource_moduleproperty to the relevant definitions. This would be similar to the approach taken for the Navigation module in #3443833: Provide a way for other modules to flag block plugin implementations as 'navigation safe', wherehook_block_alter()implementations can be used to add theallow_in_navigationproperty to block plugin definitions. Formigrate_drupalsource plugins, this probably could be done as one single alter hook inmigrate_drupalfor all the relevant plugins throughout core modules.Comment #72
godotislate@catch Any concern about possibly having multiple entries, based on combination of modules installed, for just about every file in the plugin directories for every plugin type? Though this would be mitigated once #3490484: [meta] Lots of non-plugin PHP classes in plugin directories is addressed.
This could be isolated to migrate source plugin discovery, because it has its own classes
AttributeClassDiscoveryAutomatedProvidersandAttributeDiscoveryWithAnnotationsAutomatedProviders. On the other hand, it's probably not ideal to make migrate source discovery any more special than it already is.Comment #73
mikelutzI am still of the opinion that we shouldn't have converted any of d6 and d7 source plugins to attributes at all. Leave source_module in the annotation, leave all the sources as annotations, and depreciate them. They all have to go before D12 anyway. There was never any reason to deal with source module in attributes at all. We haven't done a release with the conversion yet, we could still execute it this way and not worry about it.
Comment #74
godotislateI agree this seems to be the most straightforward way ahead in that it isn't dependent on resolving blocker issues on the plugin subsystem as a whole.
Comment #75
catch"catch Any concern about possibly having multiple entries, based on combination of modules installed, for just about every file in the plugin directories for every plugin type? Though this would be mitigated once #3490484: [meta] Lots of non-plugin PHP classes in plugin directories is addressed."
So yes,but I have an issue open for a database-backed filecache backend which needs a lot of work, but plugin discovery would be a good candidate. We could put it in memcache/redis in contrib too. Would be accessible to all processes and free up apcu for frequently accessed things.
Comment #76
benjifisherI think Comment #73 and the third option in Comment #69 are the same thing. Let's do that. (As soon as I have a little spare time.)
For the record: another option is to move all the source plugins (except those in the
migratemodule) to themigrate_drupalmodule.Comment #77
benjifisherI do not have time now to make the agreed changes, but this commit should fix some of the failing tests.
Four of the migrations in the
block_contentmoduleembedded_datasource plugin;source_modulein the source configuration.Maybe I should remove the
source_modulefrom those migrations, but for now I am changing the logic so that we do not get a deprecation message for these. See Comments #50, #56.Comment #78
catchfwiw I think it's completely reasonable to leave the source plugins using annotations, we probably won't actually remove annotation support from core until Drupal 13 (although I really hope we can deprecate it by Drupal 12), and when it's deprecated it just means @group legacy on tests.
Comment #79
benjifisherI am mostly reverting the source plugins to be the same as in the 11.1.x branch, but I have to be careful not to revert the changes from #3258581: Move I18nQueryTrait from content_translation to migrate_drupal and another issue or two.
This reverts what I said in the second half of Comment #66 along with a lot of what we did in #3421014: Convert MigrateSource plugin discovery to attributes.
As long as we are removing
source_modulefrom theMigrateSourceattribute class, should we also get rid of these?If so, do that in this issue or in a follow-up?
Comment #80
benjifisherI am adding a few items to the "Remaining Tasks" in the issue summary.
Comment #81
catchI think a follow-up for #79 might be a good idea. I assume we're only using those for migrate_drupal but I couldn't answer the question whether contrib might possibly be relying on them etc. so if it doesn't make this issue easier to include here, splitting off sounds good.
Comment #82
quietone commentedYes, let's not change the scope of this issue. I agree with catch. I have updated the remaining tasks for this.
Comment #83
benjifisher@catch, @quietone: Thanks for the prompt replies!
Earlier, I added this question to the Remaining Tasks:
I think the current version of the MR gets it right: only issue a deprecation if
source_moduleis present ANDmigration_tagsinclude neither "Drupal 6" nor "Drupal 7" ANDmigrate_drupalis not one of the providers.Here is why that is the right decision. I ran into some failing tests because there are 4 migrations in the
block_contentmodule that use theembedded_datasource plugin and have thesource_moduleproperty. At first, I deletedsource_property, but then theValidateMigrationStateTesttests failed. So we need to allowsource_moduleif there is an appropriate tag.As a bonus, I finally found the right way to fix the deprecations: make sure that config is installed in
MigrationPluginListTest::testGetDefinitions()so thatMigrationPluginManager::getEnforcedSourceModuleTags()(themigrate_plusversion) works.Even though this issue still needs an update to the summary and the change record, I am going to say it is ready for review.
Comment #84
benjifisherI am adding a detailed list of changes to the issue summary.
While I was preparing this summary, I noticed that a test had an
@group migrate_drupal_uiannotation even though it was in themigratemodule and this issue moves it to themigrate_drupalmodule. I changed it to@group migrate_drupal.Comment #85
benjifisherI added #3518890: Remove mimimum_version and requirements_met from MigrateSource attribute class, so I can cross off another one of the remaining tasks.
Comment #86
mikelutzMarking this as critical and an alpha blocker, as this is undoing changes from earlier in the 11.2 development cycle that we absolutely do not want to see in a release.
I did a quick review of the new MR, and at a glance, everything looks good. I want to spend a little more time and/or have a couple of other sets of eyes on it before I RTBC, but I do think this is likely good to go.
Comment #87
benjifisherI rewrote the change record.
I will also update Plugins converted from Annotations to Attributes in 11.2.0, the change record for #3421014: Convert MigrateSource plugin discovery to attributes.
Comment #88
benjifisherI just rebased the MR on the current 11.x. There were merge conflicts from #3506605: Move the d8_config source plugin to the migrate module, and I also checked #3515213: Convert recently added test plugin to use attributes.
Details: #3506605 deprecates the
d8_configsource plugin in themigrate_drupalmodule. Part of that deprecation is overriding the constructor from the parent class and triggering a deprecation warning. Before that issue, the class did not override the constructor, so it did not needusestatements for the constructor's arguments. The only merge conflicts were in theusestatements at the top of the file.Comment #89
benjifisher#3506605 also adds a new source plugin. I forgot to remove
source_modulefrom that plugin during the rebase, but PHPStan reminded me.Comment #90
mikelutzOkay, I did some further review on this, and it's looking good. I did some git magic to compare this MR against what 11.x would look like with the annotation conversion reverted to make sure all the expected source plugins were reverted and they were.
RTBC from me.
Comment #91
catchUpdated the issue summary.
Comment #92
catchCommitted/pushed to 11.x, thanks!
Comment #95
catchComment #97
catchRe-titling this because the eventual change was different to what happened, unfortunately didn't realise this before commit.