Problem/Motivation
The user module is installed by install_base_system()
but it is also in the list of profiles to be installed by install_profile_modules()
. System module is removed from this list by install_base_system()
but user is not. However the system module removal doesn't actually work.
So both System and User are passed twice to \Drupal\Core\Extension\ModuleInstaller::install() during a Drupal install. This doesn't have much impact because the second time we ignore the requests to install but it is still confusing when debugging and doing unnecessary work.
Proposed resolution
- The removal of the system module in
install_base_system()
does not work because System module is required by other modules (including User) so it is added back in. - The use of state to track the list of modules is completely unnecessary we already have this information in the $install_state global and this information is maintained already through out the install process
- system and user modules should be removed in
install_profile_modules()
Do less things during the installation process for the win.
#3 tried to remove the special case for the User module but this ending up breaking:
- Installation from configuration for DrupalCI (couldn't reproduce this fail locally)
- Changing the language that user 0 and user 1 are created in - this is probably a bug in HEAD but changing this behaviour shouldn't happen here.
Remaining tasks
User interface changes
None
API changes
None
Data model changes
None
Release notes snippet
N/a
Comment | File | Size | Author |
---|---|---|---|
#14 | 3112790-9.1.x-14.patch | 2.06 KB | alexpott |
#7 | 3112790-7.patch | 2.06 KB | alexpott |
#7 | 3-7-interdiff.txt | 1.25 KB | alexpott |
Comments
Comment #2
alexpottHere it goes for option 1.
Comment #3
alexpottArrghhh... the code in HEAD to exclude the system module from being installed twice is also not working!
Comment #6
alexpottSo the patches in #2 and #3 have an interesting affect. It means that when the anonymous and admin user are created they are done so in the language selected by the installer. I think this might make sense but it is a bigger change than I anticipated. So I think first up here we should make a more limited change and file a follow-up to discuss the user creation and in what language issue.
Comment #7
alexpottHere's a more minimal patch.
Comment #8
andypostInteresting, ++ to get follow-up because at least drush allows to install without EN language
Comment #9
alexpottCreated #3112866: Remove special case of User module install as a follow-up
Comment #11
longwavePatch and explanation makes sense, this is a small but useful cleanup.
Comment #12
andypostbtw now comment has different meaning
It was like session service is not enough for next bootstrap, and the user entity should be created before
\Drupal\user\Authentication\Provider\Cookie::getUserFromSession()
can use itbut that is not true for installer kernel, so follow-up is more about why user required in install time
Comment #13
catchNeeds a re-roll.
Comment #14
alexpottRerolled.
Comment #16
catchCommitted 4e62462 and pushed to 9.1.x. Thanks!