From: Tim Otten Date: Wed, 6 May 2020 02:21:59 +0000 (-0700) Subject: dev/core#1744 - SystemInstallEvent - Simplify event naming X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=1d4402155136e0497bf453a062340b41ee0d0254;p=civicrm-core.git dev/core#1744 - SystemInstallEvent - Simplify event naming --- diff --git a/CRM/Core/Config.php b/CRM/Core/Config.php index f2f28ccd08..a27d424d6a 100644 --- a/CRM/Core/Config.php +++ b/CRM/Core/Config.php @@ -560,7 +560,7 @@ class CRM_Core_Config extends CRM_Core_Config_MagicMerge { } // OK, this looks new. - Civi::dispatcher()->dispatch(\Civi\Core\Event\SystemInstallEvent::EVENT_NAME, new \Civi\Core\Event\SystemInstallEvent()); + Civi::dispatcher()->dispatch('civi.core.install', new \Civi\Core\Event\SystemInstallEvent()); Civi::settings()->set('installed', 1); } diff --git a/Civi/Core/Container.php b/Civi/Core/Container.php index da029cfa4e..57ee309164 100644 --- a/Civi/Core/Container.php +++ b/Civi/Core/Container.php @@ -1,7 +1,6 @@ setDispatchPolicy(\CRM_Upgrade_DispatchPolicy::get('upgrade.main')); } - $dispatcher->addListener(SystemInstallEvent::EVENT_NAME, ['\Civi\Core\InstallationCanary', 'check']); - $dispatcher->addListener(SystemInstallEvent::EVENT_NAME, ['\Civi\Core\DatabaseInitializer', 'initialize']); - $dispatcher->addListener(SystemInstallEvent::EVENT_NAME, ['\Civi\Core\LocalizationInitializer', 'initialize']); + $dispatcher->addListener('civi.core.install', ['\Civi\Core\InstallationCanary', 'check']); + $dispatcher->addListener('civi.core.install', ['\Civi\Core\DatabaseInitializer', 'initialize']); + $dispatcher->addListener('civi.core.install', ['\Civi\Core\LocalizationInitializer', 'initialize']); $dispatcher->addListener('hook_civicrm_post', ['\CRM_Core_Transaction', 'addPostCommit'], -1000); $dispatcher->addListener('hook_civicrm_pre', ['\Civi\Core\Event\PreEvent', 'dispatchSubevent'], 100); $dispatcher->addListener('civi.dao.preDelete', ['\CRM_Core_BAO_EntityTag', 'preDeleteOtherEntity']); diff --git a/Civi/Core/Event/SystemInstallEvent.php b/Civi/Core/Event/SystemInstallEvent.php index f85334f9fb..3a9193e3df 100644 --- a/Civi/Core/Event/SystemInstallEvent.php +++ b/Civi/Core/Event/SystemInstallEvent.php @@ -19,6 +19,8 @@ class SystemInstallEvent extends \Symfony\Component\EventDispatcher\Event { /** * The SystemInstallEvent fires once after installation - during the first page-view. + * + * @deprecated - You may simply use the event name directly. dev/core#1744 */ const EVENT_NAME = 'civi.core.install'; @@ -27,7 +29,7 @@ class SystemInstallEvent extends \Symfony\Component\EventDispatcher\Event { * @see \CRM_Utils_Hook::eventDefs */ public static function hookEventDefs($e) { - $e->inspector->addEventClass(self::EVENT_NAME, __CLASS__); + $e->inspector->addEventClass('civi.core.install', __CLASS__); } }