diff options
Diffstat (limited to 'core/includes/install.core.inc')
-rw-r--r-- | core/includes/install.core.inc | 36 |
1 files changed, 21 insertions, 15 deletions
diff --git a/core/includes/install.core.inc b/core/includes/install.core.inc index feda4dcdc8a6..e0653b972edd 100644 --- a/core/includes/install.core.inc +++ b/core/includes/install.core.inc @@ -253,9 +253,19 @@ function install_state_defaults() { * modified with information gleaned from the beginning of the page request. */ function install_begin_request(&$install_state) { + // A request object from the HTTPFoundation to tell us about the request. + $request = Request::createFromGlobals(); + + // Create a minimal container so that t() and $request will work. This + // container will be overriden but it's needed for the very early installation + // process when database tasks run. + $container = new ContainerBuilder(); + $container->set('request', $request); + \Drupal::setContainer($container); + // Add any installation parameters passed in via the URL. if ($install_state['interactive']) { - $install_state['parameters'] += $_GET; + $install_state['parameters'] += $request->query->all(); } // Validate certain core settings that are used throughout the installation. @@ -288,13 +298,10 @@ function install_begin_request(&$install_state) { // _drupal_load_test_overrides() sets the simpletest_conf_path in-memory // setting in this case. if ($install_state['interactive'] && drupal_valid_test_ua() && !settings()->get('simpletest_conf_path')) { - header($_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden'); + header($request->server->get('SERVER_PROTOCOL') . ' 403 Forbidden'); exit; } - // A request object from the HTTPFoundation to tell us about the request. - $request = Request::createFromGlobals(); - // If we have a language selected and it is not yet saved in the system // (eg. pre-database data screens we are unable to persistently store // the default language), we should set language_default so the proper @@ -324,10 +331,6 @@ function install_begin_request(&$install_state) { // Determine whether the configuration system is ready to operate. $install_state['config_verified'] = install_verify_config_directory(CONFIG_ACTIVE_DIRECTORY) && install_verify_config_directory(CONFIG_STAGING_DIRECTORY); - // Create a minimal container for t() to work. - // This container will be overriden but it needed for the very early - // installation process when database tasks run. - $container = new ContainerBuilder(); // Register the translation services. install_register_translation_service($container); \Drupal::setContainer($container); @@ -1348,7 +1351,7 @@ function install_select_profile(&$install_state) { * * A profile will be selected if: * - Only one profile is available, - * - A profile was submitted through $_POST, + * - A profile was submitted through \Drupal::request()->request, * - Exactly one of the profiles is marked as "exclusive". * If multiple profiles are marked as "exclusive" then no profile will be * selected. @@ -1362,12 +1365,13 @@ function install_select_profile(&$install_state) { */ function _install_select_profile($profiles) { // Don't need to choose profile if only one available. + $request_params = \Drupal::request()->request; if (count($profiles) == 1) { $profile = array_pop($profiles); return $profile->name; } - elseif (!empty($_POST['profile']) && isset($profiles[$_POST['profile']])) { - return $profiles[$_POST['profile']]->name; + elseif ($request_params->has('profile') && ($profile = $request_params->get('profile')) && isset($profiles[$profile])) { + return $profiles[$profile]->name; } // Check for a profile marked as "exclusive" and ensure that only one // profile is marked as such. @@ -1548,6 +1552,7 @@ function install_select_language(&$install_state) { // Find all available translation files. $files = install_find_translations(); $install_state['translations'] += $files; + $request_params = \Drupal::request()->request; // If a valid language code is set, continue with the next installation step. // When translations from the localization server are used, any language code @@ -1555,9 +1560,9 @@ function install_select_language(&$install_state) { // langauges available at http://localize.drupal.org. // When files from the translation directory are used, we only accept // languages for which a file is available. - if (!empty($_POST['langcode'])) { + if ($request_params->has('langcode')) { $standard_languages = LanguageManager::getStandardLanguageList(); - $langcode = $_POST['langcode']; + $langcode = $request_params->get('langcode'); if ($langcode == 'en' || isset($files[$langcode]) || isset($standard_languages[$langcode])) { $install_state['parameters']['langcode'] = $langcode; return; @@ -2099,7 +2104,8 @@ function install_configure_form($form, &$form_state, &$install_state) { // especially out of place on the last page of the installer, where it would // distract from the message that the Drupal installation has completed // successfully.) - if (empty($_POST) && (!drupal_verify_install_file(DRUPAL_ROOT . '/' . $settings_file, FILE_EXIST|FILE_READABLE|FILE_NOT_WRITABLE) || !drupal_verify_install_file(DRUPAL_ROOT . '/' . $settings_dir, FILE_NOT_WRITABLE, 'dir'))) { + $post_params = \Drupal::request()->request->all(); + if (empty($post_params) && (!drupal_verify_install_file(DRUPAL_ROOT . '/' . $settings_file, FILE_EXIST|FILE_READABLE|FILE_NOT_WRITABLE) || !drupal_verify_install_file(DRUPAL_ROOT . '/' . $settings_dir, FILE_NOT_WRITABLE, 'dir'))) { drupal_set_message(t('All necessary changes to %dir and %file have been made, so you should remove write permissions to them now in order to avoid security risks. If you are unsure how to do so, consult the <a href="@handbook_url">online handbook</a>.', array('%dir' => $settings_dir, '%file' => $settings_file, '@handbook_url' => 'http://drupal.org/server-permissions')), 'warning'); } |