Merge pull request #19594 from eileenmcnaughton/535m
[civicrm-core.git] / setup / plugins / installDatabase / BootstrapCivi.civi-setup.php
index b2c0a17446b9663682e07c5bad5f3e87df89dda7..3592e35435cc5bd2c0f1fa40ff51e0dd4caa20bc 100644 (file)
@@ -2,7 +2,15 @@
 /**
  * @file
  *
- * Perform the first system bootstrap.
+ * Perform the full bootstrap.
+ *
+ * GOAL: All the standard services (database, DAOs, translations, settings, etc) should be loaded.
+ *
+ * MECHANICS: This basically calls `CRM_Core_Config::singleton(TRUE,TRUE)`.
+ *
+ * NOTE: This is technically a *reboot*. `Preboot` started things off, but it
+ * booted with `CRM_Core_Config::singleton($loadFromDB==FALSE)`. Now, the DB is
+ * populated, so we can teardown the preboot stuff and start again with `$loadFromDB==TRUE`.
  */
 
 if (!defined('CIVI_SETUP')) {
@@ -13,19 +21,9 @@ if (!defined('CIVI_SETUP')) {
   ->addListener('civi.setup.installDatabase', function (\Civi\Setup\Event\InstallDatabaseEvent $e) {
     \Civi\Setup::log()->info(sprintf('[%s] Bootstrap CiviCRM', basename(__FILE__)));
 
-    if (!defined('CIVICRM_SETTINGS_PATH')) {
-      define('CIVICRM_SETTINGS_PATH', $e->getModel()->settingsPath);
-    }
-
-    if (realpath(CIVICRM_SETTINGS_PATH) !== realpath($e->getModel()->settingsPath)) {
-      throw new \RuntimeException(sprintf("Cannot boot: The civicrm.settings.php path appears inconsistent (%s vs %s)", CIVICRM_SETTINGS_PATH, $e->getModel()->settingsPath));
-    }
-
-    include_once CIVICRM_SETTINGS_PATH;
-
-    require_once 'CRM/Core/ClassLoader.php';
-    CRM_Core_ClassLoader::singleton()->register();
+    \CRM_Core_I18n::$SQL_ESCAPER = NULL;
+    unset(\Civi::$statics['testPreInstall']);
 
-    CRM_Core_Config::singleton(TRUE);
+    CRM_Core_Config::singleton(TRUE, TRUE);
 
   }, \Civi\Setup::PRIORITY_MAIN - 200);