Closed (fixed)
Project:
Drupal core
Version:
8.7.x-dev
Component:
configuration system
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
28 Jan 2018 at 09:56 UTC
Updated:
22 Mar 2019 at 18:14 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
andypostKinda of that
Comment #3
andypostComment #4
borisson_Looks great! Only those deprecated methods are used in that file, so that means this is RTBC.
Comment #5
alexpottThis is not injecting the service. If we want to do that then we need to do quite a bit more work to add it to the constructor of FileStorage and InstallStorage and ExtensionInstallStorage.
As these classes are used everywhere the default should be NULL but we should automatically deprecate this and mandate it in Drupal 9.
Comment #6
andypostPatch adds constructor argument & clean-up code
All this storage classes are used to be created manually so not clear how to keep BC, that's why I did add
\Drupal::service('file_system')as workaroundIf this change needs to trigger error then it needs change record
Comment #7
andypostProper patch
Comment #10
andypostRevert removal of constructor & added injection to
ExtensionInstallStorageComment #12
andypostInjection at install time creates circular dependency so looks #2 was right way
Comment #14
berdirYes, injecting through the constructor is not an option. What if we just add a setter method so if someone really wants to do unit tests, he can, similar to string translation trait, messenger and so on. That said, not quite sure how you'd do unit tests of this anyway, because it clearly is very file/storage related, you can't mock the remaining low-level php functions and so on anyway.
There are almost 40 variants of new FileStorage() in core, so updating them all would be a ton of work, which is why I didn't deprecate not passing one in.
Interdiff is against #2.
Comment #15
andypostAwesome idea, looks good to go
Comment #17
andypostbot flux
Comment #18
volegerblocker for #3021434: Properly deprecate drupal_unlink()
Comment #19
voleger+1 for rtbc
Comment #20
alexpottHow about making the factory container aware, using \Drupal\Core\DependencyInjection\ContainerInjectionInterface, and then injecting the service via constructor injection? Yes we'd then have to do more work with the other storages but we'd achieve the aims of having the file system service injected everywhere.
Comment #21
andypost@alexpott i gonna explore this way, the real problem here is that
FileStorageand derivatives created directly (not using service - 32 times at least)Comment #22
berdirI discussed this a bit with alexpott in slack:
So..
* Change the method to private, remove setFileSystem(), just do return \Drupal::service()
* update the issue title/summary to reflect that we don't inject but just use the serice
Comment #23
andypostFixed IS and addressed suggestion
Comment #24
andypostreupload patch
Comment #25
andypostComment #26
alexpottI'm not sure that the property is worth it.
Comment #27
andypost@alexpott
ensureStorage()andchmod()could be called fromwrite()subsequently but only once and that rare case so removedComment #28
berdirLets do this so we can finalize the deprecation of those functions.
Comment #29
alexpottI pushed the deprecation patch first because it's doing something more important - this needs a reroll.
Comment #30
andypostreroll
Comment #31
berdirAnd back to RTBC.
Comment #33
Mixologicdispatcher/testbot issue. back to rtbc
Comment #34
alexpottCommitted and pushed 2348afa46a to 8.8.x and 321bbf9658 to 8.7.x. Thanks!