Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecated code #14

Open
hkirsman opened this issue Oct 21, 2021 · 1 comment
Open

Deprecated code #14

hkirsman opened this issue Oct 21, 2021 · 1 comment

Comments

@hkirsman
Copy link
Collaborator

I see that the module is D9 compatible but found this from the code:

// Define file_uri_scheme if it does not exist, it's required by realpath().
// The function file_uri_scheme is deprecated and will be removed in 9.0.0.
if (!function_exists('file_uri_scheme')) {
  function file_uri_scheme($uri) {
    return \Drupal::service('file_system')->uriScheme($uri);
  }
}

While the function fixes file_uri_scheme, there's also this change in core:

In Drupal 9 \Drupal::service('file_system')->uriScheme() has been replaced with \Drupal::service('stream_wrapper_manager')->getScheme()

@hkirsman
Copy link
Collaborator Author

Here's one possible solution from Image resize filter module:

  // Once Drupal 8.7.x is unsupported remove this IF statement.
  if (floatval(\Drupal::VERSION) >= 8.8) {
    $info['scheme'] = \Drupal::service('stream_wrapper_manager')->getScheme($uri);
  }
  else {
    $info['scheme'] = \Drupal::service('file_system')->uriScheme($uri);
  }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant