I'm a rank Drush beginner, and I'm no Drupal power-user for that matter.
Usually, when I update a module, I go through a procedure vaguely like this:
* make sure db is backed up
* put site in maint mode
* disable the module
* remove the old module's directory in /sites/all/modules/
* put in the new module's directory in /sites/all/modules/
* re-enable the module
* run update.php
* take site out of maint mode
I just downloaded Drush 2.0, and I had a notice that my CCK module needed to be updated from 6x.2.3 to 6x.2.4.
With Drush, all I did (after making sure I had a current backup) was:
>drush dl cck
>drush update
And it looks like everything is fine! Is it really that easy? Was it not necessary to put the site in maint mode? And what did drush do with my old CCK directory?
Thanks for the info. -Steve
Comments
Comment #1
kscheirerthat sounds about right. Drush overwrote the old cck module with the new files, in the same directory. If you like, Drush can be configured to backup your old module first, moving it to a backups/ directory.
you can start right off with
drush update
, it will figure out that (for examlple) cck needs to be updated, and then prompt you for permission to do so.Comment #2
steve02476 CreditAttribution: steve02476 commentedWow, that's too cool!
So as long as I start out with a backup of my db and sites folder before doing
drush update
this means I don't have to worry about all the downloading and disabling and moving directories in and out and re-enabling and running update.php?It seems like there have to be some gotchas somewhere?
Comment #3
moshe weitzman CreditAttribution: moshe weitzman commenteddrush does code backup for you. see the /backup dir. it can alternatively integrate with your svn if desired ... use `drush sql dump` beforehand and you are good to go. no gotchas.
Comment #4
steve02476 CreditAttribution: steve02476 commentedOK - true newbie warning here!
if you do
drush sql dump
the entire contents of the database just gets puked onto the console while you watch until you finally get brave enough to hit control-c . (I hope that was the right thing to do.)I'm sure the right thing to do is to use a
>
to send the output to a file instead...But, at any rate, I already have the backupmigrate module to do sql backups for me, and I'm just in heaven about Drush.
Thanks to the people who put together and maintain Drush!
Comment #5
chrowe CreditAttribution: chrowe commentedThe command I use is:
drush sql dump > /path/to/BACKUPS/site_name-$(date +%Y-%m-%d-%H.%M.%S).sql
This dump database with time stamp
Chris
Comment #7
OldAccount CreditAttribution: OldAccount commentedHow do you configure Drush to backup the modules automatically? So far with my default install I don't see any backups directory.
Comment #8
boabjohn CreditAttribution: boabjohn commentedSorry; have been through a fair bit of the documentation, but a couple of more obvious points elude me:
1. I separate contrib modules from custom > sites/all/modules/contriband sites/all/modules/custom
When I run drush dl date, it pops the date module into the modules/. directory
How was I supposed to specify my desired path?
2. Likewise (probably related) when I ask drush for a status, it is giving me only details on the core.
3. Running drush update seems like it will update core as well as modules. Is there a way to ask for just the modules and leave core for later?
Thanks.
Comment #9
boabjohn CreditAttribution: boabjohn commentedComment #10
boabjohn CreditAttribution: boabjohn commentedApologies to the wizards: I'm still fumbling around here with the basic configs.
Can anyone advise the solution in (1) of #8 above? I *really* want to have Drush respect my directory structure. I looked through the *.inc files, and the drush.php, but haven't found a solution yet. I'm sure this is a simple matter: if someone gives me a pointer I'll happily add a bit of write-up to the documentation!
>>Okay: watching a very helpful screencast, I see the switch needed is --destination=(path)
So, the more specific query now is: can I pop this parameter into something in my drush installation so that I don't have to type it every time?
Thanks,
JB
Comment #11
flickerfly CreditAttribution: flickerfly commentedto #5
You could easily setup a cron job that would run the command below at a frequency of your choice.
~/bin/drush sql dump > ~/backups/site_name-$(date +%Y-%m-%d-%H.%M.%S).sql
Alternately, you could use the backup_migrate module.
Comment #12
greg.1.anderson CreditAttribution: greg.1.anderson commented#8 was fixed in #652318: Look for contrib directory in modules and themes. I don't think there are any other issues here.
Comment #13
artol CreditAttribution: artol commentedIs it possible to run drush so, that it updates all modules, but does not update themes? I have made changes to theme on one site. I am quite new with drush, so sorry, if this is 'well known answer'. Thank you for any information, Arto
Comment #14
moshe weitzman CreditAttribution: moshe weitzman commentedthere are many theme related issues out there. please talk in one of them. update command has known problem in the area you describe.
Comment #15
StephenRobinson CreditAttribution: StephenRobinson commentedIt is easier to just browse to the folder where the module is installed and not provide any directory information...
Comment #16
jwmci CreditAttribution: jwmci commentedOn which system do I install drush — my computer or the host? If I install it on my system, how do I point it to the host system?
Comment #17
flickerfly CreditAttribution: flickerfly commented@jwmci:
You'd install drush on the server. It will do edits to both the code and the database (running db updates). The assumption is that you have ssh access to your server and, as a result, have command-line access.
In the future, it is appropriate to start a new question as a new issue, especially since this one is already closed. Being closed means it isn't likely to catch much attention so it is somewhat fortunate that I happened through. This way each issue can keep a single thread of discussion providing greater organization for those looking for information in the future. The forums and irc are also appropriate places to ask support related questions. IRC is especially likely to get you faster responses.
Comment #18
AlxVallejo CreditAttribution: AlxVallejo commentedThis doesn't make sense. A drush up command updates all modules as well as the database. AFAIK, you can't update an individual module on the command line.
Comment #19
GuyRus CreditAttribution: GuyRus commentedYou can update a module from the command line:
2 ways:
drush pm-update modulename
drush dl modulename && drush updb
I personally prefer the second as it's far far quicker (pm-update checks all avail updates each time it's run).
For Multisite installation:
drush @sites pm-update modulename
drush dl modulename && drush @sites updb
As a side-note, you must have Update installed (it's a core module) and depending on server config run Drush as a sudo user.
Comment #20
ajuris CreditAttribution: ajuris commentedWhat if I only wanted to update modules on the development subdomain, which is a copy of the production site?
I need to try this for testing purposes...I inherited a site that hasnt been updated in a while and the reason cited is that alot of custom modifications have been made and updating would crash the site or at least get rid of the 'custom' modifications.
Comment #21
helmo CreditAttribution: helmo commentedDrush has moved to Github.
Please ask support questions on Drupal Answers.