Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 297781

StreamWrapperManager Service has public methods not on interface.

$
0
0

Problem/Motivation

Currently StreamWrapperManager has addStreamWrapper, register() and unregister() documented as

   *
   * Internal use only.
   *

without the @internal flag.

These functions are necessary for Core to bootstrap however they are generally not necessary for most modules likely justifying them generally being considered internal.

However since the StreamWrapperManager is a Drupal Service it is possible to decorate with a Service Decorator. Any module wanting to decorate the StreamWrapperManager must implement these methods or core will be unable to function.

Possible reasons to Decorate the StreamWrapperManager service that I have seen are:

  • Registering a StreamWrapper for use as a supported stream for use in Managed Files but not overriding the protocol in PHP (http/https in Remote Stream Wrapper as an example)
  • Adding StreamWrappers when schemes are not known during the Compiler Pass as they require data from Config Entities (being implemented in S3FS)

With these functions not on the interface they appear (by policy) to be subject to change in minor point releases without any deprecation window making decorating the service appear 'risky'.

Steps to reproduce

See core/lib/Drupal/Core/StreamWrapper/StreamWrapperManager.php

Proposed resolution

Add addStreamWrapper, register(), unregister() to a new interface.
Document they are generally not to be called and are on interface solely for Drupal Core and Service Decorators.

Remaining tasks

User interface changes

None

API changes

New interface created for existing methods.

Data model changes

None Expected.

Release notes snippet

TBD


Viewing all articles
Browse latest Browse all 297781

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>