How can I ensure automatically that a module is disabled on my live site? I'm using a development -> staging -> live server workflow, and all three sites run off the same Git repository. The repository contains a few modules (a custom module for Selenium testing, etc.) that I never want to run on the live site.

Is there a way (in settings.php, perhaps?) to block a module from ever being enabled? I suppose I could also remove it from the repository, but my workflow is easier if I keep everything together.
You can hide modules from the admin UI by using the hidden property in the module's .info file:

hidden = TRUE


This method might be useful if you want to make sure the module is never enabled via the UI.

In case you're interested in how to do the opposite (stop a module from being disabled), it's also done in the .info file by setting the required parameter:

required = TRUE


Once you've done that Drupal will see the module as a 'core' module and stop it from being disabled through the admin UI.