Is there a way to automatically install and enable CiviCRM extensions? Is it possible to do this via drush on a Drupal install for example? Or is use if the UI required?
3 Answers
The cv cli tool provides the following commands for working with extensions:
ext:disable Disable an extension
ext:download Download and enable an extension
ext:enable Enable an extension
ext:uninstall Uninstall an extension and purge its data
ext:upgrade-db Apply DB upgrades for any extensions
ext:list List extensions (local and remote)
To see the full list of commands, type cv
in your console.
Or if you prefer drush
(Drupal only):
civicrm-ext-disable Disable a CiviCRM extension.
(ced)
civicrm-ext-install Install a CiviCRM extension.
(cei)
civicrm-ext-list List of CiviCRM extensions enabled.
(cel)
civicrm-ext-uninstall Uninstall a CiviCRM extension.
(ceui)
civicrm-buildkit uses
drush cvapi extension.install
eg
drush -y -u admin cvapi extension.install key=org.civicrm.module.cividiscount debug=1
Using the Drush commands as Coleman says is probably easier (no -u admin
at least), but adding this method for completeness.
You can now use eg
cv ext:download ca.civicrm.logviewer
which would give an output of
Using extension feed "https://civicrm.org/extdir/ver=4.7.27|uf=Drupal|status=stable|ready=ready"
Downloading extension "ca.civicrm.logviewer" (https://github.com/adixon/ca.civicrm.logviewer/archive/1.1.zip)
and which unzips and renames the extension correctly and enables it. Job done!