diff --git a/core/core.services.yml b/core/core.services.yml index 5e090011e9acf8691b46e7a4f23a82fe34f96797..a4fcc5391186ea6ea0db832ce7a732502f5ecacc 100644 --- a/core/core.services.yml +++ b/core/core.services.yml @@ -886,7 +886,6 @@ services: parent: default_plugin_manager stream_wrapper_manager: class: Drupal\Core\StreamWrapper\StreamWrapperManager - arguments: ['@module_handler'] calls: - [setContainer, ['@service_container']] stream_wrapper.public: diff --git a/core/includes/file.inc b/core/includes/file.inc index c5e2673f41c2fc231a2ed1c9833a9fb4ae09854c..3472e24a3d9d5c6c374e25d1383987ab73267cd0 100644 --- a/core/includes/file.inc +++ b/core/includes/file.inc @@ -103,8 +103,6 @@ * 'type' bitmask has an on bit for each bit specified in $filter are * returned. * - * @see hook_stream_wrappers_alter() - * * @deprecated in Drupal 8.x-dev, will be removed before Drupal 8.0. * Use \Drupal::service('stream_wrapper_manager')->getWrappers(). */ diff --git a/core/lib/Drupal/Core/StreamWrapper/StreamWrapperManager.php b/core/lib/Drupal/Core/StreamWrapper/StreamWrapperManager.php index 43532a0299ded8216ab62f92aceee7eecd582ef1..101980d4055b4f7e208bcccda9e7566b338864d3 100644 --- a/core/lib/Drupal/Core/StreamWrapper/StreamWrapperManager.php +++ b/core/lib/Drupal/Core/StreamWrapper/StreamWrapperManager.php @@ -14,8 +14,6 @@ * Provides a StreamWrapper manager. * * @see file_get_stream_wrappers() - * @see hook_stream_wrappers_alter() - * @see system_stream_wrappers() * @see \Drupal\Core\StreamWrapper\StreamWrapperInterface */ class StreamWrapperManager extends ContainerAware { @@ -49,23 +47,6 @@ class StreamWrapperManager extends ContainerAware { */ protected $wrappers = array(); - /** - * The module handler. - * - * @var \Drupal\Core\Extension\ModuleHandlerInterface - */ - protected $moduleHandler; - - /** - * Constructs a StreamWrapperManager object. - * - * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler - * The module handler. - */ - public function __construct(ModuleHandlerInterface $module_handler) { - $this->moduleHandler = $module_handler; - } - /** * Provides Drupal stream wrapper registry. * @@ -279,8 +260,6 @@ public function addStreamWrapper($service_id, $class, $scheme) { * Internal use only. */ public function register() { - $this->moduleHandler->alter('stream_wrappers', $this->info); - foreach ($this->info as $scheme => $info) { $this->registerWrapper($scheme, $info['class'], $info['type']); } diff --git a/core/modules/system/file.api.php b/core/modules/system/file.api.php index 65a6051a3e491aa80978dee815fce52d2c0d2e88..a4fd8e4c6106d905173e03c6f39257db31527877 100644 --- a/core/modules/system/file.api.php +++ b/core/modules/system/file.api.php @@ -10,17 +10,6 @@ * @{ */ -/** - * Alters the list of PHP stream wrapper implementations. - * - * @see file_get_stream_wrappers() - * @see \Drupal\Core\StreamWrapper\StreamWrapperManager - */ -function hook_stream_wrappers_alter(&$wrappers) { - // Change the name of private files to reflect the performance. - $wrappers['private']['name'] = t('Slow files'); -} - /** * Control access to private file downloads and specify HTTP headers. * diff --git a/core/modules/system/src/Form/FileSystemForm.php b/core/modules/system/src/Form/FileSystemForm.php index b5759f3d8e8b7938cbff97f5e4ee753d3fa6188a..8cf5eb38fdec8c3adf7904e8d7fab26740b3e41d 100644 --- a/core/modules/system/src/Form/FileSystemForm.php +++ b/core/modules/system/src/Form/FileSystemForm.php @@ -87,7 +87,7 @@ public function buildForm(array $form, FormStateInterface $form_state) { '#type' => 'item', '#title' => t('Private file system path'), '#markup' => (PrivateStream::basePath() ? PrivateStream::basePath() : t('Not set')), - '#description' => t('An existing local file system path for storing private files. It should be writable by Drupal and not accessible over the web. This must be changed in settings.php. See the online handbook for <a href="@handbook">more information about securing private files</a>.', array('@handbook' => 'http://drupal.org/documentation/modules/file')), + '#description' => t('An existing local file system path for storing private files. It should be writable by Drupal and not accessible over the web. This must be changed in settings.php'), ); $form['file_temporary_path'] = array( diff --git a/core/modules/system/src/Tests/File/ConfigTest.php b/core/modules/system/src/Tests/File/ConfigTest.php index 6a0bd6555d0a8c1cbbae41f43681dc60e6ae1fc6..4d3cf6f05d4ad836cd4f9187a6d9066c9c176605 100644 --- a/core/modules/system/src/Tests/File/ConfigTest.php +++ b/core/modules/system/src/Tests/File/ConfigTest.php @@ -37,15 +37,28 @@ function testFileConfigurationPage() { 'file_default_scheme' => 'private', ); - // Check that all fields are present. - foreach ($fields as $field => $path) { - $this->assertFieldByName($field); - } + // Check that public and private can be selected as default scheme. + $this->assertText('Public local files served by the webserver.'); + $this->assertText('Private local files served by Drupal.'); $this->drupalPostForm(NULL, $fields, t('Save configuration')); $this->assertText(t('The configuration options have been saved.')); foreach ($fields as $field => $value) { $this->assertFieldByName($field, $value); } + + // Remove the private path, rebuild the container and verify that private + // can no longer be selected in the UI. + $settings['settings']['file_private_path'] = (object) array( + 'value' => '', + 'required' => TRUE, + ); + $this->writeSettings($settings); + $this->rebuildContainer(); + + $this->drupalGet('admin/config/media/file-system'); + $this->assertText('Public local files served by the webserver.'); + $this->assertNoText('Private local files served by Drupal.'); } + } diff --git a/sites/default/default.settings.php b/sites/default/default.settings.php index 36385f762076c956157cc5c84478ed5a969f5b27..e21206b4d71535d0fa46d3bec19c98179585445f 100644 --- a/sites/default/default.settings.php +++ b/sites/default/default.settings.php @@ -437,6 +437,9 @@ * must be absolute, outside of the the Drupal installation directory and not * accessible over the web. * + * Note: Caches need to be cleared when this value is changed to make the + * private:// stream wrapper available to the system. + * * See http://drupal.org/documentation/modules/file for more information about * securing private files. */