diff --git a/core/lib/Drupal/Core/EventSubscriber/SmartCacheSubscriber.php b/core/lib/Drupal/Core/EventSubscriber/SmartCacheSubscriber.php index 51fde1b..963b201 100644 --- a/core/lib/Drupal/Core/EventSubscriber/SmartCacheSubscriber.php +++ b/core/lib/Drupal/Core/EventSubscriber/SmartCacheSubscriber.php @@ -117,7 +117,8 @@ public function onRouteMatch(GetResponseEvent $event) { /** * {@inheritdoc} */ - static function getSubscribedEvents() { + public static function getSubscribedEvents() { + $events = []; $events[KernelEvents::REQUEST][] = ['onRouteMatch', 27]; return $events; diff --git a/core/lib/Drupal/Core/PageCache/ResponsePolicy/NoAdminRoutes.php b/core/lib/Drupal/Core/PageCache/ResponsePolicy/NoAdminRoutes.php index 97cec61..3c8dcdd 100644 --- a/core/lib/Drupal/Core/PageCache/ResponsePolicy/NoAdminRoutes.php +++ b/core/lib/Drupal/Core/PageCache/ResponsePolicy/NoAdminRoutes.php @@ -46,4 +46,3 @@ public function check(Response $response, Request $request) { } } - diff --git a/core/lib/Drupal/Core/Render/MainContent/SmartCacheHtmlRenderer.php b/core/lib/Drupal/Core/Render/MainContent/SmartCacheHtmlRenderer.php index f9ab481..ccdca1d 100644 --- a/core/lib/Drupal/Core/Render/MainContent/SmartCacheHtmlRenderer.php +++ b/core/lib/Drupal/Core/Render/MainContent/SmartCacheHtmlRenderer.php @@ -16,11 +16,9 @@ use Drupal\Core\PageCache\RequestPolicyInterface; use Drupal\Core\PageCache\ResponsePolicyInterface; use Drupal\Core\Render\Element; -use Drupal\Core\Render\ElementInfoManagerInterface; use Drupal\Core\Render\RenderCacheInterface; use Drupal\Core\Render\RendererInterface; use Drupal\Core\Routing\RouteMatchInterface; -use Symfony\Component\DependencyInjection\ContainerAwareTrait; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\HttpFoundation\RequestStack; use Symfony\Component\HttpFoundation\Response; @@ -121,7 +119,7 @@ protected function finish(array $html) { // already, then we can return early: no need to redo all the work. if (isset($html['#smartcache'])) { // Mark the response as a cache hit. - $html['#attached']['http_header'][] = ['X-Drupal-SmartCache', 'HIT']; + $html['#attached']['http_header'][] = ['X-Drupal-SmartCache', 'HIT']; return parent::finish($html); } @@ -174,12 +172,12 @@ protected function finish(array $html) { // the breadcrumbs block, which currently set max-age = 0, even though it // is perfectly possible to cache them), to see the performance boost this // will bring, uncomment this line. -// $html_cache_max_age = Cache::PERMANENT; - + // $html_cache_max_age = Cache::PERMANENT; + // // @todo Remove this. Work-around to support the deep-render-array-scanning- - // dependent logic bartik_preprocess_html() has: it needs to know about - // the presence or absence of certain regions. That is similar (but less - /// bad) to the evil things one could do with hook_page_alter() in D7. + // dependent logic bartik_preprocess_html() has: it needs to know about + // the presence or absence of certain regions. That is similar (but less + // bad) to the evil things one could do with hook_page_alter() in D7. foreach (Element::children($html['page']) as $page_region) { $cacheable_html['page'][$page_region] = ['#preprocess_functions_messing_with_cacheability' => TRUE]; } @@ -202,11 +200,11 @@ protected function finish(array $html) { $this->smartHtmlCache->set($cid, $cacheable_html, $expire, $html_cache_tags); // Now that the cacheable HTML is cached, mark the response as a cache miss. - $cacheable_html['#attached']['http_header'][] = ['X-Drupal-SmartCache', 'MISS']; + $cacheable_html['#attached']['http_header'][] = ['X-Drupal-SmartCache', 'MISS']; } else { // Now that the cacheable HTML is cached, mark the response as a cache miss. - $cacheable_html['#attached']['http_header'][] = ['X-Drupal-SmartCache', 'UNCACHEABLE']; + $cacheable_html['#attached']['http_header'][] = ['X-Drupal-SmartCache', 'UNCACHEABLE']; } return parent::finish($cacheable_html); diff --git a/core/modules/system/src/Tests/Cache/SmartCacheIntegrationTest.php b/core/modules/system/src/Tests/Cache/SmartCacheIntegrationTest.php index 5845969..8600e7d 100644 --- a/core/modules/system/src/Tests/Cache/SmartCacheIntegrationTest.php +++ b/core/modules/system/src/Tests/Cache/SmartCacheIntegrationTest.php @@ -45,7 +45,7 @@ protected function setUp() { /** * Tests that SmartCache works correctly, and verifies the edge cases. */ - function testSmartCache() { + public function testSmartCache() { // Controllers returning response objects are ignored by SmartCache. $url = Url::fromUri('route:smart_cache_test.response'); $this->drupalGet($url);