From fe964980432fb95fba7b156b43dca137dfe14950 Mon Sep 17 00:00:00 2001 From: Alex Pott <alex.a.pott@googlemail.com> Date: Mon, 13 May 2013 00:36:29 +0100 Subject: [PATCH] Issue #1833442 follow-up by olli, ParisLiakos, dawehner: Remove hook_boot(). --- core/includes/bootstrap.inc | 5 ++--- .../language/Tests/LanguageUILanguageNegotiationTest.php | 2 +- .../lib/Drupal/system/Tests/Bootstrap/PageCacheTest.php | 9 +++++++++ 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/core/includes/bootstrap.inc b/core/includes/bootstrap.inc index a0215b408e38..7dc75f53c7dc 100644 --- a/core/includes/bootstrap.inc +++ b/core/includes/bootstrap.inc @@ -1369,9 +1369,8 @@ function drupal_serve_page_from_cache(stdClass $cache) { // cookie. The Vary header is used to indicates the set of request-header // fields that fully determines whether a cache is permitted to use the // response to reply to a subsequent request for a given URL without - // revalidation. If a Vary header has been set in hook_boot(), it is assumed - // that the module knows how to cache the page. - if (!isset($boot_headers['vary']) && !settings()->get('cache.page.omit_vary_cookie')) { + // revalidation. + if (!isset($boot_headers['vary']) && !settings()->get('omit_vary_cookie')) { header('Vary: Cookie'); } diff --git a/core/modules/language/lib/Drupal/language/Tests/LanguageUILanguageNegotiationTest.php b/core/modules/language/lib/Drupal/language/Tests/LanguageUILanguageNegotiationTest.php index d87ff56e0ae8..e929171fcdd0 100644 --- a/core/modules/language/lib/Drupal/language/Tests/LanguageUILanguageNegotiationTest.php +++ b/core/modules/language/lib/Drupal/language/Tests/LanguageUILanguageNegotiationTest.php @@ -343,7 +343,7 @@ function testUILanguageNegotiation() { 'message' => 'URL (DOMAIN) > DEFAULT: default domain should get default language', ), // Language domain specific URL, we set the $_SERVER['HTTP_HOST'] in - // language_test.module hook_boot() to simulate this. + // \Drupal\language_test\LanguageTestManager to simulate this. array( 'language_negotiation' => array(LANGUAGE_NEGOTIATION_URL, LANGUAGE_NEGOTIATION_SELECTED), 'language_negotiation_url_part' => LANGUAGE_NEGOTIATION_URL_DOMAIN, diff --git a/core/modules/system/lib/Drupal/system/Tests/Bootstrap/PageCacheTest.php b/core/modules/system/lib/Drupal/system/Tests/Bootstrap/PageCacheTest.php index c09576cd9a91..8ee5bba2f436 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Bootstrap/PageCacheTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Bootstrap/PageCacheTest.php @@ -124,6 +124,15 @@ function testPageCache() { $this->assertEqual($this->drupalGetHeader('Expires'), 'Sun, 19 Nov 1978 05:00:00 GMT', 'Expires header was sent.'); $this->assertEqual($this->drupalGetHeader('Foo'), 'bar', 'Custom header was sent.'); + // Check the omit_vary_cookie setting. + $this->drupalLogout(); + $settings['settings']['omit_vary_cookie'] = (object) array( + 'value' => TRUE, + 'required' => TRUE, + ); + $this->writeSettings($settings); + $this->drupalGet('system-test/set-header', array('query' => array('name' => 'Foo', 'value' => 'bar'))); + $this->assertTrue(strpos($this->drupalGetHeader('Vary'), 'Cookie') === FALSE, 'Vary: Cookie header was not sent.'); } /** -- GitLab