By liquidcms on
Is there a good way to have modules disabled or enabled for a specific site?
To clarify:
- i have a multiple user development project
- our std practice is that each developer gets their own site folder where they can use the $conf array to define system variables (e.g. site email address)
this is a very useful Drupal feature.
Is there anyway to add this same concept for modules status (enable/disable)?
ideally something as simple as adding:
db_query("update system set status = 0 where name = 'securepages'");
would work; but settings.php runs before bootstrap so we don't get access to commands such as db_query.
so short of doing this with base php db commands; is there a cleaner way?
Comments
If each user gets their own
If each user gets their own site, why not just give them access to the modules page? To have different sets of modules enabled, you need a different database for each site already, might as well give the users free reign.
-----
Übercart -- One cart to rule them all.
thanks but this is not the
thanks but this is not the problem i am trying to solve - this is to improve the sites multi-developer environment. All site developers of course already do have access to everything - including all admin pages. The point was to not have to go into db and re-set everything every time a new copy of production db is pulled.
The ability i am looking for would be exactly the way the $conf array is used. So developers would be able to enable/disable certain modules regardless of what is in the db and specific to their own test/devel needs.
Peter Lindstrom
LiquidCMS - Content Management Solution Experts
Peter Lindstrom
LiquidCMS - Content Solution Experts
That is a different problem
Since this sounds like a private project, you may be able to get away with creating some nodes that run the PHP to enable the modules. Of course, I would have it check to see those modules are already enabled so they aren't run when they need to be edited. If your databases are reset by a script, it might be able to view those nodes with cURL or something. That would be a little more reliable than viewing the nodes manually.
-----
Übercart -- One cart to rule them all.
lockdown on hook_init
I just tried this. It works (D5 anyway).
function system_init doesn't exist, so I hijacked the name.
Inserted into the localized settings.php
My env also has frequent dumps and DB syncs from live back to dev, but dev needs to be locked. Don't want to leave it open by accident.
.dan. is the New Zealand Drupal Developer working on Government Web Standards
I threw the following into
I threw the following into hook_init() in a custom module:
I simply add the 'running_on_localhost' configuration variable in settings.php for the local environment...
__________________
Personal site: www.jeffgeerling.com
For D6 and latest version of
For D6 and latest version of securesite, in settings.php you can set
So, just install the module, and enable and configure it. Then set that variable appropriately in each version of your site.
--
Tom
www.systemseed.com - drupal development. drupal training. drupal support.
That sounds much tidier!
That sounds much tidier! Thanks!
.dan. is the New Zealand Drupal Developer working on Government Web Standards
Not on D7
For anyone who might be wondering, this approach doesn't seem to be working in D7
-cdmo
Environment
Might also be worth looking at http://drupal.org/project/environment
Environment "Creates a drush command line interface for setting an environment for a site instance".
_
yet another option http://drupal.org/project/system_features
@cdmo
because in module_disable() in D7: $module_list: An array of module names.
you have to pass it an array
https://api.drupal.org/api/drupal/includes%21module.inc/function/module_...
also functions like module_disable() are not available for use in settings.php - put the code into a custom module or (if you're lazy and want to remember where you put it) a theme template. Status messages help.
~are you netsperienced?
♥ follow me @decibelplaces ∞
Here's what I threw in a site
Here's what I threw in a site-specific settings.php file:
________________________
Dave Hansen-Lange
Director of Technical Strategy, FourKitchens.com
Are you absolutely sure that
Are you absolutely sure that works? Have you actually tested it? It doesn't look like "module_disable" even exists when you check for its existence with the following inside and at the bottom of settings.php:
var_dump(function_exists('module_disable'));Also note that on my server, I've used multiple folders for individual environments (i.e. - foobar.domain.com, foobartest.domain.com) including your code in only the foobartest location's settings.php file and saw that the module would be disabled in my production environment--which is obviously incorrect--the point being that it appears to yield unpredictable results.
(Luckily, it didn't break anything! :) )
environment_modules
Another option: https://www.drupal.org/project/habitat
I'll second Habitat. It's
I'll second Habitat. It's another module, but it's small and the least intrusive. It requires the least amount of modification and manual intervention, and most importantly, gives you exactly what is needed with the least amount of time. It should probably be in core (or some flavor of it).
Enabling CAS module from settings.php in drupal
Hello ,
Can anyone let me know whether it is possible to enable CAS module from inside of settings.php instead doing it from Web UI from a site.
Also, can the CAS.php path & the CAS server details can be set inside somewhere setting.php or some other config files without doing it from Web GUI.
I am writing a docker file so I will be needing these information so that I can spawn a drupal container with CAS enabled with it.
Thanks,
Suman
If you are trying to do that
If you are trying to do that with docker i will suggest you create a shell script and add drush commands to :
1 - enable CAS module
drush en -y cas
2 - Set CAS variables
drush vset -y cas_server "cas_server_url"
drush vset -y cas_logoutURL "cas_logout_url"
...