Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
Follow-up to #1472946-67: Remove usages of deprecated function drupal_realpath() throughout core functions
Deprecated usage was replaced but not all classes using to inject dependency
Proposed resolution
Inject file_system
service into every place where it's possible
Remaining tasks
- replace usage of \Drupal::service('file_system')
with properly injected service
Comment | File | Size | Author |
---|---|---|---|
#10 | interdiff-2923511-9.txt | 3.7 KB | andypost |
#10 | 2923511-10.patch | 13.67 KB | andypost |
#9 | use-proper-di-for-filesystem-service-2923511-9.patch | 12.67 KB | piggito |
Comments
Comment #2
ilya.no CreditAttribution: ilya.no as a volunteer and at Skilld for Skilld commentedAttaching initial patch. I've updated one access handler and several forms. Not sure about tests.
Comment #3
andypostComment #4
andypost2 places should be changed
this looks not needed
But I see not usage changed in in this hunk
Comment #5
andypost4.1 is wrong - please ignore
missed dot at the end
Comment #6
ilya.no CreditAttribution: ilya.no as a volunteer and at Skilld for Skilld commentedThanks for the review! Attaching new patch and interdiff.
Comment #9
piggito CreditAttribution: piggito as a volunteer and at Skilld commentedI'm reverting the changes in
./core/modules/simpletest/src/Form/SimpletestResultsForm.php
cause it is a static function so we can't use$this->fileSystem
when the function isn't called from inside an object.Comment #10
andypostA bit more clean-up in ordering of `use`, the rest looks rtbc
Comment #12
andypostComment #15
joachim CreditAttribution: joachim as a volunteer commentedShouldn't this form inject the service with the create()/construct() pattern too?