From e5c6e03cd7c115c54909eacb9b393221a876a979 Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Thu, 19 Jan 2023 13:52:05 -0800 Subject: [PATCH] (NFC) smarty-v2 - Add more explanatory comments --- mixin/smarty-v2@1/mixin.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/mixin/smarty-v2@1/mixin.php b/mixin/smarty-v2@1/mixin.php index 137eb5ab47..65e4396d22 100644 --- a/mixin/smarty-v2@1/mixin.php +++ b/mixin/smarty-v2@1/mixin.php @@ -30,9 +30,15 @@ return function ($mixInfo, $bootCache) { }; if ($mixInfo->isActive()) { + // Typical: The extension is already installed, and we're booting Civi normally. + // We put this first because it's most common. + // We defer the actual registration for a moment -- to ensure that Smarty is online. \Civi::dispatcher()->addListener('hook_civicrm_config', $register); } elseif (CRM_Extension_System::singleton()->getManager()->extensionIsBeingInstalledOrEnabled($mixInfo->longName)) { + // New Install: The extension has just been enabled, and we're now setting it up. + // We put this second because it's less common, and checking it requires more resources (eg `Manager` instance). + // We register immediately because Smarty is already online, and the new templates may be needed for upcoming installation steps. $register(); } -- 2.25.1