This is a follow-up of #2880334: Add update path of media_entity config changes from 1.x to core media module.

On that issue, we created a basic upgrade path for basic scenarios and opened the 2.x branch for testing.

The purpose of this issue is to improve the upgrade path and make it more robust, with the goal of ensuring the transition from Media Entity to Media in core is smooth for the majority of sites.

Required for upgrade path to be considered stable:

Could have:

CommentFileSizeAuthor
#2 2915738-2.patch221.42 KBphenaproxima

Comments

marcoscano created an issue. See original summary.

phenaproxima’s picture

Version: 8.x-1.x-dev » 8.x-2.x-dev
StatusFileSize
new221.42 KB

Here is a patch (mostly consisting of a compressed database fixture) that tests Media Entity's hook_requirements.

phenaproxima’s picture

Status: Active » Needs review
Issue tags: +Media Initiative

Derp. Forgot to change the status.

Status: Needs review » Needs work

The last submitted patch, 2: 2915738-2.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

marcoscano’s picture

Title: Improve test coverage of upgrade path to Media in core » Increase reliability of upgrade path to Media in core
Issue summary: View changes

Broadened a bit the scope of the issue.

For example, the drush command we are providing is not going to be compatible with Drush 9, we should address that.

marcoscano’s picture

Title: Increase reliability of upgrade path to Media in core » [PP-1] Increase reliability of upgrade path to Media in core
Issue summary: View changes
Status: Needs work » Postponed
Related issues: +#2877383: Add action support to Media module
marcoscano’s picture

Re-purposing this to make this a plan and wrap all other little bugs that are bubbling up.

marcoscano’s picture

marcoscano’s picture

Status: Active » Needs work
+++ b/tests/src/Functional/CoreMediaUpdatePathRequirementsTest.php
@@ -0,0 +1,46 @@
+    // The fixture had the 1.x versions of several media type providers
+    // installed.
...
+    // The fixture had a generic media type, but Media Entity Generic is not
+    // present in the current code base.

If I understand correctly, this test assumes a codebase in a state that matches the fixture (drupal-8.3.7-media-suite). Can't we try to avoid that? It will quickly start to get very difficult to manage that while running tests. (By the way, I'm not sure if it's possible at all)

In other words, if you are running this test in a codebase with media_entity_instagram 2.x, the assert

$assert->pageTextContains('Some modules that depend on media entity were not updated or uninstalled.');

will fail.

However, if we are running tests that use the fixture 8.4 (that assumes different codebases), we'll need to update the codebase before running the test.

marcoscano’s picture

Actually, let's move the discussion about patch #2 to #2916821: Improve automated tests of Media Entity upgrade path to Media core and keep this issue as a plan.

(I have moved the patch there and re-commented what I said above)

marcoscano’s picture

Issue summary: View changes
marcoscano’s picture

Issue summary: View changes
marcoscano’s picture

Issue summary: View changes
marcoscano’s picture

Issue summary: View changes
marcoscano’s picture

Issue summary: View changes
marcoscano’s picture

Issue summary: View changes
marcoscano’s picture

Issue summary: View changes
marcoscano’s picture

Issue summary: View changes

Added the link to the manual testing spreadsheet to the IS.

marcoscano’s picture

Regarding:

Review all (or most of the) plugin contrib modules with 2.x branches, making sure there's documentation about when to use 1.x and when to use 2.x.

I went through the list in #2860796: Plan for contributed modules with Media Entity API in core and checked all projects that have 2.x branches available. Some of them have no information about when to use 1.x versus 2.x, and others have some information but it's still not clear in some cases that you can indeed use the 1.x branch with core 8.4.x.

My suggestion is to make that very explicit, because users are already getting confused by the mix of versions.

A possible wording of text to be used could be something like:

<h2>Which version should I use?</h2>

Regardless of your Drupal core version, if you are using the 1.x branch of <a href="https://www.drupal.org/project/media_entity">Media Entity</a>, you should continue using the 1.x branch of this module.

If you are building a new site and want to use the new Media in core (>= 8.4.0), you should use the 2.x branch of this module.

