Problem/Motivation
Due to the nature of media entities (which may depend on additional plugins that define new entity types), some confusion may happen during the transition period while moving media_entity
to core.
An existing site that uses the media_entity
approach will have an arbitrary set of contrib media_entity_*
installed. This site won't be able to upgrade to the new API in core until all of those plugins have 2.x branches that are compatible with media in core. Because of that we should prevent the core media
module from being enabled if the 1.x branch of media_entity
is.
Proposed resolution
Prevent installation of the media
module if a 1.x branch of media_entity
is detected.
Remaining tasks
User interface changes
API changes
Data model changes
Comment | File | Size | Author |
---|---|---|---|
#6 | interdiff-2-6.txt | 1 KB | marcoscano |
#6 | 2896427-6.patch | 1.04 KB | marcoscano |
#6 | core_media_installing.png | 48.57 KB | marcoscano |
#2 | 2896427-2.patch | 1.06 KB | marcoscano |
Comments
Comment #2
marcoscanoComment #3
seanBThis makes sense, I think we should have a test for this as well. Leaving 'Needs review' to get more opinions.
Comment #4
xjmThanks @marcoscano. I talked about this with @larowlan, @catch, and @cilefen, and we all agreed this is a good idea in principle. Core doesn't normally "know" about contrib modules, but in this case this is a small and harmless change that will save a lot of pain for media users.
I'd suggest adding this before 8.4.x, even when the module is not shown in the UI, since it will also help with the problem of sites that have some modules ported to the core API but not others. If they update one module and it tries to enable Media for them, they will get this error.
Based on that, I suggest a few things:
Comment #5
xjmwww.drupal.org/docs/8/core/modules/media is basically empty, so there's some work to be done there. :P I'll add that to the roadmap for "before the module is shown in the UI".
Comment #6
marcoscanoThis is a revised version of the message, linking to
media_entity
contrib.I'll start a draft of the text we can use for the contrib project page as well.
Comment #7
marcoscanoI don't have write permissions to the project page, but the maintainers can use this as an initial draft, if appropriate.
(and sorry for language imprecisions... having a non-native speaker writing documentation in English is never the best idea :)
Comment #8
marcoscanoRe: #5:
We've been traditionally using the GitBook handbook as documentation for the contrib ecosystem. I remember helping out with some Media Entity pages a while back actually: https://drupal-media.gitbooks.io/drupal8-guide/content/modules/media_ent...
We could probably migrate part of this info to the Drupal documentation page, adjusting what makes sense for the changes that happened for Media in core. As an initial step, though, I believe we could have in the Drupal documentation page the detailed instructions from #2880334: Add update path of media_entity config changes from 1.x to core media module at least.
Comment #9
Wim LeersI know that this caused a lot of frustration/WTFs for the sites using BigPipe, when BigPipe was added to core. So +1 to taking the pragmatic approach here :)
I think the key thing that's missing here, is test coverage. Basically, a test that proves that when
media_entity
8.x-1.x is installed, this error is shown, and when 8.x-2.x is installed, it is not shown.Comment #10
BerdirAnd how do we test that exactly? We can't mock system_get_info() nor unit-test a requirements hook, and while we could have a media_entity test module, that would only be one version and might be weird if media_entity is also on the system.
Comment #11
Wim LeersUgh :(
By looking at the code, I guess we can test it by prepopulating a particular cache item:
But that's obviously pretty brittle.
I defer the decision whether this needs test coverage or not to the committers then.
Comment #12
BerdirThat's an interesting idea, we could possibly mess with the static cache there, true.
Agreed, lets defer this decision to committers then, should we assign/tag the issue or mark it as RTBC? Not sure if there's something else left to do here?
We have #2208429: Extension System, Part III: ExtensionList, ModuleExtensionList and ProfileExtensionList which would break the static cache trickery but might make it possible to mock the underlying service in a kernel test (unit is not an option because this is a function as I mentioned). So if we do something with the static cache here, we'll have to update it in that issue.
Comment #14
slashrsm CreditAttribution: slashrsm at MD Systems GmbH commentedUpdated Media entity project page with #7 + few minor fixes. It would be great if any native speakers could review and correct the text. Huge thanks to @marcoscano for this!
I will RTBC this as it looks OK in general. I agree that we wait on committer feedback re tests.
Also moving it back to 8.4. I am aware that this could be tricky, but it should not interfere with any other system and that the benefit of this would likely be significantly diminished if we would need to wait until 8.5. Also citing @Berdir:
:)
Comment #17
catchLooks like xjm didn't get to marking this fixed, so I will :)
I'm also OK with no test coverage here, it's well outside the critical path and a messy system to test.
Comment #18
xjmBefore: Flame! Death! Destruction!
After:
Committed and pushed to 8.5.x. I also backported this to 8.4.x since it will prevent painful upgrades around 8.4.0. Thanks!
This is something media users need to be aware of so we should add it to the release notes. No test needed.