Answers.Body: <p>UPDATE: I retired the old PHP script I used, since <code>cv</code> can do the same thing now (but you must have version v0.3.55 or higher):</p>
  <p><code>cv</code> can show you extensions that need upgrading with <code>cv ext:list --upgrade=available</code>.</p>
  <p>Personally I use an <a href="https://github.com/MegaphoneJon/ansible-role-upgrade-civi/" rel="nofollow noreferrer">Ansible script</a> to handle this, but if you have <code>jq</code> and <code>xargs</code> installed, you can run this instead to upgrade every extension:</p>
  <pre><code>cv ext:list --upgrade=available --out=json | jq '.[] | .key' | xargs cv ext:download --force
  </code></pre>
  <p>This is slightly more complicated, but will upgrade all extensions in one shot, which is faster (clear cache/reconcile managed entities only once, instead of between each extension)</p>
  <pre><code>cv ext:list --upgrade=available --out=json | jq '.[] | .key' | tr '\n' ' ' | xargs cv ext:download --force
  </code></pre>
  <p>Don't forget to run <code>cv updb</code> afterwards!</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-03-14T08:50:17.100Z
Answers.Text: that's an answer! thanks a lot
Answers.UserDisplayName: Guillaume Sorel
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-03-14T08:52:11.533Z
Answers.Text: would you update extensions first or upgrade core first? We're writing a shell script to automate for Drupal and you're code will become a part of.
Answers.UserDisplayName: Guillaume Sorel
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-03-14T18:39:45.043Z
Answers.Text: @GuillaumeSorel I recommend reviewing my linked Ansible playbook.  Even if you're not familiar with Ansible it's quite readable, look at the "name" field on each stanza to see what step I'm doing there.
Answers.UserDisplayName: Jon G - Megaphone Tech
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-03-15T09:24:45.110Z
Answers.Text: sure we'll have a serious look!
Answers.UserDisplayName: Guillaume Sorel
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-03-11T16:14:02.643Z
Answers.LastActivityDate: 2024-10-01T15:28:22.410Z
Answers.LastEditDate: 2024-10-01T15:28:22.410Z
Answers.UserDisplayName: Jon G - Megaphone Tech
Answers.Body: <p>I have created the following script to upgrade by just downloading all installed extensions (excluding the standard). It is a bit crude and can probably be improved, but for me it works.</p>
  <pre><code>#/bin/bash
  ### Script to upgrade all extensions excluding the standard
  ### Ed van Leeuwen - webmaster@covs.nl
  ### Compatible with cv 0.3.56+
  
  CIVI_VERSION=`cv vars:show | grep CIVI_VERSION | cut -d'&quot;' -f4`
  echo - Upgrading all extensions of CiviCRM $CIVI_VERSION
  for i in `cv ext:list -i --upgrade=available --columns=key --out=list`
  do
     echo -- Upgrading $i...
     cv dl -f $i &amp;&gt; /dev/null
  done
  cv updb
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-09-23T17:29:17.797Z
Answers.Text: Won't this attempt to update even extensions that don't have an update available?  This can take a very long time because of cache clears.
  
  Fortunately, there's a feature in the very latest version of cv (added 12 days ago) that you can use to fix this.  change `cv ext:list -i` to `cv ext:list -i --upgrade=available`.  Note also that you're not specifying the columns to output, which changes slightly with this release.  It will probably work unchanged, but you may have to change your `cut` command slightly, or explicitly specify which columns you want `cv` to report.
Answers.UserDisplayName: Jon G - Megaphone Tech
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-09-29T15:24:11.647Z
Answers.Text: Thanks, @JonG-MegaphoneTech! Edited the script.
Answers.UserDisplayName: Webmaster COVS
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-09-22T10:05:24.067Z
Answers.LastActivityDate: 2024-09-29T15:33:20.327Z
Answers.LastEditDate: 2024-09-29T15:33:20.327Z
Answers.UserDisplayName: Webmaster COVS
Answers.Body: <p>You will need to update the extension folder and run</p>
  <pre><code>cv ext:upgrade-db
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-03-10T09:16:43.973Z
Answers.Text: Pradeep, this command upgrades the DB but doesn't operate the update of the extensions themselves. We usually perform it after manual update if needed. My concern is the do the update with cv.
Answers.UserDisplayName: Guillaume Sorel
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-03-09T16:03:15.187Z
Answers.LastActivityDate: 2022-03-09T16:03:15.187Z
Answers.UserDisplayName: Pradeep Nayak
Body: <p>Silly question I guess but I can't find in <code>list</code> an option to perform extension update with <code>cv</code>.</p>
  <p>Is that possible?</p>
  <p>EDIT 1: is there a possibility for a <code>ext:update</code> option that would perform individual update such as <code>cv ext:update my-extension</code> or a bulk update <code>cv ext:update all</code>?</p>
  
