Allows a list of modules to be enabled in $conf['environment_modules'].

Inspired by #625444: Override enabled module/theme list dynamically using variable override in settings.php which has been stuck in the core queue for a while.

Instructions

First, you need to have your dev/staging/production sites set up with their own unique settings.php (a common pattern for this is to require settings.local.php from settings.php). If you don't have this kind of set-up, then you don't need this module.

For staging/dev, add something like this to settings.php, once environment_modules is enabled, these modules will be enabled too.

<?php
$conf
['environment_modules'] = array(
 
'devel' => 'sites/all/modules/devel/devel.module',
);
?>

This module is designed to enable modules on dev or staging (for example devel module), not to disable modules on you production site. It's fine to have the module enabled on production, in fact that's the idea, but do not configure your production settings.php to use it.

If you are using regular Drupal page caching and don't have bootstrap hooks disabled in settings.php, then you will see a significant performance hit from having this module configured. It doesn't disable the page cache, but it moves part of full bootstrap to hook_boot(). There should not be a noticeable performance hit for non-cached pages though.

There is no support for install/enable/disable hooks, nor for module weight. Patches welcome.

Project Information

Downloads