Problem
- Install profiles can no longer be found, because they are registered as modules.
Goal
- Properly separate modules and profiles.
Details
- The install profile is registered as a module in {system}, so Drupal is able to invoke its hook implementations through the module system.
- system_rebuild_module_data() manually enhances the list of all modules to tack the install profile on top of them (with a very high weight to sorta ensure that their hooks run last).
- This makes it troublesome to look up/retrieve the install profile record/data, as well as to update it.
- It disallows the system from having multiple profiles that inherit from others (like base themes).
Proposed solution A
- Instead of this hack, adjust module_invoke_all(), module_implements(), drupal_alter() and friends to check and invoke hook implementations in the install profile, and invoke them after the module implementations.
Proposed solution B
- Remove hook implementation support entirely for install profiles and turn them into own, first-class extension types, which do not participate in the system at normal runtime after initial installation.
-
Many people argue that install profiles should be nothing else than configuration in the first place.
With the new configuration system, almost all PHP code in an install profile's
hook_install()will move to configuration files in a./config/subdirectory. -
If an install profile needs or wants to do something a module can do, then it should ship with a module.
There's really no reason at all for why the code needs to live directly in the profile.
-
Related issues
- #562042: Search for install profiles in sites/[all|site]/profiles folders, and move core profiles into /core/profiles
- #3266057: Allow profiles to define a base/parent profile [continue of #1356276]
- #1242956: Allow install profiles to be switched
- #689396: The install profile is sometimes referred to as a module during installation
- #820054: Add support for recommends[] and fix install profile dependency special casing
- #1170362: Install profile is disabled for lots of different reasons and core doesn't allow for that
Comments
Comment #0.0
sunUpdated issue summary.
Comment #0.1
sunUpdated issue summary.
Comment #0.2
sunUpdated issue summary.
Comment #0.3
sunUpdated issue summary.
Comment #1
sunI clarified the impact of CMI on install profiles (in proposal B).
FWIW, I'd strongly prefer proposal B, since it allows us to remove tons of hacks and keep the architecture clean.
Essentially, proposal B degrades an install profile to a simple "pointer" to a (site) directory in which further modules/themes may be found. If that pointer or the directory happens to vanish - e.g., because the subdirectories have been moved into sites/all/* - then nothing bad happens — the system remains to stay functional and operable.
Comment #1.0
sunUpdated issue summary.
Comment #2
catchI added two more issues to the summary.
Comment #3
webchickTurning installation profiles into modules in D7 was an important DX improvement, IMO. They were special "thingies" in D6 and earlier and really difficult to work with. They need a way to declare dependencies, to perform tasks on install, to alter the forms during registration and add/change/remove fields, etc. All of which are things modules do. Why should I have to learn two different ways to do the same things?
At the very least, if we're going to go with option B, an analysis should be done of the top 20 or so distros and find out if it's actually true that "almost all PHP code in an install profile's hook_install() will move to configuration files in a ./config/ subdirectory." I have my doubts.
Comment #4
sunWell, we can happily inject some special code like the following into the Drupal installer:
... or even more custom and less hacky:
... plus probably a dozen other possible ways to achieve the same.
But the important part is:
That's a one-time hack/operation for a clearly defined scope. — We do not continue to support a hack that's an architectural disaster for the entire lifecycle of a Drupal site.
Comment #5
catchEverything that can't, can go in a profile-specific module that ships with the distribution no?
There are many, many places in core, where we have special casing of profiles to avoid them actually working like modules, those need to go.
Comment #6
dkl4 commentedFor background, see the following issue which I believe changed profiles into "full modules" :
Install profiles should be modules with full access to the Drupal API and all it entails(.install files, dependencies, update_x)
http://drupal.org/node/509398
Comment #6.0
dkl4 commentedAdding two issues to summary.
Comment #7
sunComment #8
andypostneeds update about current state of modules storage and hook invocation
Comment #12
andypostBeta is too close
Comment #20
quietone commentedHappened to find this after looking at one of the related issues in the IS. Adding those issues to related issues.
Comment #24
quietone commentedFound another related issue
Comment #26
smustgrave commentedWonder if this. ticket can be closed for #2595663: When installing a profile module it incorrectly gets added to the module list with type module as they have a patch over there.
Comment #28
taggartj commentedFor me in 10.1.3
I had to do something like this
in Drupal\Core\Extension\ExtensionList ....
was upgrading but drush cr was not working / throwing an error
just incase you see "The profile X does not exist."