diff --git a/core/modules/system/src/Form/ThemeSettingsForm.php b/core/modules/system/src/Form/ThemeSettingsForm.php index 61a73b6..a8ea172 100644 --- a/core/modules/system/src/Form/ThemeSettingsForm.php +++ b/core/modules/system/src/Form/ThemeSettingsForm.php @@ -12,7 +12,6 @@ use Drupal\Core\Config\ConfigFactoryInterface; use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\Core\Form\ConfigFormBase; -use Drupal\Core\File\FileSystemInterface; use Drupal\Core\Theme\ThemeManagerInterface; /** @@ -35,12 +34,6 @@ class ThemeSettingsForm extends ConfigFormBase { protected $themeHandler; /** - * File System instance. - * @var \Drupal\Core\File\FileSystemInterface - */ - protected $fileSystem; - - /** * The MIME type guesser. * * @var \Symfony\Component\HttpFoundation\File\MimeType\MimeTypeGuesserInterface @@ -72,17 +65,14 @@ class ThemeSettingsForm extends ConfigFormBase { * The theme handler. * @param \Symfony\Component\HttpFoundation\File\MimeType\MimeTypeGuesserInterface $mime_type_guesser * The MIME type guesser instance to use. - * @param \Drupal\Core\File\FileSystemInterface $file_system - * The FileSytem instance to use. */ - public function __construct(ConfigFactoryInterface $config_factory, ModuleHandlerInterface $module_handler, ThemeHandlerInterface $theme_handler, MimeTypeGuesserInterface $mime_type_guesser, ThemeManagerInterface $theme_manager, FileSystemInterface $file_system) { + public function __construct(ConfigFactoryInterface $config_factory, ModuleHandlerInterface $module_handler, ThemeHandlerInterface $theme_handler, MimeTypeGuesserInterface $mime_type_guesser, ThemeManagerInterface $theme_manager) { parent::__construct($config_factory); $this->moduleHandler = $module_handler; $this->themeHandler = $theme_handler; $this->mimeTypeGuesser = $mime_type_guesser; $this->themeManager = $theme_manager; - $this->fileSystem = $file_system; } /** @@ -94,8 +84,7 @@ public static function create(ContainerInterface $container) { $container->get('module_handler'), $container->get('theme_handler'), $container->get('file.mime_type.guesser'), - $container->get('theme.manager'), - $container->get('file_system') + $container->get('theme.manager') ); } @@ -491,7 +480,7 @@ public function submitForm(array &$form, FormStateInterface $form_state) { */ protected function validatePath($path) { // Absolute local file paths are invalid. - if ($this->fileSystem->realpath($path) == $path) { + if (\Drupal::service('file_system')->realpath($path)) { return FALSE; } // A path relative to the Drupal root or a fully qualified URI is valid. diff --git a/core/modules/system/src/Plugin/ImageToolkit/GDToolkit.php b/core/modules/system/src/Plugin/ImageToolkit/GDToolkit.php index bf84019..64e2a45 100644 --- a/core/modules/system/src/Plugin/ImageToolkit/GDToolkit.php +++ b/core/modules/system/src/Plugin/ImageToolkit/GDToolkit.php @@ -5,7 +5,6 @@ use Drupal\Component\Utility\Color; use Drupal\Component\Utility\Unicode; use Drupal\Core\Config\ConfigFactoryInterface; -use Drupal\Core\File\FileSystemInterface; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\ImageToolkit\ImageToolkitBase; use Drupal\Core\ImageToolkit\ImageToolkitOperationManagerInterface; @@ -61,13 +60,6 @@ class GDToolkit extends ImageToolkitBase { protected $streamWrapperManager; /** - * File System instance. - * - * @var \Drupal\Core\File\FileSystemInterface - */ - protected $fileSystem; - - /** * Constructs a GDToolkit object. * * @param array $configuration @@ -84,13 +76,10 @@ class GDToolkit extends ImageToolkitBase { * The config factory. * @param \Drupal\Core\StreamWrapper\StreamWrapperManagerInterface $stream_wrapper_manager * The StreamWrapper manager. - * @param \Drupal\Core\File\FileSystemInterface $file_system - * The FileSytem instance to use. */ - public function __construct(array $configuration, $plugin_id, array $plugin_definition, ImageToolkitOperationManagerInterface $operation_manager, LoggerInterface $logger, ConfigFactoryInterface $config_factory, StreamWrapperManagerInterface $stream_wrapper_manager, FileSystemInterface $file_system) { + public function __construct(array $configuration, $plugin_id, array $plugin_definition, ImageToolkitOperationManagerInterface $operation_manager, LoggerInterface $logger, ConfigFactoryInterface $config_factory, StreamWrapperManagerInterface $stream_wrapper_manager) { parent::__construct($configuration, $plugin_id, $plugin_definition, $operation_manager, $logger, $config_factory); $this->streamWrapperManager = $stream_wrapper_manager; - $this->fileSystem = $file_system; } /** @@ -115,8 +104,7 @@ public static function create(ContainerInterface $container, array $configuratio $container->get('image.toolkit.operation.manager'), $container->get('logger.channel.image'), $container->get('config.factory'), - $container->get('stream_wrapper_manager'), - $container->get('file_system') + $container->get('stream_wrapper_manager') ); } @@ -236,7 +224,7 @@ public function save($destination) { $destination = drupal_tempnam('temporary://', 'gd_'); } // Convert stream wrapper URI to normal path. - $destination = $this->fileSystem->realpath($destination); + $destination = \Drupal::service('file_system')->realpath($destination); } $function = 'image' . image_type_to_extension($this->getType(), FALSE); diff --git a/core/modules/update/src/Form/UpdateReady.php b/core/modules/update/src/Form/UpdateReady.php index 93de7ad..d298b60 100644 --- a/core/modules/update/src/Form/UpdateReady.php +++ b/core/modules/update/src/Form/UpdateReady.php @@ -3,7 +3,6 @@ namespace Drupal\update\Form; use Drupal\Core\Extension\ModuleHandlerInterface; -use Drupal\Core\File\FileSystemInterface; use Drupal\Core\FileTransfer\Local; use Drupal\Core\Form\FormBase; use Drupal\Core\Form\FormStateInterface; @@ -46,13 +45,6 @@ class UpdateReady extends FormBase { protected $sitePath; /** - * File System instance. - * - * @var \Drupal\Core\File\FileSystemInterface - */ - protected $fileSystem; - - /** * Constructs a new UpdateReady object. * * @param string $root @@ -63,15 +55,12 @@ class UpdateReady extends FormBase { * The state key value store. * @param string $site_path * The site path. - * @param \Drupal\Core\File\FileSystemInterface $file_system - * The FileSytem instance to use. */ - public function __construct($root, ModuleHandlerInterface $module_handler, StateInterface $state, $site_path, FileSystemInterface $file_system) { + public function __construct($root, ModuleHandlerInterface $module_handler, StateInterface $state, $site_path) { $this->root = $root; $this->moduleHandler = $module_handler; $this->state = $state; $this->sitePath = $site_path; - $this->fileSystem = $file_system; } /** @@ -89,8 +78,7 @@ public static function create(ContainerInterface $container) { $container->get('update.root'), $container->get('module_handler'), $container->get('state'), - $container->get('site.path'), - $container->get('file_system') + $container->get('site.path') ); } @@ -148,7 +136,7 @@ public function submitForm(array &$form, FormStateInterface $form_state) { foreach ($projects as $project => $url) { $project_location = $directory . '/' . $project; $updater = Updater::factory($project_location, $this->root); - $project_real_location = $this->fileSystem->realpath($project_location); + $project_real_location = \Drupal::service('file_system')->realpath($project_location); $updates[] = array( 'project' => $project, 'updater_name' => get_class($updater),