Problem/Motivation
Much like we force dependent modules to be enabled, it would be handy to be able to disable a module and its dependencies recursively. When there are several dependencies between modules, several successive rounds of disabling modules are required which takes a really considerable amount of time and makes the whole procedure tedious.
Proposed resolution
These two options are discussed:
A. Use Javascript to:
1) when a user clicks on a checked-disabled check box, enable and uncheck it, then recursively uncheck all modules which depend on that module and then all modules which depend on the modules which were just unchecked, etc. Could also display a popup message informing the user that unchecking this module will cause the following modules to be unchecked as well.
and/or
2) when a user unchecks a module, check if there are any modules which it requires and enable their check box, if possible.
B. Don't disable any check boxes on the form, and then when the form gets submitted, check if there are any additional modules which will need to be disabled and then ask the user if they would like to continue. Similar process to enabling module dependencies.
Remaining tasks
After enough discussion, the general consensus is to try and have as much consistency with the way things are done now when enabling modules that have dependencies. So we need to go with option B mentioned above where basically, when you click submit, Drupal would now tell you two things and get you to confirm that the following modules will be enabled and disabled:
1) List of modules which will now be enabled because they are dependencies for modules you want to enable.
2) List of modules which will now be disabled because 1 or more of the modules they depend on are being disabled.
Latest patch available for testing is in comment #21 below.
Related issues
#107038: Javascript to select module dependencies
User interface changes
Any module can be selected to be disabled on the modules page (besides the always required core modules such as node and user). After submitting the page a confirmation is required to disable possible dependant modules.
API changes
none.
Original report by NancyDru
// Text of original report:
Much like we force dependent modules to be enabled, it would be might handy to be able to disable a module and its dependencies. I just went to disable Update (in this case, but it's not important which one) because of a problem I'm debugging and there were two levels of dependencies that meant I had to disable 3 times - way too much overhead.
Comment | File | Size | Author |
---|---|---|---|
#39 | 468208-module-disable-dependants-39.patch | 8.07 KB | Niklas Fiekas |
#38 | 468208-module-disable-dependants-38.patch | 13.11 KB | Niklas Fiekas |
#35 | 468208-module-disable-dependants.patch | 8.48 KB | klausi |
#31 | 468208-module-disable-dependants.patch | 9.61 KB | klausi |
#21 | 468208-module-disable-dependants.patch | 7.84 KB | klausi |
Comments
Comment #1
Anonymous (not verified) CreditAttribution: Anonymous commentedThe two options I can think of are
A. Use Javascript to:
1) when a user clicks on a checked-disabled check box, enable and uncheck it, then recursively uncheck all modules which depend on that module and then all modules which depend on the modules which were just unchecked, etc. Could also display a popup message informing the user that unchecking this module will cause the following modules to be unchecked as well.
and/or
2) when a user unchecks a module, check if there are any modules which it requires and enable their check box, if possible.
B. Don't disable any check boxes on the form, and then when the form gets submitted, check if there are any additional modules which will need to be disabled and then ask the user if they would like to continue. Similar process to enabling module dependencies.
...Thoughts?
Comment #2
authentictech CreditAttribution: authentictech commentedI agree that this issue needs to be addressed and that the solution is to use Javascript to enable or disable checkboxes according to whether dependant modules are enabled/disabled
This is also similar to a feature request I was going to make now so I will post it here instead as it can probably be implemented while solving this one.
When updating modules the process usually involves disabling all non-core modules. When there are several dependencies between modules this will involve several rounds of disabling modules. The last time I did this it required 4 rounds of disabling modules which took a total time of approx. 3–4 minutes to complete. This is much too long, particularly as we want to encourage people to update modules/core regularly and as soon as possible, and it is unnecessary...
I suggest making the update process much easier by placing a button at the top of the module page with the button text saying, "Disable all contributed modules". When clicked, all but the presently enabled core modules will be disabled. This addition would greatly increase the speed of the update process and usability.
--
Edit: decided to post my latter suggestion as a new issue #490274: One-click button to disable all contributed modules so it doesn't get overlooked.
Comment #3
NancyDru@authentictech: I'm going to guess you don't do many multi-sites. I have as many as 12 sites on a single code base, so there are 12 different combinations of contribs that would have to be written down before disabling everything. I'm sorry, but disabling all contribs just is not a viable option for me. For me to disable A, which is used by B, which is used by C, all I want is to be able to disable A, B, and C the same time. I don't want any others disabled.
Comment #4
authentictech CreditAttribution: authentictech commentedWow. Were you intending to sound so snotty? (If not, it's not always so easy to tell in forums). You don't need to make such guesses. It's quite natural, whatever sites a person works with, to assume that someone is working on a single installation site unless they have otherwise stated.
Now you've clarified your situation, I can see my suggestion was addressing with a slightly different problem. Please everyone ignore my earlier post which is being dealt with in a different queue. Thank you.
Comment #5
NancyDruNo, I was not being snotty; sorry that it sounded that way. I just wanted to point out that your solution would present a major headache to those of us who have a bunch of modules that are not in use on that particular site. If I find a particular module is used on only one site, it goes in sites/sitename/modules. But if it is used by several sites, it goes in sites/all/modules, which makes it show up to all sites, even if it is not being used on a particular one.
Comment #6
Anonymous (not verified) CreditAttribution: Anonymous commentedSo would anyone like to give me some feedback?
My preference would be to go with option B which I mentioned above, because it is similar to the process when Drupal tells you additional modules need to be enabled.
So basically, when you click submit, Drupal would now tell you two things and get you to confirm that the following modules will be enabled and disabled:
1) List of modules which will now be enabled because they are dependencies for modules you want to enable.
2) List of modules which will now be disabled because 1 or more of the modules they depend on are being disabled.
I am more than happy to write a patch for this feature, but I would like to get some feedback first and know if people are interested or not. So please let me know what you think. Just a simple "I think this will be/won't be useful" comment would be helpful, thanks!
Comment #7
NancyDruYes, I like the consistency. How do you get around the disabling of the check box on the depended-upon modules?
Comment #8
Anonymous (not verified) CreditAttribution: Anonymous commentedI haven't looked at the code yet, but I'm sure it can't be too hard to remove the code for core which disables the check boxes on the modules page, so the users are free to uncheck anything they like. Except for core modules :-)
The only downside is, users would need to pay attending to what they are unchecking so they they don't get a big surprise on the next page when Drupal tells them that additional modules need to be disabled and asks them to confirm.
Maybe we could also look at adding cues to the depended-upon modules to make them stand out.
Comment #9
Panchomoving to Drupal 8 queue
Comment #10
lpalgarvio CreditAttribution: lpalgarvio commented#107038: Javascript to select module dependencies
Comment #11
NancyDruAnd would such a solution degrade gracefully?
Comment #12
lpalgarvio CreditAttribution: lpalgarvio commentedi have no clue. just noting a similar issue :)
Comment #13
klausiHere is a patch that allows users to disable any module (except the required core modules). If the module has dependants then the confirmation form suggests to disable them as well. Needs some testing.
Comment #14
klausiFixed plural message for disabling multiple modules.
Comment #15
klausiNow with a test case :-)
Comment #16
klonos...less vague issue title (if you guys don't mind) and subscribing too.
I'll go through the issue and update it's issue summary according to Issue summary standards. Someone with more knowledge please update the "API changes" and other sections too as required. Thanx.
PS: ...talking about API changes, if there are none I mean, could D7 possibly benefit from this too?
Comment #17
klonos...done. Please update it as you see fit.
Comment #17.0
klonos...compliance to issue summary template ;)
Comment #18
klausiGreat, I see no API changes here. Updated the issue summary.
Comment #19
klonosThanx for taking the time to reply and update the summary Klaus! No API change is great news, because we have more chances to get this backported to D7 ;)
Comment #20
NancyDruAdding tags
Comment #21
klausiPatch does not apply anymore. Here is a new patch with an additional test case for the disable ordering.
Comment #21.0
klausiupdated ui changes & api changes
Comment #22
klonos...updated link to latest patch in issue summary to point to #21 ;)
Can someone suggest a couple of contrib projects with multiple dependencies and multiple levels of dependencies too (IOW modules that depend on others that in turn depend on more)? Thanx.
Comment #23
NancyDruWell, Calendar springs to mind. Depends on Date, which has its own dependencies.
Oh, yes, Media Gallery has lots of dependencies.
Comment #24
sunMajor issues:
See also:
#1029606: Regression: Not loading the .module file causes a fatal error when uninstalling some modules (as does loading it)
#151452: Uninstalling modules does not follow dependencies and can lead to WSOD
#592800: Dependent modules are still installed when required modules return errors in hook_requirements('install')
The JavaScript suggestion in this issue seems to be a duplicate of #107038: Javascript to select module dependencies
Comment #25
klausi1. Yes, they are disabled first with this patch.
2. Uhm ... not sure what you mean. Yes, we should take care of the ordering when disabling modules. Can you give me an example where this approach could fail?
3. This patch is not about disabling dependencies automatically. It is about disabling dependents. Updated the issue title, sorry for that ambiguity.
Comment #26
NancyDruSun, I could live with a form that steps me through it (similar to the update.php process). The fact is that the module admin page is probably the consistently slowest page in Drupal and having to load and save it several times is extremely error prone, time consuming, and aggravating.
Comment #27
NancyDruSetting title back
Comment #28
sunAlright, thanks, now I understand. Not backportable, so removing tags.
Overall, this idea makes sense to me. However:
You can try to implement this, but this will require excessive tests. I'm not sure whether all edge-cases are covered by existing modules in core, so it's possible that we have to add some hidden testing modules that depend on each other, and which additionally implement some advanced hooks; e.g., hook_disable(), hook_modules_disabled(), hook_system_info_alter(), containing direct calls to functions in the required/parent modules, and ideally also a registered and auto-loaded class including override (extended class in a dependent module).
FYI: Everyone is aware that the process of disabling and uninstalling modules is time-consuming and cumbersome, but as of now, it's the only way to ensure that modules are processed in the correct order, and more importantly, that hook implementations are processed in the correct order and no implementations are invoked that shouldn't be invoked. In other words: Cumbersome is better than fatal errors and WSODs.
Comment #29
klonosWho said that we'll accept and implement an idea that is *proven* to give fatals and WSODs? The goal is to correct the current cumbersomeness + have a solid solution. I am pretty confident we'll figure a way eventually. Fear of *possible* errors and WSODs shouldn't be a reason to stop working on improving things. The same goes for fear of excessive work and thus sticking with the old ways instead.
So, yes, lets have as many tests as required to have QA but lets fix this.
PS: I was under the impression that only API changes held back backporting. Does the same thing stand for any important UI changes too?
Comment #30
klausi@sun: the patch already has test cases that cover the general dependency chain. Modules are ordered correctly when they are disabled.
Why do I have to write excessive tests to get this approved? Yes, I can imagine that there could be edge cases that might lead to unintended behavior. But that applies to any new feature that enters Drupal core.
Let's get to the details:
So I can see only one interesting additional test case on hook_modules_disabled(), but that's it. Marking as "needs work" until we have that test.
Comment #31
klausiNew test case added that checks hook_modules_disabled() on disabled modules. Added yet another test module for that (disable_test). Everything works as expected.
@sun: is that enough or can you come up with another case that would fail?
Comment #33
klausiTestbot seems to be broken, re-test later.
Comment #34
xjmTagging as novice for the task of rerolling the Drupal 8.x patch on account of #22336: Move all core Drupal files under a /core folder to improve usability and upgrades.
If you need help rerolling this patch, you can come to core office hours or ask in #drupal-gitsupport on IRC.
Comment #35
klausiReroll.
Comment #37
xjmThat's a legitimate fail, so it looks like the patch needs work yet.
Comment #38
Niklas Fiekas CreditAttribution: Niklas Fiekas commentedDoesn't apply against HEAD, so here's a reroll.
Edge case: Say you have Comment module enabled, Forum disabled. Now untick Comment, tick Forum. Current message: "You must disable the Forum module to disable Comment."
That message looks fine, actually. So just to make it sure: Should the message be like that? Will Forum module disabling hooks be fired, although it was never enabled?
Comment #39
Niklas Fiekas CreditAttribution: Niklas Fiekas commentedMeh ... wrong diff.
Comment #41
klonosThere will be no disabling of modules in D8 - only uninstalling: #1199946: Disabled modules are broken beyond repair so the "disable" functionality needs to be removed
Comment #42
klonos...
Comment #42.0
klonosupdated link to latest patch ;)
Comment #43
kattekrab CreditAttribution: kattekrab commentedCan this still go in given we're now in Beta? I was just doing some testing and hit the uninstall page - and found this help text
"The following reason prevents Block from being uninstalled: Required by: Custom Block"
That doesn't seem very user friendly to me, and could probably be phrased better...
perhaps "Custom Block requires this module to be installed. It can not be uninstalled."
or "This module can not be uninstalled because it is required by Custom Block. "
Then I found this issue - which would require different language again.
Comment #56
quietone CreditAttribution: quietone at PreviousNext commentedComment #57
mxmilkiib CreditAttribution: mxmilkiib commented