Download & Extend

Override enabled module/theme list dynamically using variable override in settings.php

Project:Drupal core
Version:8.x-dev
Component:base system
Category:task
Priority:normal
Assigned:moshe weitzman
Status:needs review

Issue Summary

It can be very handy to dynamically enable/disable a module for your site. Assume you might share copies of same DB between live and development environments. You can enable devel module just for your dev environment and keep it disabled in the system table. Similarly, you might enable a module that logs all email rather than sending email when in dev environment.

Depends on #623992: Reduce {system} database hits, so it won't pass unit tests at least until that lands.

AttachmentSizeStatusTest resultOperations
module_variable.patch2.36 KBIdleFailed: Failed to apply patch.View details | Re-test

Comments

#1

Status:needs review» needs work

The last submitted patch failed testing.

#2

Status:needs work» needs review

Dependant patch has landed.

AttachmentSizeStatusTest resultOperations
mod_var.diff2.36 KBIdlePassed: 14706 passes, 0 fails, 0 exceptionsView details | Re-test

#3

Only 359 passes because #623992: Reduce {system} database hits is still broken. Being worked on.

#4

This would be really handy for local sandboxes and shared development sites - where you'll often have devel etc. in sites/all and have to keep re-enabling them every time you bring down the live database. Patch looks clean, won't have any appreciable performance impact on live sites.

#5

Version:7.x-dev» 8.x-dev

#6

subscribe

#7

Subscribe. Directed from related blog post.

#8

You could almost do this in D7 via a contrib module and hook_module_implements_alter() - except for module_exists() and others which don't use that.

#9

Apparently this was implemented in at least this module $conf['securesite_enabled'] = 0;

There is also this project: http://drupal.org/project/environment

I very much want this for Devel (same case as the original post), but it looks like not possible in D6.

#10

I really think core should support something like in #7 rather then just drush/devel

#11

15 lines of code including closing braces: http://drupal.org/sandbox/catch/1152890

#12

Seems like a great solution for now. Time will tell how brittle it turns out to be. It is a bit disconcerting for modules to get loaded and stil have 0 status in DB.

#13

Yeah I still think we should consider this for D8, although at the moment I prefer making disabled modules enabled compared to the other way 'round - this way there's no runtime cost on production - enabled modules have to be loaded by system_list() and possibly elsewhere, which is currently not cheap for memory until the system_get_info() patch gets in.

Was mainly just excited that this was possible at all from contrib in D7, drupal_static() is amazing for hacks like this.

#14

Or you make an install profile with the .info file format I mentioned in #7.

#15

subscr

#16

Status:needs review» needs work

re-rolling

#17

Status:needs work» needs review
AttachmentSizeStatusTest resultOperations
system_list_overrides.patch2.6 KBIdlePASSED: [[SimpleTest]]: [MySQL] 33,316 pass(es).View details | Re-test
nobody click here