Merge pull request #16484 from yashodha/dev_1580
[civicrm-core.git] / setup / plugins / installDatabase / InstallComponents.civi-setup.php
1 <?php
2 /**
3 * @file
4 *
5 * Activate Civi components on the newly populated database.
6 */
7
8 if (!defined('CIVI_SETUP')) {
9 exit("Installation plugins must only be loaded by the installer.\n");
10 }
11
12 \Civi\Setup::dispatcher()
13 ->addListener('civi.setup.installDatabase', function (\Civi\Setup\Event\InstallDatabaseEvent $e) {
14 \Civi\Setup::log()->info('[InstallComponents.civi-setup.php] Activate components: ' . implode(" ", $e->getModel()->components));
15
16 if (empty($e->getModel()->components)) {
17 throw new \Exception("System must have at least one active component.");
18 }
19
20 \Civi::settings()->set('enable_components', $e->getModel()->components);
21 }, \Civi\Setup::PRIORITY_LATE + 300);