Answers.Body: <p>You can get a list of Civi-related Drush commands simply by typing <code>drush</code> on the command line. Excerpt:</p>
  
  <pre><code>All commands in civicrm: (civicrm)
  civicrm-api (cvapi)         CLI access to CiviCRM APIs. It can return pretty-printor json formatted data.                                                                
  civicrm-enable-debug        Enable CiviCRM Debugging.                                                                                                                    
  civicrm-ext-disable (ced)   Disable a CiviCRM extension.                                                                                                                                                                                                                                                                           
  civicrm-ext-install (cei)   Install a CiviCRM extension.                                                                                                                                                                                                                                                                            
  civicrm-ext-list (cel)      List of CiviCRM extensions enabled.                                                                                                                                                                                                                                                                   
  civicrm-ext-uninstall (ceui)Uninstall a CiviCRM extension.                                                                                                                                                                                                                                                                     
  civicrm-install             Install a new instance of CiviCRM.                                                                                                                                                                                                                                                                    
  civicrm-member-records      Run the CiviMember UpdateMembershipRecord cron (civicrm-member-records).                                                                                                                                                                                                                                 
  civicrm-process-mail-queue  Process pending CiviMail mailing jobs.                                                                                                                                                                                                                                                                
  civicrm-rest (cvr)          Rest interface for accessing CiviCRM APIs. It can return xml or json formatted data.                                                         
  civicrm-restore             Restore CiviCRM codebase and database back from the specified backup directory.                                                              
  civicrm-sql-cli (cvsqlc)    Open a SQL command-line interface using CiviCRM's credentials.                                                                                                                                                                                                                                      
  civicrm-sql-conf            Print CiviCRM database connection details.                                                                                                   
  civicrm-sql-connect         A string for connecting to the CiviCRM DB.                                                                                                   
  civicrm-sql-dump            Exports the CiviCRM DB as SQL using mysqldump.                                                                                               
  civicrm-sql-query           Execute a query against the CiviCRM database.                                                                                                
  civicrm-update-cfg (cvupcfg)Update config_backend to correct config settings, especially when the CiviCRM site has been cloned / migrated.                                                                                                                                                                                           
  civicrm-upgrade (cvup)      Replace CiviCRM codebase with new specified tarfile and upgrade database by executing the CiviCRM upgrade process - civicrm/upgrade?reset=1.                                                                                                                                                          
  civicrm-upgrade-db (cvupdb) Execute the civicrm/upgrade?reset=1 process from the command line.                                                                           
  </code></pre>
  
  <p>Personally I usually download the tarfile manually, replace the <code>civicrm</code> directory in the modules folder (backing up as needed, e.g. <code>drush civicrm-sql-dump &gt; ~/filename.sql</code>) and then use <code>drush cvupdb</code> to run the database upgrade.</p>
  
  <p>Practice on a dev server first, though! :)</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-02-05T03:35:26.987Z
Answers.Text: Thanks, this should be the accepted answer, it is super easy and straightforward.
Answers.UserDisplayName: DrCord
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-08-20T16:45:07.917Z
Answers.Text: So if I understand it correctly, I would need to download the latest version of CiviCRM and then run this command `drush civicrm-upgrade --tarfile=~/civicrm-4.6.7-drupal.tar.gz`.  Is that right?
Answers.UserDisplayName: William Mortada
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-08-20T17:13:20.130Z
Answers.Text: Looks right to me, but as I said I usually use a variation with portions done manually. Post back if this works as you expected!
Answers.UserDisplayName: Laryn
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-08-21T11:58:14.417Z
Answers.Text: Yes, but it wasn't completely straightforward.  I'll post a full answer with more detail.
Answers.UserDisplayName: William Mortada
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-08-20T15:51:23.180Z
Answers.LastActivityDate: 2015-08-20T16:06:45.883Z
Answers.LastEditDate: 2015-08-20T16:06:45.883Z
Answers.UserDisplayName: Laryn
Answers.Body: <p>another helpful thing that I do when using drush for civi upgrades:
  since drush does not give you any information about where in the process the upgrade is (the GUI has the progress bar that says what version it is at) I open another ssh session to the server and use <code>drush civicrm-sql-cli</code> to get into the sql console with the right database. Then as the upgrade runs in one terminal I repeatedly run the following query to follow the progress -- especially in upgrades that span multiple versions:</p>
  
  <pre><code>select version from civicrm_domain;
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-04-16T18:58:48.060Z
Answers.LastActivityDate: 2017-04-18T14:34:01.427Z
Answers.LastEditDate: 2017-04-18T14:34:01.427Z
Answers.UserDisplayName: ericG
Answers.Body: <p>I use the following for Drupal 7 which I find a straightforward process:</p>
  <p>(I do this on a development copy of the site first to check for issues)</p>
  <ol>
  <li>cd public_html/sites/all/modules  // go to modules folder for site</li>
  <li>wget <a href="https://download.civicrm.org/latest/civicrm-STABLE-drupal.tar.gz" rel="nofollow noreferrer">https://download.civicrm.org/latest/civicrm-STABLE-drupal.tar.gz</a>  //get latest</li>
  <li>drush vset maintenance_mode 1  //put site into maintenance_mode</li>
  <li>rm -rf civicrm  //delete civi (make sure you are logged in!)</li>
  <li>tar -xvzf civicrm-STABLE-drupal.tar.gz  //extract Civi</li>
  <li>rm civicrm-STABLE-drupal.tar.gz  //delete tarball</li>
  <li>cv upgrade:db //upgrade civi db or use drush civicrm-upgrade-db</li>
  <li>cv flush //flush system files</li>
  <li>drush vset maintenance_mode 0 //put site online</li>
  </ol>
  <p>I know you asked for Drush commands but I thought I would add my process as it may be helpful to others. It uses a mixture of drush and cv. cv is a Civi command line utility like drush and is easy to install. If you can install drush you can certainly install cv. Get it from <a href="https://github.com/civicrm/cv" rel="nofollow noreferrer">https://github.com/civicrm/cv</a>.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-01-20T09:56:45.043Z
