What's your favorite use of Drush vset?

Events happening in the community are now at Drupal community events on www.drupal.org.
traviscarden's picture

The more I learn to do with Drush, the more efficient I become. One trick that's saved me a lot of time is setting certain Drupal variables with the vset command instead of clicking through the standard admin interface—for example, putting the site in maintenance mode by setting site_offline to 1. Here are four variables I find useful to set via Drush. What are everyone else's favorites?

Variable Setting Possible Values
clean_url Clean URLs 0 - Disabled
1 - Enabled
preprocess_css Optimize CSS files 0 - Disabled
1 - Enabled
preprocess_js Optimize JavaScript files 0 - Disabled
1 - Enabled
site_offline Site status 0 - Online
1 - Offline

Edit: Attached is a pretty little printable cheatsheet of my favorites, for anyone who would like it.

AttachmentSize
Useful Drupal 6 Variables.pdf177.61 KB

Comments

theme changing

justintime's picture

If your theme is borked, you can reset back to Garland with:

drush vset theme_default garland
drush vset admin_theme garland

slightly off topic

squaretone's picture

but... I thought I would post this for people using a drush alias to run drush remotely on a server that uses a key for authentication instead of user/pass - like amazon ec2. I had to google around a bit to track this down.

Here's an example setup in my alias file (located in ~/.drush/aliases.drushrc.php):

<?php

$aliases
['example.com'] = array (
 
'root' => '/var/www',
 
'uri' => 'example.com',
 
'remote-host' => 'example.com',
 
'remote-user' => 'ubuntu',
 
'ssh-options' => '-i ~/.ec2/yourkeyname.pem',
);

?>

Now you can do something like this from your local machine to affect your live remote site:

drush @example.com vset preprocess_css 0

I love drush

Awesome stuff! Came just in

Aniara.io's picture

Awesome stuff! Came just in the right time. :)

I love drush even more now.

Mod parent up

Ryan Weal's picture

I'm definitely a huge fan of the vset commands. Having recently enabled mod_deflate to gzip most/all of my apache traffic I updated my scripts to enforce preprocess_css 1, preprocess_js 1, cache 1 and page_compression 0 for all sites. Handy.

Of course I would wrap that in site_enabled 1 and site_enabled 0 if I'm doing any serious work in my scripting.

Side note: enabling mod_deflate was a huge performance win. Drush helping me make all of the sites play well with it was a huge bonus.

Useful in conjunction with

mrfelton's picture

Useful in conjunction with pipe and grep - for example, to find where a module has stored a hardcoded path to something that may have changed. Like, if you had the getid3 library installed in sites/all/libraries, and decided to move it to profiles/myprofile/libraries.

drush vget | grep 'all/libraries'

--
Tom
www.systemseed.com - drupal development. drupal training. drupal support.

how do you vset a variable

patoshi's picture

how do you vset a variable that is inside a nested array?

drush vset foo[bar][0]

???

I don't think you can set

greggles's picture

I don't think you can set complex variables like that, but you can always do:

  drush php-eval "variable_set(array('foo' => array('bar' => 0)));"

The help for vget recently

moshe weitzman's picture

The help for vget recently added examples of setting complex values http://www.drush.org/help/5#variable-set.

My favorite is on emergency

jonhattan's picture

My favorite is on emergency :p

Yesterday I was called because a site had a high load (system load in 60!). As soon as I could access via ssh just set aggresive cache + 5 minutes in cache with:

drush vset cache 2
drush vset cache_lifetime 300

then it was workable to do other optimizations.

PS. on a 2nd thought: same thing can be done quicker by editing settings.php

thanks!... nice tip.. now i

patoshi's picture

thanks!... nice tip.. now i know about "aggressive cache" - A cache which skips the boot and exit of a drupal system.

Disable email notifications about module updates

fahadurrehman's picture

How can we disable module update notifications emails through vset. We can remove email id from /admin/reports/updates/settings

Drupal Nebraska Group

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: