Problem/Motivation
Install profiles specify modules to install as dependencies[]. These are not enforced as hard dependencies though and can be disabled. (#808162: update.php fails when optional modules disabled for background). If a distribution wants to keep the install profile module around, tough luck. There's no mechanism right now to discern between "the install profile module is recommended" and "the install profile module is required to make the distribution work". This limits distrbutions as for the latter purpose another module needs to be maintained, confusing users and making the life of the distribution maintainer harder.
Proposed resolution
-Convert dependencies[] to hard requirements for install profiles.
-Removes all special casing that undoes it
-Ensure dependencies[] behaves the same for modules and install profiles
-Introduce support for recommends[]. This will install any module that is available in the modules system (just as dependencies[] does) but these modules can later be disabled/uninstalled. (Note: If a user git clones an install profile the dependencies will not be downloaded and this could lead to errors during install if dependencies were not downloaded. See comment #39)
Remaining tasks
-Re-roll patch in #26 replacing modules for recommends
-Add recommends[] support to module_enable()
User interface changes
-Add indicator in the UI to show that x module recommends y module.
Original report by catch
Install profiles specify modules to install alongside them as dependencies[], however they're generally not enforced as hard dependencies, see #808162: update.php fails when optional modules disabled and linked issues for background.
To fix this, we need to
* ensure that install profile dependencies are shown on admin/modules (note: #293223: Roll back "Hide required core modules" has been committed)
* update the core install profiles to always use hook_enable()
* document the API change for existing contrib profiles.
When the original patch went in, the idea was to use .info files to gather dependencies for Drupal.org packaging, however as far as I know this now uses .make files, so it shouldn't affect that at all, although it'd be good to have that confirmed, I've only half-followed the packaging work.
**Summary built from comments by catch in #37 and David_Rothstein in #39.
Comment | File | Size | Author |
---|---|---|---|
#71 | drupal_820054_71.patch | 7 KB | Xano |
Comments
Comment #1
carlos8f CreditAttribution: carlos8f commentedI'm not clear on how profiles would use hook_enable(). The modules need to be installed in a proper batch... Damien suggests adding a hook_optional_profile_modules(), but I don't see why we couldn't just add modules[] or optional_modules[] to the .info file, to keep the .module code minimal. We can safely put this off to D8, right? I think it's OK in D7 that we treat profile dependencies only as such during the install process.
Comment #2
catchWe have at least two critical bugs where the dependencies being enforced on runtime, (or not enforcing them) has caused side effects with other code - it's impossible to hook_system_info_alter() dependencies[] for a required module, and have that work at the moment, and the update.php bug, there may be other spots too.
In both cases we can only add more workarounds - since the same API means two different things at the moment, and is enforced inconsistently in different places.
I would like to fix it here, it's an API change though, so the question is whether we continue to add workarounds and special cases in D7, or break the API. Having to add modules[] or optional_modules[] to .info files makes it seem like more of a D8 task though.
Comment #3
webchickI am not real keen on changing the API at this point to add the concept of "soft" dependencies. It's way late in the cycle for such a thing, and it's not clear to me what sort of changes would have to happen on the d.o back-end to support them now that we have all the packaging stuff. IMO, this is D8 material.
And though we refactored install profiles this release to behave as modules do and utilize the same hooks, updating, etc. (which is a good thing!), they're still fundamentally not the same thing. "Dependencies" in the context of an install profiles IMO still means "stuff required to get Drupal up and running", not "stuff that this profile will force the site to always have turned on even though there is no way to go back and change what profile you have installed without futzing with the database". That doesn't make any sense to me.
If the profile does have the need of such hard dependencies, it's trivial to add a required module with the "hard" dependencies to the list of your profile's dependencies so it's enabled on install and subsequently "locked" in. I don't see this as a horrifying workaround, especially at this stage, and it's what we've been doing since D5.
Short version: I'm fine with the workaround in #808162: update.php fails when optional modules disabled.
Comment #4
catchI was already quite resigned to fixing this in D8 but just a couple of clarifications:
1. Drupal.org packaging, afaik. is using .make files and doesn't use dependencies[] at all, so there shouldn't be any infra changes required.
2. If you add a module as a dependency of an install profile, then make other modules depend on that, then the original module itself I don't think will be required - because that's a 'soft' dependency same as all the others, so there's not much in the way of workarounds for this if you really, really need it.
Comment #5
webchick1. D'oh! I missed that in your initial post, sorry. :( It'd be good to have confirmation from the infra team, but that sounds about right.
2. Sorry, I apparently didn't explain myself properly. What I mean is this: if I'm an installation profile author, and I care about "hard" dependencies, I can create my own module with
required = TRUE
anddependencies[] = whatever
in its .info file and then specify it as a module to enable by default in my installation profile. This is what I've been doing for this since Drupal 5.The list of modules in installation profiles have always traditionally been only about "enable these things on set up" not "make these things hard dependencies." The fact that these modules are now specified via "dependencies[]" in the profile .info file doesn't change this fact, IMO. This was a simple syntactical change to make profiles and modules more unified in their approach to ease the learning curve.
Comment #6
webchickIn fact, I'd go one further with this. This seems clearly a feature request to me, and not one I'm even sure makes sense. Having two ways of specifying modules to enable on set up for installation profiles seems like a DX regression to me.
Comment #7
catchNo, you can't:
1. Required modules are hidden from admin/modules
2. If we unhide required modules from admin/modules, then requirements kick in for profiles too - see the post where I originally ran into this whole series of bugs at http://drupal.org/node/562694#comment-2777880
Which is why it is so horribly, horribly broken as it is in HEAD.
Comment #8
webchickOh dear lord. :P~
Ok, let's take a look at #562694: Text formats should throw an error and refuse to process if a plugin goes missing then and see what we can do. I still think this approach is not the right way to fix it, but we'll see.
Comment #9
webchickOh, and fwiw, I hate from the very pit of my soul that we completely hide required modules from the modules page and don't display their dependencies, so if this creates a legitimate critical bug reason for rolling back that stupid behaviour, then bonus. :P
Sounds like we need to special-case profiles in http://api.drupal.org/api/function/system_modules/7, too though (or go the system_info_alter() route as you did there). I can see what you're getting at with this becoming a slow avalanche of special-casing for install profiles, but atm it still seems preferable to changing the API so dramatically at this point.
Comment #10
catchI think at the moment it'd just be update.php and system_module() (or at least that's all I know about), so yeah it's fixable without changing the API, it's just stacking up in a fair number of places at this point.
Comment #11
yoroy CreditAttribution: yoroy commentedOh dear, hiding required core modules hides important info when/how please? I could probably tolerate a collapsed fieldset with the core required ones, you know, at the bottom somewhere. Maybe :) We probably would have if we managed to do something with the new/on/off/ sorting idea. I'd hate to frustrate distribution/packaging efforts.
Comment #12
David_Rothstein CreditAttribution: David_Rothstein commentedI think if we retitle this slightly it is neither a task nor a feature request, but rather a bug... Whether or not it can be solved in an acceptable way for D7 is another question, of course :)
The problem is that even if we add special-case code like in #808162: update.php fails when optional modules disabled all over core that doesn't really fix the problem for real, because anyone trying to use the API for dependencies is going to get tripped up by this. Suppose I want to write some code that shows me a list of all modules that are required due to other module dependencies - well, if I simply array_merge() all the 'dependencies' for all modules on the site then my list is incorrect, unless I remember to add a special case for the install profile in my code too. It is a bug in the API.
Fundamentally I think the bug is related to this:
We store in the database the fact that the install profile is of type 'module', and if so, it needs to fully act like one. Now, one could argue pretty reasonably that that should be type = 'profile' instead (yes, I know install profiles can implement hooks and all that in D7, but so can themes, and that doesn't mean we pretend a theme is a module when it isn't). That would be too late to change in D7, so the alternative is that we treat it like an actual, bona fide module, and if so, it's a bug to have 'dependencies' mean one thing for some modules and a different thing for others.
I think something similar to @carlos8f's idea is simplest: Just add a new key like modules[] to the .info file, in addition to dependencies[]. It's an API change, and if that's really unacceptable then there's not much we can do, but (a) it's a very simple API change that should take about 3 seconds for people who already wrote D7 install profiles to fix in their code, and (b) it's not really a new API change so much as a followup to an API change that was made months ago but whose implications were apparently not fully understood at the time.
By the way, reverting the hiding of required modules is in progress here: #293223: Roll back "Hide required core modules"
Comment #13
carlos8f CreditAttribution: carlos8f commentedYes, with modules[]/dependencies[] in $profile.info, #293223: Roll back "Hide required core modules" (required message saying "Required by: Profile name X"), we have a nice working system and can remove cruft like #808162: update.php fails when optional modules disabled. The change to install.core.inc/simpletest DWTC::setUp() to merge and install modules[] + dependencies[] would be really easy to do.
One thing I've been pondering is if all the above is in place, we might be able to get rid of required=TRUE, instead those are just dependencies[] of a profile. The reason is it doesn't really make sense for a module to be required in itself, apart from other modules or profiles. But standard.profile requiring node.module (optional for other profiles) makes perfect sense.
Comment #14
webchickHm. Why? That certainly seems like a much more reasonable fix than changing the developer-facing API at this point, and it helps clear up a WTF. Is there some sort of downside I'm missing?
Comment #15
webchickAnd the stuff described at #13 around removing required=true sounds like major refactoring with questionable benefit. I don't see why we would want to force every install profile to have to re-declare node and system modules as a dependency when huge swaths of Drupal will break without it.
Comment #16
carlos8f CreditAttribution: carlos8f commentedRemoving required=true is obviously a D8 idea, the direction being making Drupal more of a packagable framework, and using dependencies instead. Maybe the benefit is questionable, I just wanted to bring it up.
I'm not sure if type = 'profile' would be any easier, and might lead to even more special casing to get the profile to act like a module in the right places. I guess the next step is to try writing a patch (for either solution) and see where we get.
Comment #17
David_Rothstein CreditAttribution: David_Rothstein commentedYeah, my though was that moving to type = 'profile' would probably involve a lot more code in a lot of different places (all throughout the API for invoking hooks, etc). However, @webchick might be right that it would mostly be internal changes.
The difference, though, is that whereas changing the meaning of 'dependencies' is a small, focused API change, changing the fact that the profile is stored as a module or not seems like it could potentially have more wide-ranging and harder-to-predict effects elsewhere. I don't really know for sure, though.
Comment #18
catchThe original patches to change profiles were quite far reaching, so I have the same overall feeling as David here. One is a relatively simple fix with only small API repercussions, the other could end up with a tonne of refactoring spinning around.
Comment #19
carlos8f CreditAttribution: carlos8f commentedHere's a tentative implementation. The check added in #808162: update.php fails when optional modules disabled is now unnecessary, so I removed that.
One thing I noticed while writing the patch is that the installer doesn't actually sort the modules before installing them, which is a little disturbing. I think before sending them to the batch they should be ordered by the "sort" property added by graph.inc / system_rebuild_module_data() to make sure nothing breaks. The order modules are specified in .info shouldn't really matter, in terms of dependencies being ordered first. I'll probably open another issue for that.
Comment #20
carlos8f CreditAttribution: carlos8f commentedCreated #833192: Installer might install modules in wrong order, which would help this issue a little by allowing profiles to specify modules[] and dependencies[] in any order.
Comment #21
David_Rothstein CreditAttribution: David_Rothstein commentedI guess we are in Drupal 8 territory here...
Another interesting way in which profile "dependencies" are inconsistent with module dependencies is that they don't support including version strings as part of the dependency, as modules do. For example,
dependencies[] = some_module (2.x)
(see #211747: Allow specifying version information as part of module dependencies).Of course, I discovered that that feature even exists while reviewing #1049116: module_enable() doesn't account for version strings in dependencies[], which shows that the feature doesn't even work correctly for modules :)... but it is a feature that module dependencies are supposed to fully support, and the profile "dependencies" don't even remotely do so.
Comment #23
Mark TrappComment #24
boombatower CreditAttribution: boombatower commentedindeed, subscribe
Comment #25
catchThis caught out drush and led to a critical core bug report #1170362: Install profile is disabled for lots of different reasons and core doesn't allow for that.
Bumping to major.
Comment #26
catchRe-roll of #20.
Comment #27
sunThe proposed change from dependencies[] to modules[] does not feel right to me. Especially in light of D8+, where we actually need to go in the opposite direction.
AFAICS, we need to fix install_system_module() and make it perform the same weighting of dependencies as module_enable() does.
Comment #28
catch@sun, this has nothing to do with weighting of dependencies, it's about the fact that install profile dependencies are not dependencies at all. All dependencies[] does in .install files for profiles is provide a list of modules to enable (it's not even used for d.o packaging).
Then due to that, everywhere else in core (and drush) has to special case install profiles dependencies to stop them from working again.
That has nothing to do with ordering of dependencies or anything like that.
Comment #29
sunBefore reading up on all comments on this issue, this is what I originally wanted to write, but now I see that it's bogus:
______________________________
That only describes how broken the current system is. The current patch would manifest the situation, AFAICS. There are at least two issues that validly complain about dependencies[] not working like they should (possibly more):
#1093420: Recursive module dependencies of installation profile are not enabled in DrupalWebTestCase::setUp
#1057412: Testing of modules in profile
(found those after running into the exact same issue with #375397: Make Node module optional)
So,
______________________________
First and foremost, the issue title confused me. So, better title (hopefully). At least, it seems to be more in line with what the patch attempts to do.
The sole fact that dependencies[] of install profiles are not necessarily true dependencies[] (because they can be disabled) means that we have to introduce a new .info property for profiles. I'm still opposed to modules[], so I'd rather think along the lines of redhat/debian (?) package properties, as already proposed in #328932: Modules and partial dependencies - enhances[] and enhancedby[] field in modules' .info.yml files, #92233: Modules in conflict - conflicts[], breaks[], brokenby[] field in modules .info file, and more commonly http://drupal.org/project/module_supports :
Regarding the install profile itself and changing {system}.type into 'profile', I actually believe that most aspects have been cleaned up already. I'd imagine that the only required changes would be to module_list(), _system_rebuild_module_data(), drupal_alter(), and drupal_get_filename().
Comment #30
David_Rothstein CreditAttribution: David_Rothstein commentedI don't think
recommends[]
is quite right because they're more than just recommended; they're still required, but only at install time. So maybe something more likeinstalls[]
orinstall_dependencies[]
?Or perhaps we could just remove them from the .info file entirely? Per #1 above, Damien suggested a hook_optional_profile_modules(), which of course is very similar to hook_profile_modules() which we had in D6.
Overall, I'm not sure what the benefit was of moving them to info files in D7 anyway, to be honest. Having them there means you can't put any code logic around them; e.g. if you want to write an install profile that automatically "inherits" from another profile (by installing the same or similar list of modules) you could easily do that in D6, but in D7 it's extremely awkward and close to impossible.
Comment #31
webchickThe idea was to make profiles behave more as modules do, for better DX. Lots of people know how to write modules, but writing install profiles was always this process of learning janky hooks for things that would just be .info file properties, lacking basic fundamental capabilities like _alter() hooks and the ability to perform database updates, etc.
In retrospec though, it looks like in this case we went a bit too far.
Comment #32
catchIf we had something like install[] that could possibly be made available to modules too, would mean install if available. Could also leave dependency support in but remove the special casing so it works like everywhere else.
Comment #33
catchI'm looking at http://www.debian.org/doc/debian-policy/ch-relationships.html
It seems like we could use recommends[] to mean that there is not a hard dependency (i.e. allow those modules to be disabled), but if they're available in the file system, enable them at the same time if they're not already enabled. To me this fits closely enough to what the debian spec says.
Comment #34
sunExactly. That's what http://drupal.org/project/module_supports introduces as well.
However, there'd still be a difference then:
Thus, installation profiles don't have a way to recommend modules like modules do.
Comment #35
catchWell I meant if the module is in the file system, we'd actually install it if recommends[] was used. This means modules in the same project, you'd always get them enabled, modules in different projects, would depend on what you had available.
That could end up annoying though if lots of modules started using it and you had to go through and disable some again (bit like disabling the overlay every time you install D8).
If you wanted to recommend something without it being automatically installed, there is still suggests and enhances available.
If none of this fits, then we've got a good reason to go with something custom, maybe enable[]?
Comment #36
sunoh, you left out those -- indeed, that would work IMHO:
Comment #37
catchSo actual proposal:
dependencies[] - we make this a hard requirement for install profiles, remove all special casing that undoes it - behaves exactly the same for modules and profiles.
Introduce support for recommends[] - this will install any module that is available in the modules system (same as dependencies[]) but you can disable and uninstall those modules same as usual. This is what currently exists for install profiles, we keep that same behaviour, but allow modules to do the same thing for consistency. fwiw if you git clone an install profile, you won't get all the dependencies, wonder what happens in that case with dependencies[] and the installer..
For 'you might want to use this', suggests[] still exists in the debian spec, so the other issue that wants to add support for this on d.o can use that. This issue doesn't get into that at all.
This means if we went this way, the following is likely needed:
- re-roll the patch for s/modules/recommends/
- add recommends[] support to module_enable()
- do we need an indicator in the UI to show that x module recommends y module and that enabling one enables the other? I would love it if we could just introduce the API support and leave the UI for the recommends/supports/enhances issue but I dunno.
Comment #38
catchI'll try to look at a patch for these two so we can see what it looks like, ought to be relatively straightforward hopefully.
Comment #39
David_Rothstein CreditAttribution: David_Rothstein commentedWhat happens is that Drupal won't let you install due to the missing modules.
As I said in #30, what you're proposing for
recommends[]
is not actually the same behavior that currently exists for install profiles.It might make sense to just change the behavior of install profiles to work that way, but a side effect of that is that currently, a profile's hook_install() can assume that all the profile modules are installed and enabled when it runs. With this change, profiles would potentially have to stick module_exists() all over the place in their hook_install(), and doing that would kind of cripple them - since the point of an install profile is to be able to configure the site initially exactly the way it wants to.
On the other hand, to the extent this only affects people who clone a profile using Git (since tarballs from d.o. have the profile modules already in them), we could just decide to ignore the problem; i.e., people who use Git are responsible for downloading the right modules on their own and assumed to know what they're doing, and if they don't they might get fatal errors in hook_install() rather than the friendlier message from install.php that they currently get.
Comment #40
catchFor #39 that all sounds right, and yeah I'm hoping the latter will be fine since install profiles are packaged (and presumably the .make file will work with drush make from a git checkout? I haven't used that yet..).
Comment #41
DamienMcKennaAn oddity I just ran into with D7:
Should I open a separate ticket to deal with this or keep it within this larger issue and aim for a backport of the eventual fix?
Comment #42
catchThat sounds like a separate issue to me. I have a feeling dependencies of dependencies of install profiles are completely ignored.
Comment #43
DamienMcKennaI opened a separate issue: #1253774: Dependencies of dependencies are ignored by installation profiles (and by test setUp methods) Thanks.
Comment #44
catchWhile this inconsistency has caused numerous bugs in Drupal 7 this isn't actually a bug, just a wtf, switching to task.
Comment #45
nedjoIn D7, an install profile's dependencies will be enforced (at least through the modules admin UI) if you explicitly unhide the install profile by putting
in its .info file.
Edit: in which case you'll probably also want to put
so the install profile can't be disabled.
Comment #46
joelcollinsdc CreditAttribution: joelcollinsdc commented@ #45, wow good catch.
Not sure if issue follower counts are added up somewhere but i'd like to vote +1 for fixing this.
Comment #47
sunI'd love to move forward here. Any takers? The issue summary should also get updated with #37.
Potentially relevant: I plan to remove the weird conversion of install profiles into modules in:
#1676196: Install profiles are registered as modules
Ideally, we'd implant the new handling for recommends[], supports[], etc directly into the module/extension system, so it would generally work for everything — however, I suspect that this would be a giant patch, also involving rather large UI changes, so I'd recommend to limit the scope to installation profiles for now. That is, because it is really important to get this issue resolved for install profiles (but not really urgent for modules/themes). Making the code generic can happen in a follow-up issue, IMHO.
Comment #48
kbasarab CreditAttribution: kbasarab commentedUpdated issue summary from comments in #37 and #39.
Comment #48.0
kbasarab CreditAttribution: kbasarab commentedIssue Summary recreation from windsprints: http://initiatives.drupalofficehours.org/task/800
Comment #48.1
bleen CreditAttribution: bleen commentedUpdated issue summary.
Comment #49
bleen CreditAttribution: bleen commentedThis patch attempts to get the ball rolling on this once again. So far it seems to be working when doing a module install but I havent played too much with doing installation profile installs yes.
Of note:
I dont want to go too far down the rabbit hole though without getting some feedback. Setting to needs review to see how badly testbot chokes
Comment #51
tedbowOk it seems like it fails the test bot b/c finds it breaks the install.
I was debugging it the problem is the installer tries to install the comment module before the node module.
For $non_required modules the order before the sort is:
Then after the sort:
So I haven't looked how the sort works but that seems to be the problem.
Comment #52
tedbowOk, I have commented out 2 lines and this makes the install work for the standard profile.
/core/includes/install.core.inc
line #1542
So I know why these lines SHOULD be there. The $files array elements have the property "sort" and it seems we should sort the array by it. But the weights seems to be wrong when we have this patch(don't know why).
So why does it work with these lines commented our?? 2 possibilites
Comment #54
YesCT CreditAttribution: YesCT commentedpatch no longer applies. needs reroll (helpful doc: http://drupal.org/patch/reroll)
Comment #55
lbainbridge CreditAttribution: lbainbridge commentedI am working on a reroll, will post later today.
Comment #56
lbainbridge CreditAttribution: lbainbridge commentedOk, the function _module_build_dependencies($files) was moved to core/lib/Drupal/Core/Extension/ModuleHandler.php and renamed buildModuleDependencies(array $modules). I moved the functionality over and altered the .info files to .info.yml
Comment #58
disasm CreditAttribution: disasm commentedThanks for the reroll lbainbridge! This was very close to being correct on the first try. I think I debugged the problem to what you see below.
Please provide an interdiff when you make the change. Reviewers will thank you for it!
this needs to stay $this->parseDependency($dependency);
My hypothesis is this is what is calling the installation failure.
Comment #59
lbainbridge CreditAttribution: lbainbridge commentedThanks disasm, looking it over that would also be a problem with the added code for $recommendations_data, here is another reroll that should hopefully pass installation.
Here's the changes between my old patch and my new one:
Comment #61
star-szr@lbainbridge - Thanks for the reroll!
We worked on this during Sprint Weekend and I didn't mention interdiffs to everyone. Instructions on providing an interdiff.txt are here: http://drupal.org/documentation/git/interdiff
It looks like you've provided the interdiff inline with your comment, which is probably fine in this case. But now you know for next time :)
Edit: And it installs! Thanks @disasm.
Comment #62
disasm CreditAttribution: disasm commented#59: 820054-59-recommends.patch queued for re-testing.
Comment #64
mtiftI've been looking into why the most recent patch had 29 fails. For example, I ran CommentTranslationUITest and the first problem is with a "Call to undefined function language_negotiation_include()" in core/modules/translation_entity/translation_entity.install. The function language_negotiation_include() does exist in core/modules/language/language.module. A few other tests produced the same error, such as CustomBlockTranslationUITest.php and NodeTranslationUITest.php.
So I'm thinking this "recommends" patch won't apply until #1506868: Rewrite language_negotiation_include to support form_state and use it in language.admin.inc is fixed. I'll keep looking into some of the other test results.
Comment #65
disasm CreditAttribution: disasm commentedlets just remove this. leaving commented out dead code (especially without a comment explaining why it's being commented out is bad.
I haven't dug into this very deeply, but my thought is the errors are probably coming from the parseDependency method. The rest of the code looks like it's just variable rewrite and comment changes.
Comment #66
YesCT CreditAttribution: YesCT commentedjust removing the reroll tag since the most recent patch applies ok.
Comment #67
xjm@David_Rothstein suggests in #987242: The "Promoted to front page" checkbox doesn't do anything if the /node front page listing isn't used that we should add a way for modules to recommend (but not require) Views. Would the
recommends[]
functionality here jive with that?Comment #68
klonosPlease bear with me as I explain this whole idea...
Now, I'm not suggesting we remove the
dependencies[]
functionality, but to me it makes much more sense to userequires[]
andoptional[]
for hard and soft dependencies respectively. It feels more "natural" and I believe it would also cover #328932: Modules and partial dependencies - enhances[] and enhancedby[] field in modules' .info.yml files.So, how about we implemented and slowly started evangelizing the support of
requires[]
andoptional[]
but still supportdependencies[]
as an alternative/legacy form ofrequires[]
(and let it slowly die - till D9)?Now I know that the word "required" is already used in .info files to signify modules that need to be enabled by default at all times (
required = TRUE
) and that could lead to potential confusion, but......how about we (re)move the
required = TRUE
from the module.info files (only core modules can actually use it AFAIK) and keep all required modules in a single place? I propose this place for core to be a core.info file of a respective core profile that stays hidden (hidden = TRUE
) from the installation UI. All other core and non-core profiles would depend on this core profile (requires[] = core
in their respective .info files) and then specifyrequires[]
only for modules additional to these included in the core profile. So, what I'm actually proposing is introducing this concept of sub-profiles or profile dependencies/requirements if you like.To sum it up:
- Introduce
requires[]
andoptional[]
to .info files of modules, themes and profiles- Slowly deprecate
dependencies[]
in favor ofrequires[]
.- Introduce a special "core" profile that has
hidden = TRUE
being the first thing enabled during installation.- Replace
core = 9.x
withrequired[] = core (9.x)
so that this core profile becomes a requirement for all other profiles, modules and themes.- Move the
required = TRUE
from the .info of modules torequired[] = ...
entries in core.infoThe functionality of
required = TRUE
would still remain 99% the same, because in order to be allowed to disable a required module one would first have to disable core.profile. That of course would not be possible because core.info would specifyhidden = TRUE
.I believe that this plan would bring a little more consistency in .info files. Or I'm talking crazy(?)
Comment #69
klonos...well in D8 we use .info.yml files, so for example /core/profiles/minimal/minimal.info.yml:
would become /core/profiles/core/core.info.yml:
and then /core/profiles/standard/standard.info.yml:
Notice how in the standard profile:
1.
core: 8.x
is moved in the "requires" section as- core (9.x)
2. in the "requires" section the entries for node, block and dblog were removed (because they are installed with core.profile) and only modules additional to those defined by the core profile are there.
PS: does anybody know if there is a specific reason why entries in the dependencies lists are not in alphabetical order?
Comment #70
XanoDistributions can use it as well.
Also, renaming existing things will make it harder to get this approved by core maintainers. If we simply add
recommended[]
oroptional[]
, or whatever we want to call it, and display the information on the modules page and optionally install all available modules that are recommended, that won't break backwards compatibility.If we do rename the keys, let's be consistent and go for
required_dependencies
andoptional_dependencies
.Comment #71
XanoRe-roll, plus I undid the commenting as mentioned in #65.
Comment #72.0
(not verified) CreditAttribution: commentedUpdated issue summary.
Comment #72.1
chx CreditAttribution: chx commentedUpdated issue summary.
Comment #73
catchThis is less messy than it used to be now that disabled modules are gone, although we still have a fair bit of special casing of install profiles. Downgrading to 'normal' though.
Comment #74
XanoAn example of how this will impact core itself: content entities have list controllers, but they only show very basic lists of entities. The more flexible lists are views, but you will never see those, unless Views is enabled.
Comment #74.0
XanoUpdated issue summary.
Comment #75
penyaskitoThis could also help testing if used in modules and not only profiles.
There is no way that I'm aware of for testing D7 modules integrations with other modules that are not required dependencies, but "enhancements". This would make possible to download those modules which have an integration in testing environments for extending test coverage.
Comment #76
XanoTo do this, the project needs at least one module that depends on the optional module that should be checked out by the testbot. The easiest solution at this moment, if Foo depends on Bar, is adding a foo_test module that depends on bar and is hidden.
Comment #77
andypostCould be useful for #1548204: Remove user signature and move it to contrib to allow forum module recommend a user signature module
Comment #78
mitokens CreditAttribution: mitokens as a volunteer commentedComment #79
catchDidn't happen.
There's potentially still some scope to improve things in minor releases, so bumping.
Comment #85
alexpottI think this issue should focus on implementing recommends or suggests and not conflate this with building a list for an install profile to install. That said the aim of allowing install profiles to have dependencies is a good one and one I've implemented in #2952888: Allow install profiles to require modules.
Also re #39 and the hook_install issue for install profiles. We already have this problem with installing from configuration where people have uninstalled modules that the install profiles hook_install() relies on - for example contact and shortcut with standard_install(). For the me the solution here is #2952888: Allow install profiles to require modules and then if you want to rely on the modules being have them in your dependencies key and if you don't then wrap them in module exists checks.
Comment #96
Wim LeersThe last comment was in early 2018, 6.5 years ago, in #85.
The comment before that was in late 2015, 8 years ago, in #79.
Since then, the world has changed quite a bit. The Drupal ecosystem is no longer figuring out how to adopt Composer. It has adopted Composer!
Stopping to rely on Drupal's own
*.info.yml
files now seems more realistic: #1398772: Replace .info.yml with composer.json for extensions.Which means that it's realistic to not add
recommends[]
to*.info.yml
and instead rely oncomposer.json
's existingsuggest
? 😊Maybe the parent issue should be changed to #2002304: [META] Improve Drupal's use of Composer?
Comment #97
catchI'm not sure there's anything really to do here now that #2952888: Allow install profiles to require modules unless we wanted to implement composer.json suggests support in the UI somewhere? Moving to needs more info.