Answers.Text: Thanks! This is an old question. At the time I was trying to understand if the process could be completed just using `drush`. However, a different (and possibly more useful?) question would be 'How can I upgrade CiviCRM on Drupal'. In which case your answer would certainly make sense.
Answers.UserDisplayName: William Mortada
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-01-20T08:59:46.407Z
Answers.LastActivityDate: 2021-01-21T07:55:15.987Z
Answers.LastEditDate: 2021-01-21T07:55:15.987Z
Answers.UserDisplayName: Ben
Answers.Body: <p>we have our own shell script for both Drupal and Wordpress that automatize everything and takes less than 10&quot; to upgrade CiviCRM. It was inspired amongst other sources by this post.</p>
  <p>The script has been developed for Plesk but it's easy to modify: <a href="https://github.com/allinappli/UpdateCiviSh" rel="nofollow noreferrer">see on our Github</a></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-08-10T07:36:42.553Z
Answers.Text: Thanks for sharing
Answers.UserDisplayName: William Mortada
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-08-10T07:33:48.927Z
Answers.LastActivityDate: 2022-08-10T07:33:48.927Z
Answers.UserDisplayName: Guillaume Sorel
Answers.Body: <p>To answer my own question, it is possible to update CiviCRM with drush but this isn't completely straightforward either.  For the benefit of others I post the steps I took below.</p>
  <p>These steps must be executed in the root directory of Drupal:</p>
  <ol>
  <li>put the site into maintenance mode: <code>drush vset maintenance_mode 1</code></li>
  <li>clear all caches: <code>drush cc all</code></li>
  <li>take a full backup of site and test that this works on a development server</li>
  <li>upgrade CiviCRM: <code>drush cvup --tarfile=&lt;path to tarfile&gt; --backup-dir=&lt;path to backup dir&gt;</code></li>
  <li>upload the latest version of the localisation files and extract to <code>sites/all/modules/civicrm/l10n</code></li>
  <li>delete contents of <code>sites/default/files/civicrm/templates_c/</code></li>
  <li>take the site out of maintenance mode:<code>drush vset maintenance_mode 0</code></li>
  <li>clear all caches: <code>drush cc all</code></li>
  </ol>
  <p>Notes:</p>
  <ul>
  <li>I was upgrading from CiviCRM 4.6.6 to 4.6.7.  If you are upgrading from an older version you may find that there are more steps.</li>
  <li>The first time I tried to upgrade at step 4 this resulted in an error <code>'Your database has already been upgraded to CiviCRM 4.6.6'</code> (note that I was trying to upgrade to 4.6.7). Repeating this step resulted in success. This bug appears to have <a href="https://issues.civicrm.org/jira/browse/CRM-16972" rel="nofollow noreferrer">been fixed</a>.</li>
  <li>It may be easier to manually delete and replace the <code>civicrm</code> folder <a href="https://civicrm.stackexchange.com/questions/4829/is-it-easy-to-upgrade-civicrm-using-drush/4830#4830">as Laryn suggests</a>.</li>
  <li>I'm not sure if step 6 is really necessary.</li>
  </ul>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-08-31T15:10:27.377Z
