Answers.Body: <p>The extension upgrade command can be executed using API (version 3).</p>
  
  <p>Drush can then be used to execute the command on multiple sites:</p>
  
  <pre><code>drush cvapi Extension.upgrade reset=1 
  </code></pre>
  
  <p>A refresh may be necessary</p>
  
  <pre><code>drush cvapi Extension.refresh 
  </code></pre>
  
  <p>Can anyone else verify this works for extension upgrades that require an update?</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-03-12T15:08:30.530Z
Answers.LastActivityDate: 2019-03-12T15:08:30.530Z
Answers.UserDisplayName: Sleewok
Answers.Body: <p>I think there are 2 steps when upgrading an extension:</p>
  
  <ol>
  <li>upgrade the extension itself (replacing the old version of the files with the new version) . This is done when you hit the upgrade link in the overview of the extensions. That can easily be done manually by downloading the new extension folder and replacing the existing folder in your extension folder</li>
  <li>Executing the extension upgrade actions that are triggered by the functions in the Upgrader class. These are the cases where after installing a new version you get the notice in the top right corner when you navigate to Administer>System Settings>Extensions. There are based on the current value of the column <em>schema_version</em> in the table <em>civicrm_extensions</em>. As your sites have different databases but share the extensions folder this might get a little confusing. I would check what happens with the files in the different databases, it might be that the <em>schema_version</em> gets updated in all your databases. If that is the case you could set the column to the previous version in the DB, that should trigger the extension update function?</li>
  </ol>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-12-17T15:26:09.973Z
