From: Tim Otten Date: Thu, 13 Oct 2022 16:59:45 +0000 (+0100) Subject: Ensure that class-index is up-to-date after toggling extensions (A-Module Handler) X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=4432ceb9e883021bf329b3df4d6062126e169693;p=civicrm-core.git Ensure that class-index is up-to-date after toggling extensions (A-Module Handler) --- diff --git a/CRM/Extension/Manager/Module.php b/CRM/Extension/Manager/Module.php index b8d385cd59..24bbc811a9 100644 --- a/CRM/Extension/Manager/Module.php +++ b/CRM/Extension/Manager/Module.php @@ -34,6 +34,10 @@ class CRM_Extension_Manager_Module extends CRM_Extension_Manager_Base { $this->callHook($info, 'enable'); } + public function onPostInstall(CRM_Extension_Info $info) { + \Civi\Core\ClassScanner::cache('index')->flush(); + } + /** * @param CRM_Extension_Info $info */ @@ -80,6 +84,7 @@ class CRM_Extension_Manager_Module extends CRM_Extension_Manager_Base { * @param CRM_Extension_Info $info */ public function onPostUninstall(CRM_Extension_Info $info) { + \Civi\Core\ClassScanner::cache('index')->flush(); } /** @@ -89,6 +94,10 @@ class CRM_Extension_Manager_Module extends CRM_Extension_Manager_Base { $this->callHook($info, 'disable'); } + public function onPostDisable(CRM_Extension_Info $info) { + \Civi\Core\ClassScanner::cache('index')->flush(); + } + /** * @param CRM_Extension_Info $info */ @@ -97,6 +106,10 @@ class CRM_Extension_Manager_Module extends CRM_Extension_Manager_Base { $this->callHook($info, 'enable'); } + public function onPostEnable(CRM_Extension_Info $info) { + \Civi\Core\ClassScanner::cache('index')->flush(); + } + public function onPostReplace(CRM_Extension_Info $oldInfo, CRM_Extension_Info $newInfo) { // Like everything, ClassScanner is probably affected by pre-existing/long-standing issue dev/core#3686. // This may mitigate a couple edge-cases. But really #3686 needs a different+deeper fix.