Answers.Text: Yeah, this looks more complicated than Laryn's approach (which I also use). i.e. use drush for the civicrm db update, but not for replacing the code. The drush civicrm db update is definitely worthwhile (before I used it, i'd often get breakage due to some smarty template, using means the db updates can get done without actually trying to generate any pages, which makes a lot of sense).
Answers.UserDisplayName: Alan Dixon
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2015-08-21T12:32:49.543Z
Answers.LastActivityDate: 2021-04-29T08:06:54.200Z
Answers.LastEditDate: 2021-04-29T08:06:54.200Z
Answers.UserDisplayName: William Mortada
Body: <p>The standard upgrade process for CiviCRM is quite a complex process according to the <a href="http://wiki.civicrm.org/confluence/display/CRMDOC/Upgrading+CiviCRM+for+Drupal+7">instructions in the wiki</a>.</p>
  
  <p>Is it easier to use drush to upgrade CiviCRM?  If so, how do you do this?  I couldn't find any up to date documentation on this, so if you are able to point me in the right direction that would be greatly appreciated.</p>
  
  <p>Thanks for your help.</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-11-29T17:13:14.620Z
Comments.Text: Since I posted this, the documentation has been updated and moved to: https://docs.civicrm.org/sysadmin/en/latest/upgrade/drupal7/
Comments.UserDisplayName: William Mortada
Tags: <drupal><upgrade><drush>
Title: Is it easy to upgrade CiviCRM using drush?
ThreadText: # Is it easy to upgrade CiviCRM using drush?
  
  (Asked by: username_0 on 2015-08-20)
  
  The standard upgrade process for CiviCRM is quite a complex process according to the [instructions in the wiki](http://wiki.civicrm.org/confluence/display/CRMDOC/Upgrading+CiviCRM+for+Drupal+7).
  
  Is it easier to use drush to upgrade CiviCRM? If so, how do you do this? I couldn't find any up to date documentation on this, so if you are able to point me in the right direction that would be greatly appreciated.
  
  Thanks for your help.
  
  **Tags:** drupal, upgrade, drush
  
  > **Comments:**
  > **username_0**: Since I posted this, the documentation has been updated and moved to: https://docs.civicrm.org/sysadmin/en/latest/upgrade/drupal7/  
  
  ---
  
  ## 5 answers
  
  ### Answer by username_0 on 2015-08-21. Score: 17 | Accepted answer
  
  To answer my own question, it is possible to update CiviCRM with drush but this isn't completely straightforward either. For the benefit of others I post the steps I took below.
  
  These steps must be executed in the root directory of Drupal:
  
  1. put the site into maintenance mode: `drush vset maintenance_mode 1`
  2. clear all caches: `drush cc all`
  3. take a full backup of site and test that this works on a development server
  4. upgrade CiviCRM: `drush cvup --tarfile= --backup-dir=`
  5. upload the latest version of the localisation files and extract to `sites/all/modules/civicrm/l10n`
  6. delete contents of `sites/default/files/civicrm/templates_c/`
  7. take the site out of maintenance mode:`drush vset maintenance_mode 0`
  8. clear all caches: `drush cc all`
  
  Notes:
  
  * I was upgrading from CiviCRM 4.6.6 to 4.6.7. If you are upgrading from an older version you may find that there are more steps.
  * The first time I tried to upgrade at step 4 this resulted in an error `'Your database has already been upgraded to CiviCRM 4.6.6'` (note that I was trying to upgrade to 4.6.7). Repeating this step resulted in success. This bug appears to have [been fixed](https://issues.civicrm.org/jira/browse/CRM-16972).
  * It may be easier to manually delete and replace the `civicrm` folder [as username_1 suggests](https://civicrm.stackexchange.com/questions/4829/is-it-easy-to-upgrade-civicrm-using-drush/4830#4830).
  * I'm not sure if step 6 is really necessary.
  
  > **Comments:**
  > **username_6**: Yeah, this looks more complicated than username_1's approach (which I also use). i.e. use drush for the civicrm db update, but not for replacing the code. The drush civicrm db update is definitely worthwhile (before I used it, i'd often get breakage due to some smarty template, using means the db updates can get done without actually trying to generate any pages, which makes a lot of sense).  
  
  ---
  
  ### Answer by username_1 on 2015-08-20. Score: 9
  
  You can get a list of Civi-related Drush commands simply by typing drush on the command line. Excerpt:
  All commands in civicrm: (civicrm)
  civicrm-api (cvapi)         CLI access to CiviCRM APIs. It can return pretty-printor json formatted data.                                                                
  civicrm-enable-debug        Enable CiviCRM Debugging.                                                                                                                    
  civicrm-ext-disable (ced)   Disable a CiviCRM extension.                                                                                                                                                                                                                                                                           
  civicrm-ext-install (cei)   Install a CiviCRM extension.                                                                                                                                                                                                                                                                            
  civicrm-ext-list (cel)      List of CiviCRM extensions enabled.                                                                                                                                                                                                                                                                   
  civicrm-ext-uninstall (ceui)Uninstall a CiviCRM extension.                                                                                                                                                                                                                                                                     
  civicrm-install             Install a new instance of CiviCRM.                                                                                                                                                                                                                                                                    
  civicrm-member-records      Run the CiviMember UpdateMembershipRecord cron (civicrm-member-records).                                                                                                                                                                                                                                 
  civicrm-process-mail-queue  Process pending CiviMail mailing jobs.                                                                                                                                                                                                                                                                
  civicrm-rest (cvr)          Rest interface for accessing CiviCRM APIs. It can return xml or json formatted data.                                                         
  civicrm-restore             Restore CiviCRM codebase and database back from the specified backup directory.                                                              
  civicrm-sql-cli (cvsqlc)    Open a SQL command-line interface using CiviCRM's credentials.                                                                                                                                                                                                                                      
  civicrm-sql-conf            Print CiviCRM database connection details.                                                                                                   
  civicrm-sql-connect         A string for connecting to the CiviCRM DB.                                                                                                   
  civicrm-sql-dump            Exports the CiviCRM DB as SQL using mysqldump.                                                                                               
  civicrm-sql-query           Execute a query against the CiviCRM database.                                                                                                
  civicrm-update-cfg (cvupcfg)Update config_backend to correct config settings, especially when the CiviCRM site has been cloned / migrated.                                                                                                                                                                                           
  civicrm-upgrade (cvup)      Replace CiviCRM codebase with new specified tarfile and upgrade database by executing the CiviCRM upgrade process - civicrm/upgrade?reset=1.                                                                                                                                                          
  civicrm-upgrade-db (cvupdb) Execute the civicrm/upgrade?reset=1 process from the command line.                                                                           
  
  Personally I usually download the tarfile manually, replace the civicrm directory in the modules folder (backing up as needed, e.g. drush civicrm-sql-dump > ~/filename.sql) and then use drush cvupdb to run the database upgrade.
  Practice on a dev server first, though! :)
  
  > **Comments:**
  > **username_0**: So if I understand it correctly, I would need to download the latest version of CiviCRM and then run this command `drush civicrm-upgrade --tarfile=~/civicrm-4.6.7-drupal.tar.gz`.  Is that right?  
  > **username_1**: Looks right to me, but as I said I usually use a variation with portions done manually. Post back if this works as you expected!  
  > **username_0**: Yes, but it wasn't completely straightforward.  I'll post a full answer with more detail.  
  > **username_2**: Thanks, this should be the accepted answer, it is super easy and straightforward.  
  
  ---
  
  ### Answer by username_3 on 2017-04-16. Score: 2
  
  another helpful thing that I do when using drush for civi upgrades:
  since drush does not give you any information about where in the process the upgrade is (the GUI has the progress bar that says what version it is at) I open another ssh session to the server and use drush civicrm-sql-cli to get into the sql console with the right database. Then as the upgrade runs in one terminal I repeatedly run the following query to follow the progress -- especially in upgrades that span multiple versions:
  select version from civicrm_domain;
  
  
  ---
  
  ### Answer by username_4 on 2021-01-20. Score: 2
  
  I use the following for Drupal 7 which I find a straightforward process:
  
  (I do this on a development copy of the site first to check for issues)
  
  1. cd public\_html/sites/all/modules // go to modules folder for site
  2. wget <https://download.civicrm.org/latest/civicrm-STABLE-drupal.tar.gz> //get latest
  3. drush vset maintenance\_mode 1 //put site into maintenance\_mode
  4. rm -rf civicrm //delete civi (make sure you are logged in!)
  5. tar -xvzf civicrm-STABLE-drupal.tar.gz //extract Civi
  6. rm civicrm-STABLE-drupal.tar.gz //delete tarball
  7. cv upgrade:db //upgrade civi db or use drush civicrm-upgrade-db
  8. cv flush //flush system files
  9. drush vset maintenance\_mode 0 //put site online
  
  I know you asked for Drush commands but I thought I would add my process as it may be helpful to others. It uses a mixture of drush and cv. cv is a Civi command line utility like drush and is easy to install. If you can install drush you can certainly install cv. Get it from <https://github.com/civicrm/cv>.
  
  > **Comments:**
  > **username_0**: Thanks! This is an old question. At the time I was trying to understand if the process could be completed just using `drush`. However, a different (and possibly more useful?) question would be 'How can I upgrade CiviCRM on Drupal'. In which case your answer would certainly make sense.  
  
  ---
  
  ### Answer by username_5 on 2022-08-10. Score: 1
  
  we have our own shell script for both Drupal and Wordpress that automatize everything and takes less than 10" to upgrade CiviCRM. It was inspired amongst other sources by this post.
  
  The script has been developed for Plesk but it's easy to modify: [see on our Github](https://github.com/allinappli/UpdateCiviSh)
  
  > **Comments:**
  > **username_0**: Thanks for sharing  
  
  ---
  
  