I think it would be nice if there was a checkbox on the admin page: 'disable shield' or something. This could then easily be turned on/off when needed.

Let me know, if you need a patch I'm happy to create one. Should be a pretty straight forward one! :)

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

boombatower’s picture

Status: Active » Closed (works as designed)

Checkbox already exists, on modules page....disable/enable. No need to duplicate functionality

damiankloip’s picture

fair enough

samhassell’s picture

Status: Closed (works as designed) » Active

This functionality would be useful when maintaining a shielded uat and an unshielded production site.

Much in the same way, this checkbox could be used to enable or disable the functionality of the module in settings.php. ie.

$conf['environment_indicator_enabled'] = TRUE;
$conf['environment_indicator_color'] = 'red';
$conf['environment_indicator_text'] = 'STAGING SERVER';
$conf['environment_indicator_margin'] = 0;
$conf['cache'] = '0';
$conf['block_cache'] = '0';
$conf['page_compression'] = '0';
$conf['preprocess_css'] = '0';
$conf['preprocess_js'] = '0';
$conf['shield_enabled'] = TRUE;

I guess the alternative is to put these kind of directives in deployment/sync scripts, is that what you would recommend?

boombatower’s picture

Looks like http://drupal.org/project/environment_modules would work like you want.

samhassell’s picture

Status: Active » Closed (works as designed)

No D6 version for that project. Never mind, I was just trying to flesh out the argument a bit :) Cheers.

boombatower’s picture

It's a good argument since that is what I am doing with environment_indicator and in fact the project I was using shield on is having to enable or disable the module inside of a hook_enable(). I agree with your usecase.

Not sure if we should implement in shield or try and backport, don't expect to be very hard, the general solution since this applies to other modules besides shield (like the afor mentioned environment_indicator). Thoughts?

samhassell’s picture

environment_indicator is about 20 LOC (http://drupalcode.org/project/environment_modules.git/blob/refs/heads/7....) so it wouldn't be hard to backport, assuming what it does in hook_boot() can be done in hook_init(), so that might be worthwhile - I'd be willing to give it a go. I'll come back here once i've had a shot at that.

*edit* environment_modules, not environment_indicator.

samhassell’s picture

Status: Closed (works as designed) » Needs review
FileSize
1.91 KB
2.3 KB

Here's a small patch that adds a variable_get('shield_enabled', 0) if clause to the hook_boot(). It also adds a checkbox to the settings form so people can enable or disable it.

Defaults to 'enabled', as that was the previous action of the module.

One against 6.x and one against 7.x.

azinck’s picture

+1 to this.

Environment Modules doesn't work for my use case. I'm accessing the same site via two different URLs. When accessed via one of them I don't want Shield protecting anything. When accessed via the other I do want protection. But in both cases I need the module enabled because I need to use the module's admin interface to choose what's protected by Shield. The patch in #9 permits this since I can just set shield_enabled to my desired setting in settings.php.

kalman.hosszu’s picture

Status: Needs review » Fixed

@samhassell thanks for your patch. I rerolled it and appended with a minor stuff but it was ok.

The commits:

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.