If you have an existing site with Media Entity 1.x and you want to upgrade to Media in core, you need to update the code of this module from the 1.x branch to the 2.x branch. Please check the upgrade instructions on the <a href="https://www.drupal.org/project/media_entity">Media Entity</a> module page for more information on that process.

Below are the modules that I checked and their maintainers (as stated on the project page):

Audio: KO (slashrsm)
Carto: OK
Crop API: OK
Document: N/A
Dropzonejs: KO* (zkday)
Entity Browser: OK
Facebook: KO* (dawehner)
Flickr: KO (dakku)
GoogleDocs: KO* (dakku)
Instagram: KO* (slashrsm)
Media Expire: KO* (chr.fritsch)
Pinterest: KO* (bonus)
Riddle Marketplace: KO* (chr.fritsch)
Slideshow: KO* (slashrsm)
Tumblr: KO (dawehner)
Twitter: KO* (slashrsm)
Video: KO* (Daniel Korte)
Video Embed Field: KO (Sam152)

OK: Info is clear on the project page
KO: There is no indication on the project page
KO*: It's mentioned, but it could be clearer that 1.x is OK with 8.4

@Maintainers: could you please check the project page and see if the text can be improved? Thanks!

marcoscano’s picture

I could ping directly all maintainers listed above, with the exception of:

  • zkday (dropzonejs)
  • dakku (flickr, googledocs)
  • bonus (pinterest)

Does anyone have means to reach them, or know other people with access to these project pages? If not, I can also create an issue on the project's issue queue.

sam152’s picture

Added a slightly modified version of the description in #19 to the video_embed_field project page and the release notes for latest version on each branch. I've also marked the 2.x branch as "supported", so it appears on the project page.

I think as soon as the media_entity contrib is marked as unsupported, that can be the trigger for all the other contribs to mark their contrib media branches as unsupported too.

dawehner’s picture

Adding this documentation to all the media helper modules is a great idea!

I added the mention on both facebook and tumblr. Thank you! It would be nice to be able to link to a handbook page explaining things with more details.

marcoscano’s picture

Thanks @Sam152 and @dawehner!

Re:

It would be nice to be able to link to a handbook page explaining things with more details.

You can! :)
There is a brief documentation guide about the core Media module, and a specific FAQ page about the most common questions. By the way, feedback about the text there is more thank welcome! Please let me know if you see any information missing or not clear enough!

marcoscano’s picture

phenaproxima’s picture

I'm crediting @bdimaggio on this issue for having gone through the test spreadsheet (linked in the IS) and tested all the scenarios, as well as creating fixtures for each to ease further testing. All the karma unto him!

phenaproxima’s picture

phenaproxima’s picture

marcoscano’s picture

marcoscano’s picture

Issue summary: View changes

There should also be a solution for sites using EXIF image handling and want to upgrade. Added #2925712: Media Entity Image 8.x-2.x - core Media API roadmap & integration to the IS as well.

marcoscano’s picture

Issue summary: View changes

Added #2923372: Upgrade fails if site has "medium" image style missing to the IS.

