5 * Activate Civi components on the newly populated database.
8 if (!defined('CIVI_SETUP')) {
9 exit("Installation plugins must only be loaded by the installer.\n");
12 Civi\Setup
::dispatcher()
13 ->addListener('civi.setup.checkRequirements', function (\Civi\Setup\Event\CheckRequirementsEvent
$e) {
14 \Civi\Setup
::log()->info(sprintf('[%s] Handle %s', basename(__FILE__
), 'checkRequirements'));
15 $model = $e->getModel();
17 if (empty($model->components
)) {
18 $e->addError('system', 'components', "System must have at least one active component.");
23 \Civi\Setup
::dispatcher()
24 ->addListener('civi.setup.installDatabase', function (\Civi\Setup\Event\InstallDatabaseEvent
$e) {
25 \Civi\Setup
::log()->info('[InstallComponents.civi-setup.php] Activate components: ' . implode(" ", $e->getModel()->components
));
27 if (empty($e->getModel()->components
)) {
28 throw new \
Exception("System must have at least one active component.");
31 \Civi
::settings()->set('enable_components', $e->getModel()->components
);
32 }, \Civi\Setup
::PRIORITY_LATE +
300);