CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • extension API for "replace" does not trigger database updates
Pages: [1]

Author Topic: extension API for "replace" does not trigger database updates  (Read 323 times)

SarahG (FountainTribe)

  • Ask me questions
  • ****
  • Posts: 782
  • Karma: 29
  • CiviCRM version: 4.4.7
  • CMS version: Drupal 6, Drupal 7
  • MySQL version: 5.5
  • PHP version: 5.3
extension API for "replace" does not trigger database updates
September 21, 2014, 05:20:39 am
I am using the native extension APIs to update the version of various extensions. My current code is:
 
Code: [Select]
$manager = CRM_Extension_System::singleton()->getManager();
$manager->refresh();
$manager->replace($replace_parm);

But when I go to the page at: http://mygroup.org/civicrm/admin/extensions?reset=1

I get an alert reading "Your extensions require database updates. Please execute the updates."

When I read the code comments for the replace function on GitHub ( https://github.com/civicrm/civicrm-core/blob/4.4/CRM/Extension/Manager.php) I see the following:
  * Install or upgrade the code for an extension -- and perform any
   * necessary database changes (eg replacing extension metadata).
   *

What should I be doing so that the extension database updates get triggered from within my code?
Did I help you? Please donate to the Civi-Make-It-Happen campaign  CiviCRM for mobile devices! 

totten

  • Administrator
  • Ask me questions
  • *****
  • Posts: 695
  • Karma: 64
Re: extension API for "replace" does not trigger database updates
September 21, 2014, 11:10:58 am
Ah, those code comments are bit misleading. Let's rephrase:

  • CRM_Extension_Manager::replace() performs any DB updates for internal state of the extension-manager -- e.g. inserting/updating records in civicrm_extension or resetting cached info about the extension file structure.
  • For DB updates defined by third-party developers (e.g. using hook_civicrm_upgrade or civix's "Upgrader" class to define a custom SQL table), one calls CRM_Extension_Upgrades. In 4.5, this is most easily done with the "Extension.upgrade" API. (I suspect it wouldn't be very hard to backport.)

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • extension API for "replace" does not trigger database updates

This forum was archived on 2017-11-26.