diff --git a/core/includes/install.core.inc b/core/includes/install.core.inc index 7cb7b99d416eb57c289e9c4a237cfacb01947afe..c3f15db29b0b51267dd0e4e2f403140dabaa011e 100644 --- a/core/includes/install.core.inc +++ b/core/includes/install.core.inc @@ -73,6 +73,10 @@ * an error is thrown, (b) a new page needs to be displayed, or (c) the * installation finishes (whichever happens first). * + * @param $class_loader + * The class loader. Normally Composer's ClassLoader, as included by the + * front controller, but may also be decorated; e.g., + * \Symfony\Component\ClassLoader\ApcClassLoader. * @param $settings * An optional array of installation settings. Leave this empty for a normal, * interactive, browser-based installation intended to occur over multiple @@ -84,7 +88,15 @@ * * @see install_state_defaults() */ -function install_drupal($settings = array()) { +function install_drupal($class_loader, $settings = array()) { + // Support the old way of calling this function with just a settings array. + // @todo Remove this when Drush is updated in the Drupal testing + // infrastructure in https://www.drupal.org/node/2389243 + if (is_array($class_loader) && $settings === array()) { + $settings = $class_loader; + $class_loader = require __DIR__ . '/../vendor/autoload.php'; + } + global $install_state; // Initialize the installation state with the settings that were passed in, // as well as a boolean indicating whether or not this is an interactive @@ -95,7 +107,7 @@ function install_drupal($settings = array()) { try { // Begin the page request. This adds information about the current state of // the Drupal installation to the passed-in array. - install_begin_request($install_state); + install_begin_request($class_loader, $install_state); // Based on the installation state, run the remaining tasks for this page // request, and collect any output. $output = install_run_tasks($install_state); @@ -252,11 +264,15 @@ function install_state_defaults() { * This function performs commands that must run at the beginning of every page * request. It throws an exception if the installation should not proceed. * + * @param $class_loader + * The class loader. Normally Composer's ClassLoader, as included by the + * front controller, but may also be decorated; e.g., + * \Symfony\Component\ClassLoader\ApcClassLoader. * @param $install_state * An array of information about the current installation state. This is * modified with information gleaned from the beginning of the page request. */ -function install_begin_request(&$install_state) { +function install_begin_request($class_loader, &$install_state) { $request = Request::createFromGlobals(); // Add any installation parameters passed in via the URL. @@ -286,7 +302,6 @@ function install_begin_request(&$install_state) { } $site_path = DrupalKernel::findSitePath($request, FALSE); - $class_loader = require __DIR__ . '/../vendor/autoload.php'; Settings::initialize(dirname(dirname(__DIR__)), $site_path, $class_loader); // Ensure that procedural dependencies are loaded as early as possible, diff --git a/core/install.php b/core/install.php index e206dfb3374f096d78c2f6f26e0efce4de1569e5..3493d4a7702c3546194541a6722a460f6018fab8 100644 --- a/core/install.php +++ b/core/install.php @@ -27,6 +27,6 @@ } // Start the installer. -require_once __DIR__ . '/vendor/autoload.php'; +$class_loader = require_once __DIR__ . '/vendor/autoload.php'; require_once __DIR__ . '/includes/install.core.inc'; -install_drupal(); +install_drupal($class_loader); diff --git a/core/modules/simpletest/src/WebTestBase.php b/core/modules/simpletest/src/WebTestBase.php index 44af34caad0901e7be3c291828f18aca8a1a5de1..d2b31ae4fdc1f7c53976ca8e5ea800736b1a14d5 100644 --- a/core/modules/simpletest/src/WebTestBase.php +++ b/core/modules/simpletest/src/WebTestBase.php @@ -842,7 +842,7 @@ protected function setUp() { // Execute the non-interactive installer. require_once DRUPAL_ROOT . '/core/includes/install.core.inc'; - install_drupal($parameters); + install_drupal($class_loader, $parameters); // Import new settings.php written by the installer. Settings::initialize(DRUPAL_ROOT, $directory, $class_loader);