Skip to content

Commit

Permalink
Extensions - Setup <classloader> during un-installation
Browse files Browse the repository at this point in the history
This is a somewhat counter-intuitive analog to civicrm#20091
which allows you to use classes during the uninstall procedure.

Why is this necessary? Recall that a typical admin will go through this lifecycle:

1. Enable extension $x
2. Disable extension $x
3. Uninstall extension $x

Step `#2` disables the classloader for purposes of regular page-loading. However, in step `civicrm#3`,
you need the classloader again
  • Loading branch information
totten committed Apr 21, 2021
1 parent 1d1b7ce commit f9c7cae
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions CRM/Extension/Manager/Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ private function callHook(CRM_Extension_Info $info, $hookName) {
* @return bool
*/
public function onPreUninstall(CRM_Extension_Info $info) {
CRM_Extension_System::singleton()->getClassLoader()->installExtension($info, dirname($this->mapper->keyToPath($info->key)));
$this->callHook($info, 'uninstall');
return TRUE;
}
Expand Down

0 comments on commit f9c7cae

Please sign in to comment.