Unverified Commit 617441c2 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #3112367 by Hardik_Patel_12, hash6, prabha1997, longwave,...

Issue #3112367 by Hardik_Patel_12, hash6, prabha1997, longwave, swatichouhan012, alexpott: Remove all @deprecated code from Asset component
parent 00bcb11b
Loading
Loading
Loading
Loading
+3 −17
Changes for core/lib/Drupal/Core/Asset/AssetDumper.php: 3 added lines, 17 removed lines.
Original line number Diff line number Diff line
@@ -43,9 +43,9 @@ public function dump($data, $file_extension) {
    $path = 'public://' . $file_extension;
    $uri = $path . '/' . $filename;
    // Create the CSS or JS file.
    $this->getFileSystem()->prepareDirectory($path, FileSystemInterface::CREATE_DIRECTORY);
    $this->fileSystem->prepareDirectory($path, FileSystemInterface::CREATE_DIRECTORY);
    try {
      if (!file_exists($uri) && !$this->getFileSystem()->saveData($data, $uri, FileSystemInterface::EXISTS_REPLACE)) {
      if (!file_exists($uri) && !$this->fileSystem->saveData($data, $uri, FileSystemInterface::EXISTS_REPLACE)) {
        return FALSE;
      }
    }
@@ -62,7 +62,7 @@ public function dump($data, $file_extension) {
    // generating a file that won't be used.
    if (extension_loaded('zlib') && \Drupal::config('system.performance')->get($file_extension . '.gzip')) {
      try {
        if (!file_exists($uri . '.gz') && !$this->getFileSystem()->saveData(gzencode($data, 9, FORCE_GZIP), $uri . '.gz', FileSystemInterface::EXISTS_REPLACE)) {
        if (!file_exists($uri . '.gz') && !$this->fileSystem->saveData(gzencode($data, 9, FORCE_GZIP), $uri . '.gz', FileSystemInterface::EXISTS_REPLACE)) {
          return FALSE;
        }
      }
@@ -73,18 +73,4 @@ public function dump($data, $file_extension) {
    return $uri;
  }

  /**
   * Helper method for returning the file system service.
   *
   * @return \Drupal\Core\File\FileSystemInterface
   *   The file system service.
   */
  private function getFileSystem() {
    if (!$this->fileSystem) {
      @trigger_error('\Drupal\Core\File\FileSystemInterface is a dependency of this class in Drupal 8.7.0 and will be required before Drupal 9.0.0. See https://www.drupal.org/node/3006851.', E_USER_DEPRECATED);
      $this->fileSystem = \Drupal::service('file_system');
    }
    return $this->fileSystem;
  }

}
+1 −5
Changes for core/lib/Drupal/Core/Asset/CssCollectionOptimizer.php: 1 added line, 5 removed lines.
Original line number Diff line number Diff line
@@ -59,15 +59,11 @@ class CssCollectionOptimizer implements AssetCollectionOptimizerInterface {
   * @param \Drupal\Core\File\FileSystemInterface $file_system
   *   The file system service.
   */
  public function __construct(AssetCollectionGrouperInterface $grouper, AssetOptimizerInterface $optimizer, AssetDumperInterface $dumper, StateInterface $state, FileSystemInterface $file_system = NULL) {
  public function __construct(AssetCollectionGrouperInterface $grouper, AssetOptimizerInterface $optimizer, AssetDumperInterface $dumper, StateInterface $state, FileSystemInterface $file_system) {
    $this->grouper = $grouper;
    $this->optimizer = $optimizer;
    $this->dumper = $dumper;
    $this->state = $state;
    if (!$file_system) {
      @trigger_error('The file_system service must be passed to CssCollectionOptimizer::__construct(), it is required before Drupal 9.0.0. See https://www.drupal.org/node/3006851.', E_USER_DEPRECATED);
      $file_system = \Drupal::service('file_system');
    }
    $this->fileSystem = $file_system;
  }

+1 −5
Changes for core/lib/Drupal/Core/Asset/JsCollectionOptimizer.php: 1 added line, 5 removed lines.
Original line number Diff line number Diff line
@@ -59,15 +59,11 @@ class JsCollectionOptimizer implements AssetCollectionOptimizerInterface {
   * @param \Drupal\Core\File\FileSystemInterface $file_system
   *   The file system service.
   */
  public function __construct(AssetCollectionGrouperInterface $grouper, AssetOptimizerInterface $optimizer, AssetDumperInterface $dumper, StateInterface $state, FileSystemInterface $file_system = NULL) {
  public function __construct(AssetCollectionGrouperInterface $grouper, AssetOptimizerInterface $optimizer, AssetDumperInterface $dumper, StateInterface $state, FileSystemInterface $file_system) {
    $this->grouper = $grouper;
    $this->optimizer = $optimizer;
    $this->dumper = $dumper;
    $this->state = $state;
    if (!$file_system) {
      @trigger_error('The file_system service must be passed to JsCollectionOptimizer::__construct(), it is required before Drupal 9.0.0. See https://www.drupal.org/node/3006851.', E_USER_DEPRECATED);
      $file_system = \Drupal::service('file_system');
    }
    $this->fileSystem = $file_system;
  }

+1 −17
Changes for core/lib/Drupal/Core/Asset/LibraryDiscoveryParser.php: 1 added line, 17 removed lines.
Original line number Diff line number Diff line
@@ -67,14 +67,10 @@ class LibraryDiscoveryParser {
   * @param \Drupal\Core\Asset\LibrariesDirectoryFileFinder $libraries_directory_file_finder
   *   The libraries directory file finder.
   */
  public function __construct($root, ModuleHandlerInterface $module_handler, ThemeManagerInterface $theme_manager, StreamWrapperManagerInterface $stream_wrapper_manager = NULL, LibrariesDirectoryFileFinder $libraries_directory_file_finder = NULL) {
  public function __construct($root, ModuleHandlerInterface $module_handler, ThemeManagerInterface $theme_manager, StreamWrapperManagerInterface $stream_wrapper_manager, LibrariesDirectoryFileFinder $libraries_directory_file_finder = NULL) {
    $this->root = $root;
    $this->moduleHandler = $module_handler;
    $this->themeManager = $theme_manager;
    if (!$stream_wrapper_manager) {
      @trigger_error('Calling LibraryDiscoveryParser::__construct() without the $stream_wrapper_manager argument is deprecated in drupal:8.8.0. The $stream_wrapper_manager argument will be required in drupal:9.0.0. See https://www.drupal.org/node/3035273', E_USER_DEPRECATED);
      $stream_wrapper_manager = \Drupal::service('stream_wrapper_manager');
    }
    $this->streamWrapperManager = $stream_wrapper_manager;
    if (!$libraries_directory_file_finder) {
      @trigger_error('Calling LibraryDiscoveryParser::__construct() without the $libraries_directory_file_finder argument is deprecated in drupal:8.9.0. The $libraries_directory_file_finder argument will be required in drupal:10.0.0. See https://www.drupal.org/node/3099614', E_USER_DEPRECATED);
@@ -437,18 +433,6 @@ protected function drupalGetPath($type, $name) {
    return drupal_get_path($type, $name);
  }

  /**
   * Wraps \Drupal\Core\StreamWrapper\StreamWrapperManagerInterface::isValidUri().
   *
   * @deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Use
   *   \Drupal\Core\StreamWrapper\StreamWrapperManagerInterface::isValidUri()
   *   instead.
   */
  protected function fileValidUri($source) {
    @trigger_error('fileValidUri() is deprecated in Drupal 8.8.0 and will be removed before Drupal 9.0.0. Use \Drupal\Core\StreamWrapper\StreamWrapperManagerInterface::isValidUri() instead. See https://www.drupal.org/node/3035273', E_USER_DEPRECATED);
    return $this->streamWrapperManager->isValidUri($source);
  }

  /**
   * Determines if the supplied string is a valid URI.
   */