Display warning for variables overwritten in settings.php

BillyTom's picture

I am loooking for a lightweight-solution to remind myself (or co-workers) about which Drupal-variables are overwritten in settings.php and can not be changed in the admin UI.

For example, in our prod-host we use compressed CSS/JS-files. The options are defined in settings.php.prod:

$conf['preprocess_css'] = TRUE;
$conf['preprocess_js'] = TRUE;

In our dev-host we want our assets to remain untouched, so our settings.php.dev reads:

$conf['preprocess_css'] = FALSE;
$conf['preprocess_js'] = FALSE;

What I want to accomplish is a visual cue that these values can not be changed when browsing the admin-ui. The input-fields for these values should be disabled and a little info-text should be displayed, like "Value overwritten in settings.php". See my little mockup for the interface.

It should not be too hard to accomplish this because the names of the drupal-variables and the input-elements in the admin-ui are identical:

Would this be a worthwile module? I am aware that there are other ways to manage settings across different hosts, but I want a solution that is as leightweight as possible and does not produce any unwanted overhead.

settings.png44.74 KB


I can't edit the original

BillyTom's picture

I can't edit the original post because my submission it is blocked as Spam by Mollum. The block happened two days ago and it is yet to be investigated/lifted.

This does not seem to be a good system.

To be honest, this is not

khaled.zaidan's picture

To be honest, this is not something I've ever wished I needed, but I can still see your point, and I see how it could improve an admin's experience by making it that little but more intuitive.

What I would start with, is an admin page where all the overridden variables show up, as some may not have any settings page at all. This can be achieved by reading the settings.php file, and simply listing everything in $conf.

In addition to that, what you suggested may be possible in D7, potentially by checking the actions and submit handlers on a form (to tell if it's a module's config form processed by system_settings_form())... but I'm not sure about D8, as that function is no longer there. Then we can be smart to find an overridden element and add a description saying that it may be overridden in settings.php.

Anywya, if anything, I think it's worth a try even if just for the sake of fun/learning.

I would love to see this

tahiche's picture

I would love to see this done.
Just now I was wondering why I couldn´t change the cache expiration time. Obviously set as $conf in mylocal.settings.php for local development.... Could have really used some sort of notice.