Problem/Motivation
Both the MIME Type Guesser service and the single implementation in core are marked as lazy:
file.mime_type.guesser:
class: Drupal\Core\File\MimeType\MimeTypeGuesser
arguments: ['@stream_wrapper_manager']
tags:
- { name: service_collector, tag: mime_type_guesser, call: addMimeTypeGuesser }
lazy: true
file.mime_type.guesser.extension:
class: Drupal\Core\File\MimeType\ExtensionMimeTypeGuesser
arguments: ['@Drupal\Core\File\MimeType\MimeTypeMapInterface']
tags:
- { name: mime_type_guesser }
lazy: true
Neither of these services are expensive to instantiate; the stream wrapper manager will be initialised anyway, and injecting the mime_type_guesser services via a tagger iterator will mean that the individual guessers will only be instantiated when needed (and if a guesser returns early, the later ones will not be needed at all).
Steps to reproduce
Proposed resolution
Remaining tasks
User interface changes
Introduced terminology
API changes
Data model changes
Release notes snippet
Issue fork drupal-3579673
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #4
longwaveComment #5
smustgrave commentedDo these need to be deprecated?
Comment #6
longwaveI don't think anyone would be replacing these services directly, they would just add their own guesser, which works the same way as before.
Comment #7
smustgrave commentedFigured I’d ask. Okay to mark for you
Comment #11
catchCommitted/pushed to main and cherry-picked to 11.x, thanks!