With that, I believe we are in a position of saying that the remaining goals for "upgrade path stability" are:
- Achieving "confidence" with the manual testing
- Providing a solution for sites using EXIF mapping (#2925712: Media Entity Image 8.x-2.x - core Media API roadmap & integration)

marcoscano’s picture

Issue summary: View changes

IS housekeeping

geek-merlin’s picture

geek-merlin’s picture

Worked around that issue by updating in 2 steps.

So let's do this:
#2928114: Add to instructions that only 2-step update is supported
It may win us a lot of time for other things.

Any objections?

geek-merlin’s picture

marcoscano’s picture

Issue summary: View changes

Added the last issues to the IS as well.

geek-merlin’s picture

marcoscano’s picture

marcoscano’s picture

marcoscano’s picture

Issue summary: View changes

Added #2877378: Add token replacements for Media to the list of must-haves, now that we know that there would be missing tokens.

geek-merlin’s picture

tstoeckler’s picture

I would like to say thank you for everyone that worked on the update path. I just performed this update on our platform and it was sooo much easier than I had expected, it was almost seamless.

I did hit #2928123: Configuration broken: Zombie media_type_file, so was happy I could just update to the latest dev, and I also found #2935194: Update leaves around stale tables and entity field definitions and #2935196: Module *un*installation at the end of update path fails if module is missing, but that's just sort of "cleanup" stuff. The update itself actually went really flawless, awesome!

marcoscano’s picture

Issue summary: View changes
Status: Needs work » Needs review

Thanks @tstoeckler!
I have added the new ones to the IS as well.

I think we may be very close to considering this "stable enough" for a beta. Leaving this in Needs Review for now.

marcoscano’s picture

Issue summary: View changes
Status: Needs review » Fixed

After the agreement that tokens should not be considered as part of the API (see #2877378: Add token replacements for Media), I have downgraded the tokens-related issue to a "could have", which can be treated in a follow-up without necessarily blocking stability of ME 2.x. In any case, I have added a note to the upgrade instructions on the module page and on the handbook page, with instructions about how to proceed if a site relies on media tokens.

With that, I feel all important issues are at this point solved, so IMHO we can considered this as "done", at least to start a beta phase and encourage more testing and feedback.

Thanks everyone!

marcoscano’s picture

Filed #2935505: Inform users upgrading to Media in core that the Token module should be used after the upgrade as a follow-up to include the token recommendation in the upgrade process itself.

stevieb’s picture

Just a note ... I've being updating a multi site install and watching this ticket religiously .. after many tries over the last month, today was the first time the update went through smoothly .. all DB's in my enviorment were updated ... the new media module was installed and all media entity elements uninstalled.

thanks for the great work.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

merilainen’s picture

I'm having a problem upgrading to use core's media, and I'm not sure where to report this.

Running drush updb goes smoothly and I don't get any errors, everything seems to work like before and the contrib modules are disabled correctly. But I cannot replace any files in existing or new media entities. Editing a media entity and changing a file will result in an empty file/image field. To me it seems file entity reference is lost on save. I don't get any errors in log. I noticed this when I tried to see if the thumbnail updating is really broken in core's media too. It turns out it's worse. I can't find any issues related to replacing files on core's media so I assume the problem is in the upgrade path. I don't have a vanilla Drupal 8 to test right now, but hopefully it's not broken there. All the file fields have been translatable if it's related to that somehow.

Other contrib modules related are: crop, video_embed_field and entity browser, but they seem to work fine.

Edit: Also saving a translation of a media entity without changing the file seems to empty the file field on the translation, so the problem might be related to the field being translatable.

Edit2: I also tried to create a new Image media type "New image" and marked the file property as translatable. Same thing happens: Cannot replace a file on existing media entity, file field becomes empty after save, no errors in log. Possibly a core bug?

Edit3: Another developer tested replacing a file in a document media type and it works in core's media (they didn't have media_entity before), so I suppose this problem is related to the upgrade path somehow.

marcoscano’s picture

I've tried to reproduce this but couldn't.

- Clean 8.6.x install
- Enable Media and Content Translation, add a second language
- Mark media Image bundle as translatable, select the file itself as translatable
- Create a Media entity with file A
- Edit the media entity and replace file A with file B
- Create a translation of the entity, replacing the file B with file C

Everything seems to work fine, do you see something different from your testing?

merilainen’s picture

Well I have Drupal 8.5.1 and media_entity was used, so I tried to upgrade to core's media. Your testing confirmed that something is not right in the upgrade path, thank you for testing.

tomsch’s picture

Hi,
thanks so much for documenting and organizing the upgrade path. I managed to upgrade with drupal 8.6.12, but the update hooks were never shown when I activated media-entity 2.x with media in core disabled. Eventually I deleted the unused modules myself and activated media in core manually.

See my bash snippet to follow what I did. A drush updbst after line 16 did not show any updates. A drush mecu said everything was OK.

At a first glance everything seems to work fine, the new media types are there and can be created, all media-related modules can be activated.

Now I am asking myself if there could be sure way to check?
I also wonder if I could have carried out the update before unknowingly and confusingly reverted back to media contrib?