Answers.Text: When comparing most of the other DBs, the schema_version is actually NULL for most rows. In fact it is NULL for most extensions, even on the DB that an upgrade/install was originally performed. Any ideas why that might be?
Answers.UserDisplayName: Sleewok
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-12-17T15:51:02.960Z
Answers.Text: The version you see here is NOT about the version of the extension but the version number that is used in the upgrade function of the extension Upgrader class (check https://docs.civicrm.org/dev/en/latest/extensions/civix/#generate-upgrader). So if I want to perform some actions on upgrade like update a table I would for example add a function upgrade_1005() and once you have executed that extension update (in the right top corner, NOT install the latest code) the schema_version in the DB will be 1005.
Answers.UserDisplayName: ErikH - CiviCooP
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-12-12T08:19:47.723Z
Answers.LastActivityDate: 2018-12-12T08:19:47.723Z
Answers.UserDisplayName: ErikH - CiviCooP
Answers.Body: <p>How about make a backup of the extension folder before the first update, then do on site A, then restore the backup folder, then do site B, etc...</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-12-11T21:44:28.453Z
Answers.LastActivityDate: 2018-12-11T21:44:28.453Z
Answers.UserDisplayName: Demerit
Answers.Body: <p>The URL you can use to trigger the extension updates pending:
  https://xxx/wp-admin/admin.php?page=CiviCRM&amp;q=civicrm%2Fadmin%2Fextensions%2Fupgrade&amp;reset=1</p>
  <p>This is useful when the admin status page doesn't load due to a SQL error.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-06-21T12:55:33.340Z
Answers.LastActivityDate: 2022-06-21T13:04:27.130Z
Answers.LastEditDate: 2022-06-21T13:04:27.130Z
Answers.UserDisplayName: Adam
Body: <p><strong>Question:</strong> 
  When upgrading an extension from the UI on Site A it will update the files and run the update hook. How do I <strong>manually</strong> execute the update hook for the extension on the other Site B, C, etc? </p>
  
  <p>The extension directory on our server is shared between all the sites. This means that when I "upgrade" an extension on Site A the files will be updated for all the sites. However, the "update" hook is only executed on Site A. The result is that the extension files are up-to-date for ALL sites and CiviCRM perceives that Site B, C, etc no longer need to update the extension. This means that I cannot execute any update functions. Is there a way to manually trigger the update function?</p>
  
  <p><strong>Configuration Information:</strong></p>
  
  <ul>
  <li>CiviCRM 5.8</li>
  <li>Drupal 7</li>
  <li>Each of our sites has a separate database (they are not shared). </li>
  <li>Each site is configured in drupal_root/sites/subdomain.domain.org</li>
  <li>Extensions are installed in a directory shared by all sites (drupal_root/CustomExtensions).</li>
  </ul>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-12-11T15:05:31.867Z
Comments.Text: Do you mean an uprade from the extension menu (a new version) or the extension upgrades notice? (the little alert box in the top right hand corner when you do Administer>Sytem Settings>Extensions?
Comments.UserDisplayName: ErikH - CiviCooP
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-12-11T17:02:57.123Z
Comments.Text: I am talking about an upgrade from the extensions page to a new version of an extension. The URL I use is: /civicrm/admin/extensions?reset=1
  
  My scenario would also apply to extensions that I pull from Git. I am curious how to initiate the update hook for those as well.
Comments.UserDisplayName: Sleewok
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-12-11T17:10:19.020Z
Comments.Text: I am not clear why you would need the update to be flagged in that way? Do you just want a reminder that there is a new version? But you already know that from your first site? After that you can upgrade "manually" if you want to?
Comments.UserDisplayName: ErikH - CiviCooP
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-12-11T19:09:22.837Z
Comments.Text: Here is how I perceive the update happening. When I click "update" for a particular extension while on the SITE A extension page it will download the new version (which therefore updates the FILES for ALL the sites that share that extension directory). The update process triggers the update hook ONLY on SITE A. Therein lies the problem. Once the files are updated, CiviCRM no longer sees the need to update. I no longer have the option to run "update" on Site B, C, etc. So while the files are up-to-date on all sites, any necessary updates are not run on the other sites. Thanks for your patience!
Comments.UserDisplayName: Sleewok
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-12-11T19:15:40.387Z
Comments.Text: I see where a lot of the confusion was coming from. I updated my initial question to hopefully make it more clear. I never should have used the term "notification". Sorry about that!
Comments.UserDisplayName: Sleewok
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-12-12T01:03:55.417Z
Comments.Text: While there are exceptions, most extension upgrade steps serve to alter the CiviCRM database. As there's only one CiviCRM database even in a Drupal multisite, it is typically not necessary to run upgrades more than once. Could you make this question less theoretical by naming the extension and/or saying more about the purpose of the upgrade step? CiviCRM _can_ be "tricked" into re-running upgrade steps, but the hack will depend on how the extension in question [manages its schema version](https://github.com/totten/civix/blob/master/UPGRADE.md#upgrade-to-v1610-hook_civicrm_postinstall).
Comments.UserDisplayName: universalhandle
Tags: <extension><upgrade><multisite>
Title: How to manually trigger update hook for an extension?
ThreadText: # How to manually trigger update hook for an extension?
  
  (Asked by: username_0 on 2018-12-11)
  
  **Question:**
  When upgrading an extension from the UI on Site A it will update the files and run the update hook. How do I **manually** execute the update hook for the extension on the other Site B, C, etc?
  
  The extension directory on our server is shared between all the sites. This means that when I "upgrade" an extension on Site A the files will be updated for all the sites. However, the "update" hook is only executed on Site A. The result is that the extension files are up-to-date for ALL sites and CiviCRM perceives that Site B, C, etc no longer need to update the extension. This means that I cannot execute any update functions. Is there a way to manually trigger the update function?
  
  **Configuration Information:**
  
  * CiviCRM 5.8
  * Drupal 7
  * Each of our sites has a separate database (they are not shared).
  * Each site is configured in drupal\_root/sites/subdomain.domain.org
  * Extensions are installed in a directory shared by all sites (drupal\_root/CustomExtensions).
  
  **Tags:** extension, upgrade, multisite
  
  > **Comments:**
  > **username_1**: Do you mean an uprade from the extension menu (a new version) or the extension upgrades notice? (the little alert box in the top right hand corner when you do Administer>Sytem Settings>Extensions?  
  > **username_0**: I am talking about an upgrade from the extensions page to a new version of an extension. The URL I use is: /civicrm/admin/extensions?reset=1  My scenario would also apply to extensions that I pull from Git. I am curious how to initiate the update hook for those as well.  
  > **username_1**: I am not clear why you would need the update to be flagged in that way? Do you just want a reminder that there is a new version? But you already know that from your first site? After that you can upgrade "manually" if you want to?  
  > **username_0**: Here is how I perceive the update happening. When I click "update" for a particular extension while on the SITE A extension page it will download the new version (which therefore updates the FILES for ALL the sites that share that extension directory). The update process triggers the update hook ONLY on SITE A. Therein lies the problem. Once the files are updated, CiviCRM no longer sees the need to update. I no longer have the option to run "update" on Site B, C, etc. So while the files are up-to-date on all sites, any necessary updates are not run on the other sites. Thanks for your patience!  
  > **username_0**: I see where a lot of the confusion was coming from. I updated my initial question to hopefully make it more clear. I never should have used the term "notification". Sorry about that!  
  > **username_2**: While there are exceptions, most extension upgrade steps serve to alter the CiviCRM database. As there's only one CiviCRM database even in a Drupal multisite, it is typically not necessary to run upgrades more than once. Could you make this question less theoretical by naming the extension and/or saying more about the purpose of the upgrade step? CiviCRM _can_ be "tricked" into re-running upgrade steps, but the hack will depend on how the extension in question [manages its schema version](https://github.com/totten/civix/blob/master/UPGRADE.md#upgrade-to-v1610-hook_civicrm_postinstall).  
  
  ---
  
  ## 4 answers
  
  ### Answer by username_0 on 2019-03-12. Score: 1 | Accepted answer
  
  The extension upgrade command can be executed using API (version 3).
  Drush can then be used to execute the command on multiple sites:
  drush cvapi Extension.upgrade reset=1 
  
  A refresh may be necessary
  drush cvapi Extension.refresh 
  
  Can anyone else verify this works for extension upgrades that require an update?
  
  
  ---
  
  ### Answer by username_1 on 2018-12-12. Score: 1
  
  I think there are 2 steps when upgrading an extension:
  
  1. upgrade the extension itself (replacing the old version of the files with the new version) . This is done when you hit the upgrade link in the overview of the extensions. That can easily be done manually by downloading the new extension folder and replacing the existing folder in your extension folder
  2. Executing the extension upgrade actions that are triggered by the functions in the Upgrader class. These are the cases where after installing a new version you get the notice in the top right corner when you navigate to Administer>System Settings>Extensions. There are based on the current value of the column *schema\_version* in the table *civicrm\_extensions*. As your sites have different databases but share the extensions folder this might get a little confusing. I would check what happens with the files in the different databases, it might be that the *schema\_version* gets updated in all your databases. If that is the case you could set the column to the previous version in the DB, that should trigger the extension update function?
  
  > **Comments:**
  > **username_0**: When comparing most of the other DBs, the schema_version is actually NULL for most rows. In fact it is NULL for most extensions, even on the DB that an upgrade/install was originally performed. Any ideas why that might be?  
  > **username_1**: The version you see here is NOT about the version of the extension but the version number that is used in the upgrade function of the extension Upgrader class (check https://docs.civicrm.org/dev/en/latest/extensions/civix/#generate-upgrader). So if I want to perform some actions on upgrade like update a table I would for example add a function upgrade_1005() and once you have executed that extension update (in the right top corner, NOT install the latest code) the schema_version in the DB will be 1005.  
  
  ---
  
  ### Answer by username_3 on 2018-12-11. Score: 1
  
  How about make a backup of the extension folder before the first update, then do on site A, then restore the backup folder, then do site B, etc...
  
  
  ---
  
  ### Answer by username_4 on 2022-06-21. Score: 0
  
  The URL you can use to trigger the extension updates pending:
  https://xxx/wp-admin/admin.php?page=CiviCRM&q=civicrm%2Fadmin%2Fextensions%2Fupgrade&reset=1
  
  This is useful when the admin status page doesn't load due to a SQL error.
  
  
  ---
  
  