From 6b231d8f863b4dc6a075a77414bb403bd94faceb Mon Sep 17 00:00:00 2001 From: Niklas Fiekas <niklas.fiekas@googlemail.com> Date: Sat, 14 Jul 2012 02:33:10 +0200 Subject: [PATCH] Database bootstrap level before booting kernel. Switching to the test database connection only happens when _drupal_bootstrap_database() runs before executing a first query. To avoid complicating the boostrap with more fine grained level booting, just boot the DrupalKernel after DRUPAL_BOOTSTRAP_CODE. Getting rid of those levels is for a seperate issue. Additionally mirror the changes in the testing files core/modules/system/tests/http.php and https.php. --- core/lib/Drupal/Core/DrupalKernel.php | 6 ------ core/modules/system/tests/http.php | 4 +++- core/modules/system/tests/https.php | 4 +++- index.php | 6 +++--- 4 files changed, 9 insertions(+), 11 deletions(-) diff --git a/core/lib/Drupal/Core/DrupalKernel.php b/core/lib/Drupal/Core/DrupalKernel.php index 0c19a6bdc7a0..7d372ade5f39 100644 --- a/core/lib/Drupal/Core/DrupalKernel.php +++ b/core/lib/Drupal/Core/DrupalKernel.php @@ -23,14 +23,8 @@ public function registerBundles() { new CoreBundle(), ); - // Rather than bootstrapping to a higher phase prior to booting the Kernel, which - // would ensure these files are loaded already, we want to boot the Kernel as - // early as possible in the bootstrapping phase. // TODO: Somehow remove the necessity of calling system_list() to find out which // bundles exist. - require_once DRUPAL_ROOT . '/core/includes/cache.inc'; - require_once DRUPAL_ROOT . '/core/includes/module.inc'; - require_once DRUPAL_ROOT . '/core/includes/database.inc'; $modules = array_keys(system_list('module_enabled')); foreach ($modules as $module) { diff --git a/core/modules/system/tests/http.php b/core/modules/system/tests/http.php index 93646850e965..c91dd0c3778c 100644 --- a/core/modules/system/tests/http.php +++ b/core/modules/system/tests/http.php @@ -5,6 +5,7 @@ * Fake an HTTP request, for use during testing. */ +use Drupal\Core\DrupalKernel; use Symfony\Component\HttpFoundation\Request; // Set a global variable to indicate a mock HTTP request. @@ -36,6 +37,7 @@ drupal_bootstrap(DRUPAL_BOOTSTRAP_CODE); -$kernel = drupal_container()->get('httpkernel'); +$kernel = new DrupalKernel('prod', FALSE); +$kernel->boot(); $response = $kernel->handle($request)->prepare($request)->send(); $kernel->terminate($request, $response); diff --git a/core/modules/system/tests/https.php b/core/modules/system/tests/https.php index 11b7e13022cb..5bf000b3c954 100644 --- a/core/modules/system/tests/https.php +++ b/core/modules/system/tests/https.php @@ -5,6 +5,7 @@ * Fake an https request, for use during testing. */ +use Drupal\Core\DrupalKernel; use Symfony\Component\HttpFoundation\Request; // Set a global variable to indicate a mock HTTPS request. @@ -35,6 +36,7 @@ drupal_bootstrap(DRUPAL_BOOTSTRAP_CODE); -$kernel = drupal_container()->get('httpkernel'); +$kernel = new DrupalKernel('prod', FALSE); +$kernel->boot(); $response = $kernel->handle($request)->prepare($request)->send(); $kernel->terminate($request, $response); diff --git a/index.php b/index.php index df4b2b6a7838..200a2de93c39 100644 --- a/index.php +++ b/index.php @@ -30,9 +30,6 @@ // container at some point. request($request); -$kernel = new DrupalKernel('prod', FALSE); -$kernel->boot(); - // Bootstrap all of Drupal's subsystems, but do not initialize anything that // depends on the fully resolved Drupal path, because path resolution happens // during the REQUEST event of the kernel. @@ -40,6 +37,9 @@ // @see Drupal\Core\EventSubscriber\LegacyRequestSubscriber; drupal_bootstrap(DRUPAL_BOOTSTRAP_CODE); +$kernel = new DrupalKernel('prod', FALSE); +$kernel->boot(); + $response = $kernel->handle($request)->prepare($request)->send(); $kernel->terminate($request, $response); -- GitLab