At #SANDcamp 2011 this past weekend, someone was talking about a couple of ways to ease the pain of moving sites between dev, test, and prod by having certain variables defined in a site's settings.php $conf array. As I heard multiple participants exclaim that they "didn't know you could do that with Drupal!" I began to see that we are missing some supporting documentation relating to every possible thing that can be stuffed into the $conf array. I mean sure, there are a couple of *really* basic examples that come in a default Drupal site, but that does nothing to help users become power users by tweaking their environments differently and having them stay that way. Every one of us has got to have a couple of these ditties that we've used over the years and just never written down.

Thus, I'm proposing that we make a docs page for examples of things that can be placed into a settings.php configuration, along with a single explanatory sentence regarding how this particular config is useful. I've already started a .txt file locally and hunted down a few examples which I list below, but I need more of them, some better explanations, technical review for correctness, and most importantly, a DESTINATION for this docs page. WHERE SHOULD IT LIVE?

********************************************************************************
Entries in the settings.php $conf array will override whatever's in the variables
table of your database. This is really useful when you need different configs
for your LOCALHOST|DEV|TST|PRD environment.

$conf = array( // FOR DRUPAL 6
'site_offline' => FALSE, //Take the site online or offline. (Also known as Maintenance Mode.)
'maintenance_theme' => 'minnelli', //When in maintenance mode, what theme do you want?
'site_name' => 'Example.com DEV', //Define the name of the site on the dev server.
'theme_default' => 'Bartik', //Set the theme which will be used on this site; Zen, Bartik, Garland, whatever.
'admin_theme' => 'Rubik'; //Set the administrative theme on your own machine, regardless of what the rest of the team uses. :)
'anonymous' => 'Visitor', //What should anonymous users be labeled?
'securepages_enable' => FALSE, //Turn off Secure Pages for your dev or local server.
'securesite_enabled' => '0', //Disable the SecureSite module.
'rules_debug' => '1', //Enable the debugging output of the Rules module on your localhost box.
'preprocess_css' => FALSE, //Disable CSS compression.
'preprocess_js' => FALSE, //Disable JS compression.
??'smtp_mail' => 'Off', // Disable outbound emails so you don't spam all users while testing stuff. :)
??'smtp_library' => '_______________', //Reroute outbound mail to a destination such as dev/null
)

$conf // FOR DRUPAL 7
$conf['cache_backends'][] = 'includes/cache-install.inc';
$conf['cache_default_class'] = 'DrupalFakeCache';
$conf['cache_class_cache_page'] = 'DrupalDatabaseCache';
********************************************************************************

Comments

zirvap’s picture

I'll echo the "I didn't know you could do that with Drupal!"

I suggest placing it as a subpage under "Advanced and multisite installation" at http://drupal.org/documentation/install/advanced-multisite, and link to it from "Use test sites" (http://drupal.org/node/22282)

Carolyn’s picture

I second that placement and that linkage. What should the page be titled? suggestion: "Defining variables in a site's settings.php $conf array"

arianek’s picture

great :) that sounds appropriate to me too

resplin’s picture

Such a list can be obtained by looking in the site database "variable" table, or running drush variable-get.

Matt V.’s picture

Here are a couple of links to similar posts on the topic, in case they provide some additional ideas that might be useful:

jhodgdon’s picture

I don't think you can ever make a comprehensive list. There are hundreds (at least) of variables in Drupal (especially if you have some contrib modules). We should have a page that tells people they can do this and gives some examples, but IMO we shouldn't try to list them all.

Of course, in Drupal 8 this is all going out the window, since all config will be in files anyway. :)

nevosa’s picture

IMO it makes sense to export the list of vars from a fresh drupal 6/7 install, and make a list in one location with a one line explanation on each. I think that this can be beneficial for developers, as well as a configuration asset.

nevosa’s picture

An export from a fresh install on v7 has these vars:
admin_theme: "seven"
clean_url: "1"
comment_page: 0
cron_key: "fOexKQur356Lvb9sHdYBPZ30bGjDRjQn_3UMDWo0-LM"
cron_last: 1333900821
css_js_query_string: "m264gl"
date_default_timezone: "Europe/Helsinki"
drupal_private_key: "yELjjkgX_W46_lZZ0vffYZ7eaWlVO9FcxctFCp_Dspo"
file_temporary_path: "C:\drupal\tmp"
filter_fallback_format: "plain_text"
install_profile: "standard"
install_task: "done"
install_time: 1333900821
menu_expanded: Array
menu_masks: Array
node_admin_theme: "1"
node_options_page: Array
node_submitted_page: "FALSE"
path_alias_whitelist: Array
site_default_country: ""
site_mail: "admin@gmail.com"
site_name: "d7.local"
theme_default: "bartik"
update_last_check: 1333900832
update_notify_emails: Array
user_admin_role: "3"
user_pictures: "1"
user_picture_dimensions: "1024x1024"
user_picture_file_size: "800"
user_picture_style: "thumbnail"
user_register: 2
404_fast_paths_exclude: "/\/(?:styles)\//"
404_fast_paths: "/\.(?:txt|png|gif|jpe?g|css|js|ico|swf|flv|cgi|bat|pl|dll|exe|asp)$/i"
404_fast_html: "..."
dev_query: "FALSE"
cron_safe_threshold: 0

an export from a fresh install on v6 has these vars:
theme_default: "garland"
filter_html_1: 1
node_options_forum: Array
drupal_private_key: "731365ce6dd8c9b9df1f0d165826b9ee6a67bfc8d1c3b0212edb7ff8ddf7950f"
menu_masks: Array
install_task: "done"
menu_expanded: Array
site_name: "d6.local"
site_mail: "admin@gmail.com"
date_default_timezone: "7200"
user_email_verification: "TRUE"
clean_url: "1"
install_time: 1333898247
node_options_page: Array
comment_page: 0
theme_settings: Array
css_js_query_string: "X0000000000000000000"
install_profile: "default"
dev_query: "FALSE"
cron_safe_threshold: 0

Hoping this can help move this documentation issue forward,

jhodgdon’s picture

Great, then someone can go ahead and add the page to the Community Documentation, as suggested in the first few comments above. Maybe someone can start by making a Drupal 7 page from the export above, and filling in any descriptions they can, and others can edit the page to add descriptions? :)

nevosa’s picture

Assigned: Senpai » nevosa
Status: Active » Needs review

Hi,
I've added the doc page here:
http://drupal.org/documentation/install/advanced-multisite
http://drupal.org/node/1525472

Check for errors and feel free to comment/edit any errors you find,
Thanks,

ken_y’s picture

Looks good.

I suggest the Arrays be expanded to indicate whether they default to no elements, or if there are some default elements that are populated.

apaderno’s picture

Assigned: nevosa » Unassigned
Category: Feature request » Task
Status: Needs review » Closed (outdated)

I am closing this issue since the linked documentation page needs to be migrated. No work will be done on that page.