Install
Works with Drupal: ^11.2Using Composer to manage Drupal site dependencies
Alternative installation files
Download tar.gz
141.53 KB
MD5: 4a6687eec1466942bc32f5fe1bd47465
SHA-1: 43cc4181314983be2fd990897a1fe6073f02f102
SHA-256: abbad12817c8677250e6190605348a51c045d36563a0cca9a0d91887b318b837
Download zip
195.58 KB
MD5: e9939b84bd18544b566670680d74642e
SHA-1: a69a6e400d3a5e6edde231a88e7e1f9793b10341
SHA-256: 04a303cad87bcd781ae028a5fe73a00db39b794f4313d8f2d250b8753601629a
Release notes
This release fixes a bug that could lose a file when two or more media items use the same file entity. Content created before the module was installed can share files this way, for example after a migration, or when a video's poster field points at an image media item's file.
Bug fixes
Upgrade notes
- Shared files are copied during initialization. When
drush media-revision:initializefinds a file entity that more than one media item uses, it gives one of those items its own copy. That item then serves the file at a new public URL. Where possible, the command copies the file for an item whose published revision does not serve it, so that existing URLs keep working. The command summary reports the number of copies in the new "Files copied" count, and themedia_revisionlog channel lists each copy. - Run initialization for all bundles if files are shared. A run limited to one bundle can change more public URLs than a run for all bundles.
- Stricter validation. The
MediaFileUniqueUsageconstraint now also checks entity reference fields that point at file entities, such as poster fields, as well as the processable fields. A new media item that uses another media item's file now fails validation. A plain file that is used only in entity reference fields can still be shared, for example one placeholder poster for many videos. - Files are now kept when another media item's published default revision still serves them. Before, saving an unpublished item without validation could remove them.
API changes
MediaRevisionFileManagerInterface::unpublishOriginalFile()now returnsboolinstead ofvoid.- New methods on
MediaRevisionFileManagerInterface:isFileReferenceField(),getMediaIdsReferencingFile(),hasNewerRevisionReferencingFile()andcopySharedFile(). Custom implementations or decorators of this interface must add them. - The statistics array that
MediaRevisionInitializerInterfacereturns has a newcopiedkey.