Tags: <cv>
Title: Is there a cv command to update extensions?
ThreadText: # Is there a cv command to update extensions?
  
  (Asked by: username_0 on 2022-03-09)
  
  Silly question I guess but I can't find in `list` an option to perform extension update with `cv`.
  
  Is that possible?
  
  EDIT 1: is there a possibility for a `ext:update` option that would perform individual update such as `cv ext:update my-extension` or a bulk update `cv ext:update all`?
  
  **Tags:** cv
  
  
  ---
  
  ## 3 answers
  
  ### Answer by username_1 on 2022-03-11. Score: 6 | Accepted answer
  
  UPDATE: I retired the old PHP script I used, since `cv` can do the same thing now (but you must have version v0.3.55 or higher):
  
  `cv` can show you extensions that need upgrading with `cv ext:list --upgrade=available`.
  
  Personally I use an [Ansible script](https://github.com/MegaphoneJon/ansible-role-upgrade-civi/) to handle this, but if you have `jq` and `xargs` installed, you can run this instead to upgrade every extension:
  
  ```
  cv ext:list --upgrade=available --out=json | jq '.[] | .key' | xargs cv ext:download --force
  
  ```
  
  This is slightly more complicated, but will upgrade all extensions in one shot, which is faster (clear cache/reconcile managed entities only once, instead of between each extension)
  
  ```
  cv ext:list --upgrade=available --out=json | jq '.[] | .key' | tr '\n' ' ' | xargs cv ext:download --force
  
  ```
  
  Don't forget to run `cv updb` afterwards!
  
  > **Comments:**
  > **username_0**: that's an answer! thanks a lot  
  > **username_0**: would you update extensions first or upgrade core first? We're writing a shell script to automate for Drupal and you're code will become a part of.  
  > **username_1**: @username_0 I recommend reviewing my linked Ansible playbook.  Even if you're not familiar with Ansible it's quite readable, look at the "name" field on each stanza to see what step I'm doing there.  
  > **username_0**: sure we'll have a serious look!  
  
  ---
  
  ### Answer by username_2 on 2024-09-22. Score: 1
  
  I have created the following script to upgrade by just downloading all installed extensions (excluding the standard). It is a bit crude and can probably be improved, but for me it works.
  
  ```
  #/bin/bash
  ### Script to upgrade all extensions excluding the standard
  ### Ed van Leeuwen - username_2@username_2.nl
  ### Compatible with cv 0.3.56+
  
  CIVI_VERSION=`cv vars:show | grep CIVI_VERSION | cut -d'"' -f4`
  echo - Upgrading all extensions of CiviCRM $CIVI_VERSION
  for i in `cv ext:list -i --upgrade=available --columns=key --out=list`
  do
     echo -- Upgrading $i...
     cv dl -f $i &> /dev/null
  done
  cv updb
  
  ```
  
  > **Comments:**
  > **username_1**: Won't this attempt to update even extensions that don't have an update available?  This can take a very long time because of cache clears.  Fortunately, there's a feature in the very latest version of cv (added 12 days ago) that you can use to fix this.  change `cv ext:list -i` to `cv ext:list -i --upgrade=available`.  Note also that you're not specifying the columns to output, which changes slightly with this release.  It will probably work unchanged, but you may have to change your `cut` command slightly, or explicitly specify which columns you want `cv` to report.  
  > **username_2**: Thanks, @username_1! Edited the script.  
  
  ---
  
  ### Answer by username_3 on 2022-03-09. Score: 0
  
  You will need to update the extension folder and run
  
  ```
  cv ext:upgrade-db
  
  ```
  
  > **Comments:**
  > **username_0**: username_3, this command upgrades the DB but doesn't operate the update of the extensions themselves. We usually perform it after manual update if needed. My concern is the do the update with cv.  
  
  ---
  
  