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
This is the Umami version of #2990776: Remove config-editing parts from standard_install() in favor of exported configuration.
demo_umami_install() manually updates various bits of configuration instead of shipping with proper configuration exports in config/install. This promotes a bad practice for other installation profile authors.
Proposed resolution
Remove all configuration updates in favor of exported configuration files.
Comment | File | Size | Author |
---|---|---|---|
#14 | interdiff.txt | 1.26 KB | longwave |
#14 | 2998483-14.patch | 6.24 KB | longwave |
Comments
Comment #2
iuana CreditAttribution: iuana at Softescu commentedComment #3
chr.fritschComment #4
iuana CreditAttribution: iuana at Softescu commentedHi, here are my changes regarding removing config editing from hook_install().
Comment #6
Eli-TI'm not sure if that's why the tests are failing but we shouldn't have the UUIDs at the top of the new config files.
We should also remove
use Drupal\user\RoleInterface;
from profiles/demo_umami/demo_umami.install, as we are no longer using it, as suggested by the codesniffer_fixes.patch file in #5
Comment #7
iuana CreditAttribution: iuana at Softescu commentedComment #8
iuana CreditAttribution: iuana at Softescu commentedComment #9
iuana CreditAttribution: iuana at Softescu commentedIndeed, thanks
Comment #11
longwaveA few more config entries were needed to get the tests to pass: the site name and email and some extra permissions, and the default_config_hash isn't required,
Comment #12
Eli-THave reviewed and confirmed all the removed code from demo_umami_install() is reflected in configuration.
Have checked that configuration against exports from a site without the patch and confirmed it does match.
Have run SimplyTest.me with this patch and visually inspected all the configurations moved from code to config do match.
Therefore marking RTBC.
Comment #13
tstoecklerLooked through the patch and compared it to the one committed over in #2990776: Remove config-editing parts from standard_install() in favor of exported configuration. Really great work, it looks almost perfect! Thanks everyone for working on this. However, I found one thing, which still needs work before this can committed:
First of all there should be a
uuid
key as the first entry with an empty string as a value.The
name
andmail
entries should be set to empty strings, as well. We should not harcode the site name and e-mail address for everyone.The tests were failing because SimpleTest overrides these values when installing Drupal. So we need to add something like the following to the third parameter of
::assertConfigDiff()
inDemoUmamiProfileTest::assertDefaultConfig()
:That way the test should pass again.
Comment #14
longwaveThanks for the review. I fixed everything mentioned in #13 but could not get assertDefaultConfig() to pass with the exact values (not sure why), however it allows substrings so I just listed the keys and this seems to work.
Comment #15
tstoecklerPerfect, that's event better! Thanks @longwave.
Thinking about this, I think the reason is that
assertDefaultConfig()
ignores the respective parts from the default config, not the active config - while the respective test for Standard profile does it the other way around.In any case, let's do this.
Comment #16
alexpottCommitted and pushed e4f5c03c92 to 8.7.x and 23ae4779af to 8.6.x. Thanks!
Fix array coding standards on commit.