Take the 2-minute tour ×
Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

There are several variables which we can change through drush vset command like changing the file_temporary_path, maintenance_mode, user_register

I just need to know, how can I know the relevant variable names for which I need to make any changes through drush vset

share|improve this question
add comment

3 Answers

up vote 7 down vote accepted

Variables are saved in the variables table in the database. Every module can define its own variables. It is mostly common that the core and contributed modules save their configuration/settings as variables.

It is also mostly common that the modules add a prefix to their variables, so that you can look at the variables table in your database and search for the related module if they defined any variables.

Another approach would be looking in the source code of the configuration form for the related field. For example for file_temporary_path, you would see:

<input type="text" class="form-text" maxlength="255" size="60" value="/tmp"
name="file_temporary_path" id="edit-file-temporary-path">

Here is the name attribute hints that this configuration field will be saved in file_temporary_path variable.

Moreover, if you have Devel module installed, there is a Variable Editor under the path devel/variable, which lists all the variables defined in your site and gives you the possibility to edit or delete them.

share|improve this answer
add comment

There isn't a list as such, vset simply passes through to variable_set(), which will accept variables with literally any name.

To get the ones set in your current installation you could run this query:

SELECT name FROM variable

But bear in mind that variables can also have a default, and so don't necessarily need to be in the variables table to actually exist and be used in the site.

share|improve this answer
add comment

drush vget will list the names and values of all variables. If you have Features and Strongarm enabled (and you do, of course, you smart developer you), you can also do drush fc variable, which will show you the variable names without values.

But as with Clive's answer, these methods only show you variables which have values saved in the database; if a variable exists for which a value hasn't been saved yet and just the default value in code is being used, there's currently not a smart way for Drupal to know that it exists. D8 fixes this, I believe.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.