Posted by tsaw on November 7, 2009 at 7:25pm
Hi Chris,
Love the DRUSH tool!
I have been using it as much as I can and each time am finding new things and ways to take advantage of it.
I have a question - concerning the update and updatecode functions. I didn't see any detailed docs on recommended usage on this and was wondering if you or anyone else that is more knowledgeable on it, could show us the proper way to use these functions?
For example do we put the site in maintenance mode, disable modules prior to update, etc.
Thanks so much!
Tim

Comments
update is updatecode +
update is updatecode + updatedb. It only update modules, it doesn't do theme updates or drupal upgrades.
I just use it directly. You can put the site in maintenance mode if you prefer. It doesn't exist a command to put a site in maintenance mode but you can get/set variables with drush:
drush vset site_offline 1DRUSH update
So do you just put the site in maintenance mode then run the DRUSH update command? Then run update.php and go back online?
or do you disable all the modules - then set the theme back to one of the system themes like garland, etc then run the update, etc?
Can you post a step by step description that you use when you run the update command? or updatecode command?
Thanks!
Tim
what I do is just drush
what I do is just
drush update.As I said it does updatecode (download new version of modules) + updatedb (run update.php). I don't use to put the site in maintenance, change the theme or disable modules (what are you going to update if you disable it?). It's not the most secure way but it fits my needs.
THANKS!
Hi Jonhattan,
OK thanks for the feedback. I look forward to using DRUSH to the fullest where ever I can - especially the more I learn about it's features.
Blessings!
Tim
This places the site into
This places the site into maintenance mode, runs updates and brings the site back out.
php drush.php eval "variable_set('site_offline', 1);"drush updatedb
php drush.php eval "variable_set('site_offline', 0);"
Putting the site in maintenance mode isn't a bad idea, especially if you have a custom maintenance page for your theme. Running
drush updatedbnow clears the cache, too, sodrush cache clearisn't necessary.example
Can you give some examples like: drush update ....
Almost everything...
Hello!!
I love drush!! I use it for almost every high level administration tasks: download and enable modules, disable and uninstall modules, update modules, put/drop site in maintenance mode, check DB status, dump/import DB, run cron/update.php/refresh/cache clear, and... upgrade drupal core (yes, I do with some tricky!!)
Some examples:
drush dl cckdrush enable cck
drush crondrush refreshdrush sql dump > mydb.sqldrush sql clidrush cache clearPD: Where should I attach a new function for drush pm? It's a needed function for doing Drupal core upgrade: enabledmodules. This function returns 3rd party (contributed) enabled modules, those that must be disabled before upgrading and reenabled after it.
It does not work the way
It does not work the way advertised, but I use drush with SVN, for example, to download or update CCK:
drush dl cck --destination=home/sites/all/modules/drupal_contrib --version-control=svn --svnsync;Mostly though, I update modules using
drush update, but not if the release notes suggest deleted files. I'd really like to find out more about the use of drush with SVN.Sala kahle,
Grant
How to update drupal core
Hi, can you please share some of your trickery for updating drupal core with drush? do you have a script?
Many Thanks!
-Imre
RE: How to update drupal core
Hi Imre,
Of course I can share this script, but first Drush needs to be updated with the functionality I told before: list the third party enabled modules. Without this, the script is just nothing.
I added this functionallity to my own drush installation, and I did so modifying the drush/commands/pm/pm.drush.inc file. Yes, drush README says this is not a Smart Thing, but it works :)
This modification was done over the pm.drush.inc,v 1.32 2009/05/07 21:56:20 version. The messages and comments on the script are on my language, Catalan. You can edit the script and change them. You can use the script from your drupal base dir or from any other on your system if you provide the drupal dir as first argument (not tested, but I'm sure it works).
What the script does:- Determine actual version of your drupal
- Show Drupal status
- Download latest version from web with drush (unpacked)
- Compare both versions and determine if an update is needed. If not, it exists with exit status 2.
- Put your Drupal on maintenance mode
- Look for third party enabled modules
- Do a DB backup and gzip it
- Do a backup of your actual Drupal dir and tar gzip it
- Disable third party modules
- Remove new Drupal sites directory
- Copy some files and directories from old version to new one maintaining file attributes/permissions (cp -pR): sites, robots.txt and .htaccess (you can add more if you need it editing the script and modifying the variable MAINTAIN_FILES)
- Rename old Drupal dir to its original name appended with the version and the text "-old"
- Rename new Drupal to the name of the old one (replace old with new, and let old there with another name)
- Execute updatedb (update.php) to apply changes due to Drupal update
- Reenable third party modules (only those enabled before beginning)
- Execute updatedb (update.php) to apply changes due to Drupal update related to third party modules
- Put your Drupal on non-maintenance mode
- Show Drupal status again
After each step, the script asks you if you want to continue. This is done with a bash/script function that you can easily modify to fit your needs. I do so because I'm lazy and don't want to check drush and other commands exit status or output: I do so visually each time.
Note: attachments in this site are making me crazy. Spam filter and non-working CAPTCHA system thinks I'm a spammer... I'll do my best.
Rename pm.drush_.inc_.txt to PATH_TO_DRUSH/drush/commands/pm/pm.drush.inc (overwrite or make a diff to see differences and apply them to your pm.drush.inc)
Rename update_drupal.txt to update_drupal (or whatever, but it's not a text file) and make it executable or execute it with bash
That's all!!
Attaching files...
Well, as said, spam filter is making me crazy...
Edit
Arrrrggghhh!! Hate this.
Where can I upload these files? I can't do this here. No way. No best.
Final Edit
Well, with a little bit of imagination, I finally could upload the files :)
RE: How to update drupal core
That's a very thorough method, thanks for sharing.
I have a question. If you do not need to be so rigorous, because you're in offline mode, can you bypass the effort of disabling and enabling modules while updating drupal core? I have followed this simple method with success:
http://studioandrew.com/node/1838
Thanks!
RE: How to update drupal core
Hi knausz,
The script follows steps in UPGRADE.txt . If it's wrong, Drupal core developers are wrong... Just take a look at it. And, of course, if the script does it for you and you don't need to care about it, ¿where's the problem? Is because you dont' want to add the extra functionality to drush?
See you!!
emi
no problems
Hi emi,
I have no problems, and adding the extra functionality is good. I'm just lazy. But I ran into a problem with the lazy method with Drupal 5. JQuery update will not be done correctly. This module needs the jquery.js file copied over and it also needs the module to be disabled and enabled when the new version of Drupal is installed. Otherwise, jquery will break on your site. Drupal core developers were right... who would have thought?
Thanks,
Imre
jQuery Update is definitely
jQuery Update is definitely an exception since the Drupal 5 version can't benefit from the new theming system. The D6 version does, though, and can be upgraded successfully with Drush.
I suggest downloading the latest Drush
New drush release(s) are out, and fix some issues I experienced. I suggest updating your Drush software.
Chris Charlton, Author & Drupal Community Leader, Enterprise Level Consultant
I teach you how to build Drupal Themes http://tinyurl.com/theme-drupal and provide add-on software at http://xtnd.us
how to check version
Is there any way to check my installed drush version.?
By the way I forgot where did I install drush , I have no idea where is it either?
How to find drush file
On unix:
locate drush | grep 'drush$'
or
find / -name drush -print
On Windows use Search on "drush"
For version, I recommend upgrading.
Corrections:
Alternatively, find the download tar file which has the version in the filename.
The below is how I install drush.
Find the folder that resulted when untarring
and it will have the version number in the folder name.
Peter
LA's Open Source User Group Advocate - Volunteer at DrupalCamp LA and SCALE
drush version is writen in Readme
thanks...
First line of readme includes version.
inside README.txt
// $Id: README.txt,v 1.25 2009/06/04 03:10:41 weitzman Exp $
I wish you could do drush
I wish you could do drush --version, (you can't as of drush 3.3), but on my system I can do:
cat `locate drush.info`If you have multiple versions installed, you'll have to use
which drushto sort out which one you are using.
never mind, I just found
never mind, I just found http://drupal.org/node/683942 which states you can do
drush status version* deleting my own post *