SophronMimeTypeMapFactory should just override MimeTypeMapFactory::doCreateMap()

Created on 16 April 2025, 4 days ago

Problem/Motivation

SophronMimeTypeMapFactory extends MimeTypeMapFactory and overrides the ::create() method. However, this could be changed upstream and changes would need to be duplicated.

Instead it should override the \Drupal\Core\File\MimeType\MimeTypeMapFactory::doCreateMap() method.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

๐Ÿ“Œ Task
Status

Active

Version

3.0

Component

Code

Created by

๐Ÿ‡ฆ๐Ÿ‡บAustralia kim.pepper ๐Ÿ„โ€โ™‚๏ธ๐Ÿ‡ฆ๐Ÿ‡บSydney, Australia

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @kim.pepper
  • First commit to issue fork.
  • Merge request !32Closes #3519605 โ†’ (Open) created by mondrake
  • ๐Ÿ‡ฎ๐Ÿ‡นItaly mondrake ๐Ÿ‡ฎ๐Ÿ‡น

    Good point, thanks @kim.pepper

  • ๐Ÿ‡ฎ๐Ÿ‡นItaly mondrake ๐Ÿ‡ฎ๐Ÿ‡น

    I think we should add a test to check if DummyMimeTypeMapLoadedSubscriber has an effect on the mapping. The legacy hook was already not processed by Sophron, but now that we have methods we should be able to process the event. This event will trigger 'core' changes, while the Sophron's initializeMap will be specific to Sophron.

    In essence, the sequence should be:
    a) the Sophron map is initialized in the Drupal\sophron\MimeMapManagerInterface service, initializeMap event is triggered and will process map changes according to fileeye/mimemap primitives;
    b) core triggers the MimeTypeMapLoadedEvent event in MimeTypeMapFactory and will process map changes according to MimeTypeMap primitives (that are proxies to the fileeye/mimemap ones via Sophron's MimeMapManager.

    A bit complicated but this would allow keeping Sophron as a separate MIME type mapping service not used for guessing purposes.

  • ๐Ÿ‡ฎ๐Ÿ‡นItaly mondrake ๐Ÿ‡ฎ๐Ÿ‡น
Production build 0.71.5 2024