Drush is the most useful command prompt tool for Drupal Developer. In previous posts I discussed about installing Drupal using Drush.

Using Drush we can also set the values of the variables and we can also get/see the values of the variables.


The commands variable set, variable-get, and variable-delete allow you to configure, view, and delete Drupal configuration variables stored at the variable table.

Listing of various available variables:

Drush  variable-get will display list of all the variables 


$ drush variable-get
admin_theme: "bartik"
clean_url: TRUE
comment_page: 0
cron_key: "zRL-wZQLsgnh0JXkjs3tylUVnkmvFxRwF-tn888nUJJs8"
cron_last: 1324731815
css_js_query_string: "lwpllz"
date_default_timezone: "KOLKATA/"
drupal_http_request_fails: FALSE
And list goes on........... but this list is not so long because drupal sets only some of the variables during installation, rest of the variables are set either when module is enabled or feature is installed.
Drush allows you to filter specific variables. You can filter which variables you want to see by giving part of the variable name as an argument to the command.
$ drush variable-get user
user_admin_role: "2"
user_email_verification: "0"
user_pictures: "1"
user_picture_dimensions: "1024x1024"
user_picture_file_size: "500"
user_picture_style: "userprofile"
user_register: "1"
Above are the variables which are related to user settings like user role, user picture size, user picture style etc..

Setting new values to variables using variable-set


A wide use of  the variable-set command is to  turn on and off Drupal's Maintenance mode. This mode is set through a variable and it is very easy to manipulate its value without having to log in as the administrator and set it in the administration interface. Here is how we can turn on maintenance mode in a Drupal site with a command:
$ drush variable-set maintenance_mode 1
Enter a number to choose which variable to set.
[0] : Cancel
[1] : maintenance_mode (new variable)
maintenance_mode was set to 1. [success]
Again if you want to turn maintenance mode off then you can set value to 0, this will unset the maintenance mode of Drupal site.
Some more variable-set commands:
$ drush variable-set --always-set site_mail "test.gmail@gmail.com"
site_mail was set to test.gmail@gmail.com. [success]
Later i will cover some more tutorials regarding variable-set and other exciting drush features like installing module, packaging module install in make file




I know this site provides quality depending posts and other material, is there any other site which presents these kinds of data in quality?

My spouse and I stumbled over here from a different web address and thought I may as well check things out.
I like what I see so i am just following you.

Look forward to looking into your web page

This paragraph is genuinely a pleasant one it helps new net viewers, who are wishing for blogging.

Great post.

Excellent blog! Do you have any recommendations for aspiring writers?
I'm planning too start my own website soon but I'm a little lost on everything.
Would you suggest starting with a free platform like Wordpress or go for a paid option? There are so many options out therre that
I'm totally oveerwhelmed .. Any suggestions? Bless you!

I used to work on .net for developing Web Pages. But our company recently moved to php because windows are very costly and eating up our profit share. Since Linux servers are less in cost department we were forced to work with Drupal. I learned so much stuff from here. Thank you for your amazing website. Check the following link out. Might come handy!!! Homemade Soda Bottle Sprinkler

Post new comment