dev/core#1744 - SystemInstallEvent - Simplify event naming
authorTim Otten <totten@civicrm.org>
Wed, 6 May 2020 02:21:59 +0000 (19:21 -0700)
committerTim Otten <totten@civicrm.org>
Wed, 6 May 2020 03:06:56 +0000 (20:06 -0700)
CRM/Core/Config.php
Civi/Core/Container.php
Civi/Core/Event/SystemInstallEvent.php

index f2f28ccd08eb408bf7463d2b910d344e4dad4cef..a27d424d6ae38b68cf1dd6ac346e2d0270fd71af 100644 (file)
@@ -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);
   }
 
index da029cfa4e259a7cf7a7e65b1294f985732c11c8..57ee30916408805770ad50c5f052e6a677b0edab 100644 (file)
@@ -1,7 +1,6 @@
 <?php
 namespace Civi\Core;
 
-use Civi\Core\Event\SystemInstallEvent;
 use Civi\Core\Lock\LockManager;
 use Symfony\Component\Config\ConfigCache;
 use Symfony\Component\DependencyInjection\ContainerBuilder;
@@ -334,9 +333,9 @@ class Container {
       $dispatcher->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']);
index f85334f9fb29604481fae2b32174f5c79778db95..3a9193e3df3b733d035109c4ac901c284475411e 100644 (file)
@@ -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__);
   }
 
 }