Closed (won't fix)
Project:
Administration menu
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
6 Sep 2007 at 17:28 UTC
Updated:
10 Jul 2009 at 20:33 UTC
How hard would it be to write a sql query that selected all modules that didn't start with 'modules/', and were also STATUS = 1?? I'm imagining a button that would disable all non-core modules for the site, in preparation for an upgrade.
To take this even further, if each contrib/custom module's name & status was saved into a db field before the site was upgraded, reversing this process after the upgrade would be a hell of a lot less painful as well, dontcha think?
Comments
Comment #1
Chris Johnson commentedI will do this one.
Comment #2
sunGood idea!
Steps to implement:
util_modules_disabledis not set).util_modules_disabledutil_modules_disabledutil_modules_disabledvariable.Comment #3
senpai commentedThe 5.x version of this module is effectively dead, so let's focus on the 6.x branch for future development.
Comment #4
sunI have implemented a quite similar feature into Drupal Administration Menu that allows to disable/re-enable all "developer" modules in one fell swoop. Doing this one should be quite easy, and I really would like to provide this feature to the grand crowd of admin_menu users.
Thus, moving over to admin_menu's queue. And because that would really help folks trying to upgrade from D5, I'm hereby downgrading this issue for 5.x.
Comment #5
sunBetter title.
Comment #6
senpai commentedI totally love this idea! admin_menu it is then! I use admin_menu on every one of my sites anyway, and encourage everyone else to do so.
Comment #7
pwolanin commentedI think starting with 6.x all updates will run even if the modules are disabled - i.e. there may be no point to implementing this for 6.x.
Comment #8
senpai commentedNo no, Peter, this would be for core upgrades so contrib modules can all be disabled before the event. You wouldn't want a 5.x contrib active after you upgraded core to 6, would you?
Comment #9
sunWell, pwolanin actually tried to say: It does not matter if contrib modules are enabled or disabled during an upgrade to D6. All update functions in all install files will be executed during an upgrade.
However, that sounds really scary. Can anyone confirm this behavior? If this is really the case, this issue does not make sense at all.
Comment #10
darumaki commentedWhy not create a menu that disables all modules prior to upgrading since this has to be done anyway, the admin menu is perfect for this.
Comment #11
sun@darumaki: See comment #9.
Comment #12
darumaki commentedoh I see, so when upgrading to 6 we didn't have to disable the modules ?
Comment #13
babbage commented@darumaki: That is only true because by default all modules that do not have "core = 6.x" in their .info file are disabled by default when upgrading to Drupal 6.x. However, the advice still being distributed with each Drupal 6.x version is that all contrib modules should be disabled before upgrading, so presumably that advice is still important.
Therefore, this feature is still required, but is required for 6.x users not 5.x users upgrading... therefore moved back to Drupal 6.x.
Comment #14
babbage commentedAt least in the meantime, I've created two modules for my own use that retool code from Quick Admin Modules to disable and enable all contrib modules... The Drupal 6.8 update was the straw that made me decide I wanted to have a quicker way to do this...
However, Drupal does not honour requests to turn off a module if it has dependents, even if those dependents are being simultaneously being switched off. QAModules has also had this same issue already I think, and this has been encountered in a patch elsewhere that I cannot find right now! Anyway, it would appear the module enable and disable page is checking for the active vs. disabled status of dependents in the database, rather than looking for whether dependent modules have also been switched off in the same "Save Configuration" update on the modules page—which I guess is fair enough given Drupal doesn't expect you to be able to submit a request to turn off a module if something else was depending on it.
So... I went looking in core to find exactly where this code was to have a look at exactly how it operates, but I don't seem to have found what I was looking for. module_disable($module_list) in /includes/module.inc is presumably what is being called, but where is it being called from, because unless I am missing something I'm not finding where the dependencies are being checked and thus why these additional modules are not being disabled... Probably it is staring me right in the face, but any leads?
Comment #15
sunhttp://api.drupal.org/api/function/module_disable/6/references
Comment #16
babbage commentedThank you... (Ah yes, RT*M). I had even been to that page earlier yesterday—I must be more sleep deprived than I realise! :)
Comment #17
pwolanin commented@Sun - I'm pretty sure that if you have a contrib module active in 5.x, its updates will be run in 6.x even if it's not active unless it puts an abort in its update functions.
In general I think such links are problematic - e.g. they open up a CSRF vulnerability.
Comment #18
babbage commented@pwolanin: I think it's an interesting point that having a menu link to do this is a security risk; what do you think would be the best way to achieve the goal? Because at present there is in my view a major usability issue with the advice that all contributed modules should be switched off for each 6.x upgrade—if you have multiple modules with multiple layers of dependencies, this is fiddly, time consuming, and thus an irritating waste of time. There is no technical reason why it needs to be difficult to turn off all contributed modules for an upgrade, only that no way has yet been implemented to do so.
My guess is that many users don't bother to turn off their contributed modules for an upgrade within major versions (e.g. 6.7 to 6.8). So I'd be interested in comments on how common people think this is, and if I am right and apparently people are mostly having no problems, whether in fact the advice to turn off all contrib modules when doing such an upgrade is actually necessary.
Comment #19
johnbarclay commentedI'm considering writing a helper module for ldap integration that helps users debug ldap configuration problems. I'd like to have a button that disabled all modules but the ldap modules. And another to turn them back on.
A function that took a set of non-required modules as arguments and disabled all but those, would be very useful for such a debugging a module. With a complementary restore function.
If modules_disable (http://api.drupal.org/api/function/module_disable/6) doesn't remove module's that are required by other modules, seems like it needs fixing. Another function that figured the correct order to disable the modules, then called module_disable one module at a time.
Comment #20
babbage commented@johnbarclay that is a very interesting idea. I have just had CVS access approved to upload the module I have created to disable all contrib modules. Your idea would fit nicely with my planned roadmap for v2.0 and I will try and include that. Am away from my dev machine for the holidays but will follow this up soon...
Comment #21
babbage commented(Posting updates in each of the places I had previously discussed issues related to this...)
pwolanin noted (#17) that to implement this as a menu item in Administration Menu opened the risk of a cross-site request forgery.
I therefore decided that a separate module that implemented this as a button to deselect the items on the module administration page (with the configuration then having to be saved by the user) was the most secure route. I have now implemented this in Contrib Toggle module:
http://drupal.org/project/contrib_toggle
Personally, I would like to see this functionality in core in the future—since it is the recommended upgrade advice for every upgrade.
Comment #22
sunActually, this no longer makes sense. Drupal 7 will execute module updates in the proper order, using a directed acyclic graph (DAC).