diff --git a/core/includes/file.inc b/core/includes/file.inc index f18cbf886f1e0146f426ddead5eec864f8f8e963..0740c82d1d227a8c336f923dc3432937d5e1c314 100644 --- a/core/includes/file.inc +++ b/core/includes/file.inc @@ -89,49 +89,6 @@ */ const FILE_STATUS_PERMANENT = 1; -/** - * Provides Drupal stream wrapper registry. - * - * @param int $filter - * (Optional) Filters out all types except those with an on bit for each on - * bit in $filter. For example, if $filter is - * StreamWrapperInterface::WRITE_VISIBLE, which is equal to - * (StreamWrapperInterface::READ | StreamWrapperInterface::WRITE | - * StreamWrapperInterface::VISIBLE), then only stream wrappers with all three - * of these bits set are returned. Defaults to StreamWrapperInterface::ALL, - * which returns all registered stream wrappers. - * - * @return array - * An array keyed by scheme, with values containing an array of information - * about the stream wrapper, as returned by hook_stream_wrappers(). If $filter - * is omitted or set to StreamWrapperInterface::ALL, the entire Drupal stream - * wrapper registry is returned. Otherwise only the stream wrappers whose - * 'type' bitmask has an on bit for each bit specified in $filter are - * returned. - * - * @deprecated in Drupal 8.x-dev, will be removed before Drupal 8.0. - * Use \Drupal::service('stream_wrapper_manager')->getWrappers(). - */ -function file_get_stream_wrappers($filter = StreamWrapperInterface::ALL) { - return \Drupal::service('stream_wrapper_manager')->getWrappers($filter); -} - -/** - * Returns the stream wrapper class name for a given scheme. - * - * @param string $scheme - * Stream scheme. - * - * @return string|bool - * Return string if a scheme has a registered handler, or FALSE. - * - * @deprecated in Drupal 8.x-dev, will be removed before Drupal 8.0. - * Use \Drupal::service('stream_wrapper_manager')->getClass(). - */ -function file_stream_wrapper_get_class($scheme) { - return \Drupal::service('stream_wrapper_manager')->getClass($scheme); -} - /** * Returns the scheme of a URI (e.g. a stream). * @@ -214,55 +171,6 @@ function file_stream_wrapper_uri_normalize($uri) { return $uri; } -/** - * Returns a reference to the stream wrapper class responsible for a given URI. - * - * The scheme determines the stream wrapper class that should be - * used by consulting the stream wrapper registry. - * - * @param string $uri - * A stream, referenced as "scheme://target". - * - * @return \Drupal\Core\StreamWrapper\StreamWrapperInterface|bool - * Returns a new stream wrapper object appropriate for the given URI or FALSE - * if no registered handler could be found. For example, a URI of - * "private://example.txt" would return a new private stream wrapper object - * (Drupal\Core\StreamWrapper\PrivateStream). - * - * @deprecated in Drupal 8.x-dev, will be removed before Drupal 8.0. - * Use \Drupal::service('stream_wrapper_manager')->getViaUri(). - */ -function file_stream_wrapper_get_instance_by_uri($uri) { - return \Drupal::service('stream_wrapper_manager')->getViaUri($uri); -} - -/** - * Returns a reference to the stream wrapper class responsible for a scheme. - * - * This helper method returns a stream instance using a scheme. That is, the - * passed string does not contain a "://". For example, "public" is a scheme - * but "public://" is a URI (stream). This is because the later contains both - * a scheme and target despite target being empty. - * - * Note: the instance URI will be initialized to "scheme://" so that you can - * make the customary method calls as if you had retrieved an instance by URI. - * - * @param string $scheme - * If the stream was "public://target", "public" would be the scheme. - * - * @return \Drupal\Core\StreamWrapper\StreamWrapperInterface|bool - * Returns a new stream wrapper object appropriate for the given $scheme. - * For example, for the public scheme a stream wrapper object - * (Drupal\Core\StreamWrapper\PublicStream). - * FALSE is returned if no registered handler could be found. - * - * @deprecated in Drupal 8.x-dev, will be removed before Drupal 8.0. - * Use \Drupal::service('stream_wrapper_manager')->getViaScheme(). - */ -function file_stream_wrapper_get_instance_by_scheme($scheme) { - return \Drupal::service('stream_wrapper_manager')->getViaScheme($scheme); -} - /** * Creates a web-accessible URL for a stream to an external or local file. * diff --git a/core/lib/Drupal/Core/StreamWrapper/StreamWrapperManagerInterface.php b/core/lib/Drupal/Core/StreamWrapper/StreamWrapperManagerInterface.php index 086e34ed70dcd32e7c5b6702a599cb06a60d99cf..238b968259773b6b54a382ba7d9ce3b9f6ab6089 100644 --- a/core/lib/Drupal/Core/StreamWrapper/StreamWrapperManagerInterface.php +++ b/core/lib/Drupal/Core/StreamWrapper/StreamWrapperManagerInterface.php @@ -113,35 +113,52 @@ public function getNames($filter = StreamWrapperInterface::ALL); public function getDescriptions($filter = StreamWrapperInterface::ALL); /** - * Returns a stream wrapper via scheme. + * Returns a reference to the stream wrapper class responsible for a scheme. + * + * This helper method returns a stream instance using a scheme. That is, the + * passed string does not contain a "://". For example, "public" is a scheme + * but "public://" is a URI (stream). This is because the later contains both + * a scheme and target despite target being empty. + * + * Note: the instance URI will be initialized to "scheme://" so that you can + * make the customary method calls as if you had retrieved an instance by URI. * * @param string $scheme - * The scheme of the stream wrapper. + * If the stream was "public://target", "public" would be the scheme. * * @return \Drupal\Core\StreamWrapper\StreamWrapperInterface|bool - * A stream wrapper object, or false if the scheme is not available. + * Returns a new stream wrapper object appropriate for the given $scheme. + * For example, for the public scheme a stream wrapper object + * (Drupal\Core\StreamWrapper\PublicStream). + * FALSE is returned if no registered handler could be found. */ public function getViaScheme($scheme); /** - * Returns a stream wrapper via URI. + * Returns a reference to the stream wrapper class responsible for a URI. + * + * The scheme determines the stream wrapper class that should be + * used by consulting the stream wrapper registry. * * @param string $uri - * The URI of the stream wrapper. + * A stream, referenced as "scheme://target". * * @return \Drupal\Core\StreamWrapper\StreamWrapperInterface|bool - * A stream wrapper object, or false if the scheme is not available. + * Returns a new stream wrapper object appropriate for the given URI or + * FALSE if no registered handler could be found. For example, a URI of + * "private://example.txt" would return a new private stream wrapper object + * (Drupal\Core\StreamWrapper\PrivateStream). */ public function getViaUri($uri); /** - * Returns the stream wrapper class. + * Returns the stream wrapper class name for a given scheme. * * @param string $scheme - * The stream wrapper scheme. + * Stream scheme. * * @return string|bool - * The stream wrapper class, or false if the scheme does not exist. + * Return string if a scheme has a registered handler, or FALSE. */ public function getClass($scheme);