Drush: UP VS UPC + UPDB + Zelda
Updating your modules and site can be so taxing inside of Drupal, but if you have been dealing with Drupal in the last year or so, you will for sure heard about Drush. Drush is like crack for anyone who uses Drupal, get a taste and you are hooked. As with most things, I like to rush in and I really don't understand all of the aspects of the tools I use sometimes.
Drush seems to be like an old school game of Zelda, push a stone back and find a sword! The problem I was having with Drush is I just wanted to update a module, not all of them, just a couple of them. Sometime fixing something that isn't broken, breaks it. Or maybe I want to update my module first and then worry about core, or I am running PressFlow and want to update core with that when the latest version comes out. I will cover that here.
Updating a module(s) with Drush:
Step 1: Put the site down.
$ drush vset site_offline 1 --always-set
Vset : Set a variable site_offline 1 : 1 will set the site off-line, 0 will set it on-line. --always-set : This will just answer the normal Drush confirmation question. If you don't use this you will get:
Enter a number to choose which variable to set.
[0] : Cancel
[1] : site_offline
You would have to enter "1" for this every time, so the --always-set just does away with this step. So now the site is down.
Step2: Update the Code
So lets say that we want to update one of the best module for dealing with HTML5 video on Drupal, Mediafront, http://drupal.org/project/mediafront, but only this module. (shameless plug, html5 flash fallback, views, presets, cck integration and more)
$ drush upc mediafront
upc : This will update the code for the module. Drush is so nice and smart, it will also backup the current module. Add a -v to the end of your command to see everything in action.
Same as above but with -v
$ drush upc mediafront -v
Sit back and watch the magic.
Step 3: Update the database
$ drush updb
Now Drush will update any database changes if need be.
Step4: Take your site back on-line
$ drush vset site_offline 0 --always-set
Now if you did everything right, you should have updated MediaFront and nothing else. You can combine the updates by just adding a list of modules you want to update.
Example: $ drush upc mediafront flashvideo ubercart
This would update the 3 modules and only those 3 modules.
Now there might be better ways out there, in the future, there is talk about having a way to lock modules down. http://drupal.org/node/446736 But at the time of this post, nothing is yet to be set in stone. Hope that helps, let me know!
Category
- Alethia (1)
- CCK (0)
- Command Line (2)
- Conditional Field (0)
- Drupal (7)
- Drush (2)
- E-Commerce (7)
- Hacks (1)
- Japan (4)
- MediaFront (0)
- Mercury (0)
- Online Media (1)
- Open Source (1)
- Pantheon (0)
- SSL (1)
- Screen-cast (1)
- Tutorial (3)
- Ubercart (2)
- Ubuntu (3)
- VPS.net (0)
- Yen (1)
- Zen-Cart (4)
- cPanel (1)
- i18n (1)
- iPhone (1)
- Free College (0)
twitter/srw2d
- @nicwn It was good this year too http://t.co/69RYMcA9 — 10 weeks 3 days ago
- Being in ubuntu + terminal to Cat Rats by Skrillex just feels so right. — 10 weeks 6 days ago
- Drupal Meetup in Tokyo Tomorrow Night! http://t.co/M6ctJt8A #drupal #japan #allyoucaneatdrink — 11 weeks 2 hours ago
- Just got my Drupal T-Shirt, did you get yours? http://t.co/4PpfETpA — 11 weeks 5 days ago
- Drupal Social Event in Tokyo hope to see everyone out there that can come. http://t.co/z83asRRg — 12 weeks 3 days ago
- 1 of 53
- ››
Recent Hits
Recent
- 1 of 2
- ››




Comments
Send modules to different directory
I have my modules in public_html/my-site.com/profiles/myco/modules/contrib
how can I tell drush to update the modules in that folder instead of the classic sites/all/modules?
thanks for this tut. very easy to understand and useful!
Check this
Check this out:
http://drupal.org/node/371298#comment-2998286
Post new comment