Install

Works with Drupal: ^11.2

Using 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:initialize finds 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 the media_revision log 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 MediaFileUniqueUsage constraint 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 returns bool instead of void.
  • New methods on MediaRevisionFileManagerInterface: isFileReferenceField(), getMediaIdsReferencingFile(), hasNewerRevisionReferencingFile() and copySharedFile(). Custom implementations or decorators of this interface must add them.
  • The statistics array that MediaRevisionInitializerInterface returns has a new copied key.
Created by: plach
Created on: 23 Oct 2026 at 08:20 UTC
Last updated: 23 Oct 2026 at 08:20 UTC
Bug fixes

Other releases