Problem/Motivation
#1863512: Move default views into their respective module config directories wants to move views that are owned by other modules to their respective extension directories. For example, views.view.taxonomy_term.yml should be provided the taxonomy module and not views. Also if the taxonomy module is disabled then this view should be removed. At the moment views does this in the view storage controller. This is because the listAll() method on Config's FileStorage still returns disabled module's config. This means that disabled modules configuration is bleeding in the running site!
This issue somewhat related to: #1199946: Disabled modules are broken beyond repair so the "disable" functionality needs to be removed
Proposed resolution
At DrupalCampLondon @swentel, @damiankloip and I discussed this issue at length. The solution we came up with is:
- We need to introduce the concept of configuration owner into the configuration system
- We can then use this to create directories within the config directory for each enabled owner
- If we inject the module list into the config storage controller that we can then ignore directories of disabled modules.
This will also solve:
- #1831776: removing manifest files from uninstalled modules as manifests are owned by the entity type implementor and therefore will be cleaned up when the its config directory is removed.
- https://twitter.com/swentel/status/297483860436979712 (and this is only get worse as more things become ConfigEntities.
the screenshot is just a small part, the whole directory is ~1500 files, so yes, I think I will like that (@berdir)
Remaining tasks
- Inject the module list into the config storage controller that we can ignore directories of disabled modules.
- This patch also exposes an existing issue with manifest synchronisation on module disable. However this is an existing issue.
API changes
@todo
| Comment | File | Size | Author |
|---|---|---|---|
| #29 | 1932600.configuration-owner.29.patch | 93.65 KB | jackbravo |
| #28 | 1932600.configuration-owner.28.patch | 90.98 KB | jackbravo |
| #27 | 1932600.configuration-owner.27.patch | 90.18 KB | jackbravo |
| #22 | 19-22-interdiff.txt | 992 bytes | alexpott |
| #22 | 1932600.configuration-owner.22.patch | 104.46 KB | alexpott |
Comments
Comment #1
alexpottCurrent patch
Comment #3
alexpottTagging
Comment #4
alexpott#1: 1932600.configuration-owner.1.patch queued for re-testing.
Comment #6
alexpottpatch in #1 is failing due to [[SimpleTest]]: [MySQL] Drupal installation failed.
Install works just fine locally!
Comment #7
alexpott#1: 1932600.configuration-owner.1.patch queued for re-testing.
Comment #8
alexpottImproving title
Comment #10
alexpottThe failures are probably due to php version... thanks @berdir
Comment #11
swentel commentedGave this a spin, I actually like the directory structure, it feels more sane to the active store directory (cf screenshot further down).
Two things I've noticed:
Hello directories :)
Some code comments.
This 'can' either ..
Just wondering why you cast to string here, I'm seeing this in a lot of places, can $name really be something else ?
We use 'Contains' nowadays right ?
It 'also' allows ?
redundant 'the'
redundant 'a' or 'the'.
'or' instead of 'on'
I'm generally not a fan being able to pass on mixed params. However, I haven't looked in depth whether it's solvable or not.
Comment #12
gddIt seems to me that this issue is just a duplicate of the very very long and involved discussion that has already happened at #1776830: [META-1] Installation and uninstallation of configuration provided by a module that belongs to another module's API? A lot of conclusions have been reached there and I hope everyone has read and ingested all that.
Also, I'm against making any changes for the purposes of disabled modules until #1199946: Disabled modules are broken beyond repair so the "disable" functionality needs to be removed gets resolved.
Finally, by moving config into subdirectories we remove the ability to sort all config by date changed, which is a very easy way to tell what config has changed recently or not. I'm not a big fan of that.
Comment #13
sunIMHO all subdirectories should be (or must be) reserved for config context override files.
I originally asked that the Locale module overrides should be moved into and contained in respective ./locale.whatever-foo/ or ./language-foo subdirectories. Last time I looked, Locale still used config filename modifiers instead of subdirectories. We definitely need to move the overrides into subdirectories — otherwise, the whole thing becomes unmaintainable.
Comment #14
alexpott#13 funnily enough this patch actually achieves (imo) a sensible approach to the locale issue.
This means that locale files are in the same as the module that provides the config it is translating. Which means you translations are removed when you uninstall the module that provides the translated config.
Comment #15
xjmThis seems like it would simplify a number of other problems. It's both robust and simple. If we restrict it to a single subdirectory per module, I think it also is an acceptable increase in complexity usability-wise.
See also: #1776830: [META-1] Installation and uninstallation of configuration provided by a module that belongs to another module's API
Comment #16
xjmI'm not sure we can afford to wait on that.
Comment #17
alexpottRerolled, fixed up the views suite of tests and made new config diff functionality work...
Now hopefully we've move 5.3.10 will run on the bots.
Comment #19
alexpottMight be green...
Comment #20
alexpottWell.... it won't be green if I don'set to needs review...
Comment #22
alexpottFixes the failing views test that is occurring now that \Drupal\views\Tests\ModuleTest has an additional dependency on the node module because it is using the views.view.archive view.
Comment #23
kerasai commented#22: 1932600.configuration-owner.22.patch queued for re-testing.
Comment #25
dbcollies commentedComment #26
dbcollies commentedComment #27
jackbravo commentedHi guys, this is a re-roll of the patch. Tests still fail, but I thought it would be better to post it now than later (specially since I'm probably done for today). I can install drupal, config files are in their own directory and in general seems like things are going well, except on the tests =P.
This is an example test fail from running "sudo -u www-data php ./core/scripts/run-tests.sh Configuration":
Sorry for not providing an interdiff, but I could not apply the last patch to go from there.
Comment #28
jackbravo commentedI modified also core/lib/Drupal.php which like config.inc has a function config($name). So just a minor edit.
Comment #29
jackbravo commentedOk. I had a permissions problem, and that's where most exception came from. The patch did have some errors, most related with some tests not being up to date with the code. I updated this tests and now I'm down to two fatal errors when running sudo -u www-data php ./core/scripts/run-tests.sh Configuration. And I don't think this errors are related to this patch :P.
So here is the new patch.
Comment #31
star-szrThanks @jackbravo!
Unfortunately this needs another reroll.
I think the diffstat might be a bit too different for the reroll in #29 as well. It might make sense to do another reroll from #22 - this may be a difficult reroll since it's a relatively large patch touching many files.
Patch in #22:
46 files changed, 791 insertions, 297 deletions.
Patch in #29:
47 files changed, 683 insertions, 214 deletions.
Comment #32
Gaelan commentedRerolling.
Comment #33
Gaelan commentedI can't quite figure this one out either. :(
Comment #34
Anonymous (not verified) commentedEDIT - removed unhelpful post.
Comment #35
xjmSee also: #1776830: [META-1] Installation and uninstallation of configuration provided by a module that belongs to another module's API
This might not be necessary if we resolve the above issue by using subdirectories or name parsing in the default config directories above, but I'm not 100% convinced of either of those solutions.
Comment #36
alexpottThe install scenario has been solved and uninstall too by issues linked on #1776830: [META-1] Installation and uninstallation of configuration provided by a module that belongs to another module's API
Comment #36.0
alexpottFix up text