Merge pull request #17235 from colemanw/apiLog
[civicrm-core.git] / setup / plugins / installDatabase / BootstrapCivi.civi-setup.php
1 <?php
2 /**
3 * @file
4 *
5 * Perform the first system bootstrap.
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(sprintf('[%s] Bootstrap CiviCRM', basename(__FILE__)));
15
16 if (!defined('CIVICRM_SETTINGS_PATH')) {
17 define('CIVICRM_SETTINGS_PATH', $e->getModel()->settingsPath);
18 }
19
20 if (realpath(CIVICRM_SETTINGS_PATH) !== realpath($e->getModel()->settingsPath)) {
21 throw new \RuntimeException(sprintf("Cannot boot: The civicrm.settings.php path appears inconsistent (%s vs %s)", CIVICRM_SETTINGS_PATH, $e->getModel()->settingsPath));
22 }
23
24 include_once CIVICRM_SETTINGS_PATH;
25
26 require_once 'CRM/Core/ClassLoader.php';
27 CRM_Core_ClassLoader::singleton()->register();
28
29 CRM_Core_Config::singleton(TRUE);
30
31 }, \Civi\Setup::PRIORITY_MAIN - 200);