2

I am looking to upgrade an extension - for now I have been updating extensions by disabling - then uninstalling the old extension - and then installing and enabling the new extension. While that has worked for the most part, when I was going to upgrade Mosaico, I was worried if by using my typical method - I would lose all the templates I created. With that being said - is there a better way to upgrade the extension - and if I do what I typically do, will I loose any data?

7

Its a bad idea of upgrading as uninstall and install new version of extension. You can upgrade the extension either one of the following two ways:

  1. If the extension is listed under CiviCRM extension page with auto-download as true then under CiviCRM extension page of your site you should be able to see an option for updating the extension(if option not available than make sure you have Resource URL set for extension correctly, CURL, WGET, ZIP extension installed on server).

  2. You can also upgrade the extension manually by replacing the extension folder/files and then visit CiviCRM extension page in your site and click on refresh button. If the new extension requires db changes than you will be prompted with an option on top right of the browser to run db upgrade. Run the upgrade and its ready for use.

CiviCRM stores extension settings in civicrm_setting and civicrm_managed table. But some extension have their own install code to store data in various table, uninstalling the extension will lead to loss of such data as incase of mosaico extension. It is recommended to follow upgrade pattern for upgrading any extension.

Note: Always take backup of db and files before performing upgrade.

HTH

Pradeep

  • Thank you @Pradeep for explaining in such detail. I did visit the documentation - but your answer was much more detailed. Your #1 is my standard approach when it comes to upgrading extensions - but the extensions I mentioned are not built into the plugins directory. Your Answer #2 should be added to the documentation. – themak Feb 8 '18 at 15:51
1

based on this https://docs.civicrm.org/sysadmin/en/latest/customize/extensions/#upgrading-extensions you are correct that an uninstall will remove any data related to that extension.

That url also has instructions for how to upgrade extensions via the admin GUI. I usually prefer command line solutions but for Civi extensions I always use the GUI.

Extensions can store data in a bunch of different places, but looking at an old copy of the extension I have accessible, in the sql directory in the mosaico extension, the install file creates two tables civicrm_mosaico_msg_template and civicrm_mosaico_template and the uninstall file deletes those tables.

0

Agreed with first answer. Also, extension data normally stores in civicrm_extension. You can find information 'is_active' 0 or 1 whether it is inactive or active.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.