[REF] Alter new Setup process to use CiviCRM's Event Dispatcher
authorSeamus Lee <seamuslee001@gmail.com>
Sun, 27 Jun 2021 23:23:52 +0000 (09:23 +1000)
committerSeamus Lee <seamuslee001@gmail.com>
Wed, 30 Jun 2021 21:51:41 +0000 (07:51 +1000)
Apply patch from Tim to limit what events are dispatched

setup/src/Setup.php

index 04dd426b2b3fb4eb033306c9655fe9021d4ab585..5503ae709e1660f534d2cbdfb399e0bdaf61ea2e 100644 (file)
@@ -12,7 +12,7 @@ use Civi\Setup\Event\UninstallDatabaseEvent;
 use Civi\Setup\Event\UninstallFilesEvent;
 use Civi\Setup\Exception\InitException;
 use Psr\Log\NullLogger;
-use Symfony\Component\EventDispatcher\EventDispatcher;
+use Civi\Core\CiviEventDispatcher;
 
 class Setup {
 
@@ -70,7 +70,8 @@ class Setup {
     self::$instance = new Setup();
     self::$instance->model = new \Civi\Setup\Model();
     self::$instance->model->setValues($modelValues);
-    self::$instance->dispatcher = new EventDispatcher();
+    self::$instance->dispatcher = new CiviEventDispatcher();
+    self::$instance->dispatcher->setDispatchPolicy(['/^civi\.setup\./' => 'run', '/./' => 'fail']);
     self::$instance->log = $log ? $log : new NullLogger();
 
     $pluginDir = dirname(__DIR__) . '/plugins';