Loading core/modules/file/file.services.yml +3 −8 Original line number Diff line number Diff line Loading @@ -4,40 +4,35 @@ parameters: services: _defaults: autoconfigure: true autowire: true file.event.subscriber: class: Drupal\file\EventSubscriber\FileEventSubscriber arguments: ['@config.factory', '@transliteration', '@language_manager'] file.usage: class: Drupal\file\FileUsage\DatabaseFileUsageBackend arguments: ['@config.factory', '@database', 'file_usage'] tags: - { name: backend_overridable } Drupal\file\FileUsage\FileUsageInterface: '@file.usage' file.upload_handler: class: Drupal\file\Upload\FileUploadHandler arguments: ['@file_system', '@entity_type.manager', '@stream_wrapper_manager', '@event_dispatcher', '@file.mime_type.guesser', '@current_user', '@request_stack', '@file.repository', '@file.validator', '@lock', '@validation.basic_recursive_validator_factory'] Drupal\file\Upload\FileUploadHandler: alias: 'file.upload_handler' deprecated: 'The "%alias_id%" service alias is deprecated in drupal:11.2.0 and is removed from drupal:12.0.0. Use Drupal\file\Upload\FileUploadHandlerInterface instead.' Drupal\file\Upload\FileUploadHandlerInterface: '@file.upload_handler' file.repository: class: Drupal\file\FileRepository arguments: [ '@file_system', '@stream_wrapper_manager', '@entity_type.manager', '@module_handler', '@file.usage', '@current_user' ] Drupal\file\FileRepositoryInterface: '@file.repository' file.recursive_validator_factory: class: Drupal\file\Validation\RecursiveValidatorFactory arguments: ['@class_resolver', '@typed_data_manager'] Drupal\file\Validation\RecursiveValidatorFactory: '@file.recursive_validator_factory' file.recursive_validator: class: Symfony\Component\Validator\Validator\ValidatorInterface factory: [ '@file.recursive_validator_factory', 'createValidator' ] file.validator: class: Drupal\file\Validation\FileValidator arguments: ['@file.recursive_validator', '@validation.constraint', '@event_dispatcher', '@module_handler'] Drupal\file\Validation\FileValidatorInterface: '@file.validator' file.input_stream_file_writer: class: Drupal\file\Upload\InputStreamFileWriter arguments: ['@file_system'] Drupal\file\Upload\InputStreamFileWriterInterface: '@file.input_stream_file_writer' Drupal\file\EventSubscriber\DefaultContentSubscriber: calls: Loading core/modules/file/src/EventSubscriber/FileEventSubscriber.php +2 −0 Original line number Diff line number Diff line Loading @@ -7,6 +7,7 @@ use Drupal\Core\Language\LanguageInterface; use Drupal\Core\Language\LanguageManagerInterface; use Drupal\Core\File\Event\FileUploadSanitizeNameEvent; use Symfony\Component\DependencyInjection\Attribute\Autowire; use Symfony\Component\EventDispatcher\EventSubscriberInterface; /** Loading @@ -28,6 +29,7 @@ class FileEventSubscriber implements EventSubscriberInterface { */ public function __construct( protected ConfigFactoryInterface $configFactory, #[Autowire(service: 'transliteration')] protected TransliterationInterface $transliteration, protected LanguageManagerInterface $languageManager, ) {} Loading core/modules/file/src/FileRepository.php +8 −65 Original line number Diff line number Diff line Loading @@ -17,71 +17,14 @@ */ class FileRepository implements FileRepositoryInterface { /** * The file system service. * * @var \Drupal\Core\File\FileSystemInterface */ protected $fileSystem; /** * The stream wrapper manager. * * @var \Drupal\Core\StreamWrapper\StreamWrapperManagerInterface */ protected $streamWrapperManager; /** * The entity type manager. * * @var \Drupal\Core\Entity\EntityTypeManagerInterface */ protected $entityTypeManager; /** * The module handler. * * @var \Drupal\Core\Extension\ModuleHandlerInterface */ protected $moduleHandler; /** * The file usage service. * * @var \Drupal\file\FileUsage\FileUsageInterface */ protected $fileUsage; /** * The current user. * * @var \Drupal\Core\Session\AccountInterface */ protected $currentUser; /** * FileRepository constructor. * * @param \Drupal\Core\File\FileSystemInterface $fileSystem * The file system. * @param \Drupal\Core\StreamWrapper\StreamWrapperManagerInterface $streamWrapperManager * The stream wrapper manager. * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entityTypeManager * The entity type manager. * @param \Drupal\Core\Extension\ModuleHandlerInterface $moduleHandler * The module handler. * @param \Drupal\file\FileUsage\FileUsageInterface $fileUsage * The file usage service. * @param \Drupal\Core\Session\AccountInterface $currentUser * The current user. */ public function __construct(FileSystemInterface $fileSystem, StreamWrapperManagerInterface $streamWrapperManager, EntityTypeManagerInterface $entityTypeManager, ModuleHandlerInterface $moduleHandler, FileUsageInterface $fileUsage, AccountInterface $currentUser) { $this->fileSystem = $fileSystem; $this->streamWrapperManager = $streamWrapperManager; $this->entityTypeManager = $entityTypeManager; $this->moduleHandler = $moduleHandler; $this->fileUsage = $fileUsage; $this->currentUser = $currentUser; public function __construct( protected FileSystemInterface $fileSystem, protected StreamWrapperManagerInterface $streamWrapperManager, protected EntityTypeManagerInterface $entityTypeManager, protected ModuleHandlerInterface $moduleHandler, protected FileUsageInterface $fileUsage, protected AccountInterface $currentUser, ) { } /** Loading core/modules/file/src/Upload/FileUploadHandler.php +13 −66 Original line number Diff line number Diff line Loading @@ -18,7 +18,8 @@ use Drupal\file\Entity\File; use Drupal\file\FileRepositoryInterface; use Drupal\file\Validation\FileValidatorInterface; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\DependencyInjection\Attribute\Autowire; use Symfony\Contracts\EventDispatcher\EventDispatcherInterface; use Symfony\Component\HttpFoundation\RequestStack; use Symfony\Component\Mime\MimeTypeGuesserInterface; Loading @@ -32,62 +33,6 @@ class FileUploadHandler implements FileUploadHandlerInterface { */ const DEFAULT_EXTENSIONS = 'jpg jpeg gif png txt doc xls pdf ppt pps odt ods odp'; /** * The file system service. * * @var \Drupal\Core\File\FileSystemInterface */ protected $fileSystem; /** * The entity type manager. * * @var \Drupal\Core\Entity\EntityTypeManagerInterface */ protected $entityTypeManager; /** * The stream wrapper manager. * * @var \Drupal\Core\StreamWrapper\StreamWrapperManagerInterface */ protected $streamWrapperManager; /** * The event dispatcher. * * @var \Symfony\Component\EventDispatcher\EventDispatcherInterface */ protected $eventDispatcher; /** * The current user. * * @var \Drupal\Core\Session\AccountInterface */ protected $currentUser; /** * The MIME type guesser. * * @var \Symfony\Component\Mime\MimeTypeGuesserInterface */ protected $mimeTypeGuesser; /** * The request stack. * * @var \Symfony\Component\HttpFoundation\RequestStack */ protected $requestStack; /** * The file Repository. * * @var \Drupal\file\FileRepositoryInterface */ protected $fileRepository; /** * The file validator. * Loading @@ -96,15 +41,17 @@ class FileUploadHandler implements FileUploadHandlerInterface { protected FileValidatorInterface $fileValidator; public function __construct( FileSystemInterface $fileSystem, EntityTypeManagerInterface $entityTypeManager, StreamWrapperManagerInterface $streamWrapperManager, EventDispatcherInterface $eventDispatcher, MimeTypeGuesserInterface $mimeTypeGuesser, AccountInterface $currentUser, RequestStack $requestStack, FileRepositoryInterface $fileRepository, FileValidatorInterface $file_validator, protected FileSystemInterface $fileSystem, protected EntityTypeManagerInterface $entityTypeManager, protected StreamWrapperManagerInterface $streamWrapperManager, protected EventDispatcherInterface $eventDispatcher, #[Autowire(service: 'file.mime_type.guesser')] protected MimeTypeGuesserInterface $mimeTypeGuesser, protected AccountInterface $currentUser, protected RequestStack $requestStack, protected FileRepositoryInterface $fileRepository, protected FileValidatorInterface $file_validator, #[Autowire(service: 'lock')] protected LockBackendInterface $lock, protected BasicRecursiveValidatorFactory $validatorFactory, ) { Loading core/modules/file/src/Validation/FileValidator.php +3 −0 Original line number Diff line number Diff line Loading @@ -5,6 +5,7 @@ use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\Core\Validation\ConstraintManager; use Drupal\file\FileInterface; use Symfony\Component\DependencyInjection\Attribute\Autowire; use Symfony\Component\Validator\ConstraintViolationListInterface; use Symfony\Component\Validator\Validator\ValidatorInterface; use Symfony\Contracts\EventDispatcher\EventDispatcherInterface; Loading @@ -27,7 +28,9 @@ class FileValidator implements FileValidatorInterface { * The module handler. */ public function __construct( #[Autowire(service: 'file.recursive_validator')] protected ValidatorInterface $validator, #[Autowire(service: 'validation.constraint')] protected ConstraintManager $constraintManager, protected EventDispatcherInterface $eventDispatcher, protected ModuleHandlerInterface $moduleHandler, Loading Loading
core/modules/file/file.services.yml +3 −8 Original line number Diff line number Diff line Loading @@ -4,40 +4,35 @@ parameters: services: _defaults: autoconfigure: true autowire: true file.event.subscriber: class: Drupal\file\EventSubscriber\FileEventSubscriber arguments: ['@config.factory', '@transliteration', '@language_manager'] file.usage: class: Drupal\file\FileUsage\DatabaseFileUsageBackend arguments: ['@config.factory', '@database', 'file_usage'] tags: - { name: backend_overridable } Drupal\file\FileUsage\FileUsageInterface: '@file.usage' file.upload_handler: class: Drupal\file\Upload\FileUploadHandler arguments: ['@file_system', '@entity_type.manager', '@stream_wrapper_manager', '@event_dispatcher', '@file.mime_type.guesser', '@current_user', '@request_stack', '@file.repository', '@file.validator', '@lock', '@validation.basic_recursive_validator_factory'] Drupal\file\Upload\FileUploadHandler: alias: 'file.upload_handler' deprecated: 'The "%alias_id%" service alias is deprecated in drupal:11.2.0 and is removed from drupal:12.0.0. Use Drupal\file\Upload\FileUploadHandlerInterface instead.' Drupal\file\Upload\FileUploadHandlerInterface: '@file.upload_handler' file.repository: class: Drupal\file\FileRepository arguments: [ '@file_system', '@stream_wrapper_manager', '@entity_type.manager', '@module_handler', '@file.usage', '@current_user' ] Drupal\file\FileRepositoryInterface: '@file.repository' file.recursive_validator_factory: class: Drupal\file\Validation\RecursiveValidatorFactory arguments: ['@class_resolver', '@typed_data_manager'] Drupal\file\Validation\RecursiveValidatorFactory: '@file.recursive_validator_factory' file.recursive_validator: class: Symfony\Component\Validator\Validator\ValidatorInterface factory: [ '@file.recursive_validator_factory', 'createValidator' ] file.validator: class: Drupal\file\Validation\FileValidator arguments: ['@file.recursive_validator', '@validation.constraint', '@event_dispatcher', '@module_handler'] Drupal\file\Validation\FileValidatorInterface: '@file.validator' file.input_stream_file_writer: class: Drupal\file\Upload\InputStreamFileWriter arguments: ['@file_system'] Drupal\file\Upload\InputStreamFileWriterInterface: '@file.input_stream_file_writer' Drupal\file\EventSubscriber\DefaultContentSubscriber: calls: Loading
core/modules/file/src/EventSubscriber/FileEventSubscriber.php +2 −0 Original line number Diff line number Diff line Loading @@ -7,6 +7,7 @@ use Drupal\Core\Language\LanguageInterface; use Drupal\Core\Language\LanguageManagerInterface; use Drupal\Core\File\Event\FileUploadSanitizeNameEvent; use Symfony\Component\DependencyInjection\Attribute\Autowire; use Symfony\Component\EventDispatcher\EventSubscriberInterface; /** Loading @@ -28,6 +29,7 @@ class FileEventSubscriber implements EventSubscriberInterface { */ public function __construct( protected ConfigFactoryInterface $configFactory, #[Autowire(service: 'transliteration')] protected TransliterationInterface $transliteration, protected LanguageManagerInterface $languageManager, ) {} Loading
core/modules/file/src/FileRepository.php +8 −65 Original line number Diff line number Diff line Loading @@ -17,71 +17,14 @@ */ class FileRepository implements FileRepositoryInterface { /** * The file system service. * * @var \Drupal\Core\File\FileSystemInterface */ protected $fileSystem; /** * The stream wrapper manager. * * @var \Drupal\Core\StreamWrapper\StreamWrapperManagerInterface */ protected $streamWrapperManager; /** * The entity type manager. * * @var \Drupal\Core\Entity\EntityTypeManagerInterface */ protected $entityTypeManager; /** * The module handler. * * @var \Drupal\Core\Extension\ModuleHandlerInterface */ protected $moduleHandler; /** * The file usage service. * * @var \Drupal\file\FileUsage\FileUsageInterface */ protected $fileUsage; /** * The current user. * * @var \Drupal\Core\Session\AccountInterface */ protected $currentUser; /** * FileRepository constructor. * * @param \Drupal\Core\File\FileSystemInterface $fileSystem * The file system. * @param \Drupal\Core\StreamWrapper\StreamWrapperManagerInterface $streamWrapperManager * The stream wrapper manager. * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entityTypeManager * The entity type manager. * @param \Drupal\Core\Extension\ModuleHandlerInterface $moduleHandler * The module handler. * @param \Drupal\file\FileUsage\FileUsageInterface $fileUsage * The file usage service. * @param \Drupal\Core\Session\AccountInterface $currentUser * The current user. */ public function __construct(FileSystemInterface $fileSystem, StreamWrapperManagerInterface $streamWrapperManager, EntityTypeManagerInterface $entityTypeManager, ModuleHandlerInterface $moduleHandler, FileUsageInterface $fileUsage, AccountInterface $currentUser) { $this->fileSystem = $fileSystem; $this->streamWrapperManager = $streamWrapperManager; $this->entityTypeManager = $entityTypeManager; $this->moduleHandler = $moduleHandler; $this->fileUsage = $fileUsage; $this->currentUser = $currentUser; public function __construct( protected FileSystemInterface $fileSystem, protected StreamWrapperManagerInterface $streamWrapperManager, protected EntityTypeManagerInterface $entityTypeManager, protected ModuleHandlerInterface $moduleHandler, protected FileUsageInterface $fileUsage, protected AccountInterface $currentUser, ) { } /** Loading
core/modules/file/src/Upload/FileUploadHandler.php +13 −66 Original line number Diff line number Diff line Loading @@ -18,7 +18,8 @@ use Drupal\file\Entity\File; use Drupal\file\FileRepositoryInterface; use Drupal\file\Validation\FileValidatorInterface; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\DependencyInjection\Attribute\Autowire; use Symfony\Contracts\EventDispatcher\EventDispatcherInterface; use Symfony\Component\HttpFoundation\RequestStack; use Symfony\Component\Mime\MimeTypeGuesserInterface; Loading @@ -32,62 +33,6 @@ class FileUploadHandler implements FileUploadHandlerInterface { */ const DEFAULT_EXTENSIONS = 'jpg jpeg gif png txt doc xls pdf ppt pps odt ods odp'; /** * The file system service. * * @var \Drupal\Core\File\FileSystemInterface */ protected $fileSystem; /** * The entity type manager. * * @var \Drupal\Core\Entity\EntityTypeManagerInterface */ protected $entityTypeManager; /** * The stream wrapper manager. * * @var \Drupal\Core\StreamWrapper\StreamWrapperManagerInterface */ protected $streamWrapperManager; /** * The event dispatcher. * * @var \Symfony\Component\EventDispatcher\EventDispatcherInterface */ protected $eventDispatcher; /** * The current user. * * @var \Drupal\Core\Session\AccountInterface */ protected $currentUser; /** * The MIME type guesser. * * @var \Symfony\Component\Mime\MimeTypeGuesserInterface */ protected $mimeTypeGuesser; /** * The request stack. * * @var \Symfony\Component\HttpFoundation\RequestStack */ protected $requestStack; /** * The file Repository. * * @var \Drupal\file\FileRepositoryInterface */ protected $fileRepository; /** * The file validator. * Loading @@ -96,15 +41,17 @@ class FileUploadHandler implements FileUploadHandlerInterface { protected FileValidatorInterface $fileValidator; public function __construct( FileSystemInterface $fileSystem, EntityTypeManagerInterface $entityTypeManager, StreamWrapperManagerInterface $streamWrapperManager, EventDispatcherInterface $eventDispatcher, MimeTypeGuesserInterface $mimeTypeGuesser, AccountInterface $currentUser, RequestStack $requestStack, FileRepositoryInterface $fileRepository, FileValidatorInterface $file_validator, protected FileSystemInterface $fileSystem, protected EntityTypeManagerInterface $entityTypeManager, protected StreamWrapperManagerInterface $streamWrapperManager, protected EventDispatcherInterface $eventDispatcher, #[Autowire(service: 'file.mime_type.guesser')] protected MimeTypeGuesserInterface $mimeTypeGuesser, protected AccountInterface $currentUser, protected RequestStack $requestStack, protected FileRepositoryInterface $fileRepository, protected FileValidatorInterface $file_validator, #[Autowire(service: 'lock')] protected LockBackendInterface $lock, protected BasicRecursiveValidatorFactory $validatorFactory, ) { Loading
core/modules/file/src/Validation/FileValidator.php +3 −0 Original line number Diff line number Diff line Loading @@ -5,6 +5,7 @@ use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\Core\Validation\ConstraintManager; use Drupal\file\FileInterface; use Symfony\Component\DependencyInjection\Attribute\Autowire; use Symfony\Component\Validator\ConstraintViolationListInterface; use Symfony\Component\Validator\Validator\ValidatorInterface; use Symfony\Contracts\EventDispatcher\EventDispatcherInterface; Loading @@ -27,7 +28,9 @@ class FileValidator implements FileValidatorInterface { * The module handler. */ public function __construct( #[Autowire(service: 'file.recursive_validator')] protected ValidatorInterface $validator, #[Autowire(service: 'validation.constraint')] protected ConstraintManager $constraintManager, protected EventDispatcherInterface $eventDispatcher, protected ModuleHandlerInterface $moduleHandler, Loading