Update to Drupal 8.1.0. For more information, see https://www.drupal.org/drupal-8.1.0-release-notes
This commit is contained in:
parent
b11a755ba8
commit
c0a0d5a94c
6920 changed files with 64395 additions and 57312 deletions
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\dynamic_page_cache\EventSubscriber\DynamicPageCacheSubscriber.
|
||||
*/
|
||||
|
||||
namespace Drupal\dynamic_page_cache\EventSubscriber;
|
||||
|
||||
use Drupal\Core\Cache\Cache;
|
||||
|
@ -12,7 +7,6 @@ use Drupal\Core\Cache\CacheableMetadata;
|
|||
use Drupal\Core\Cache\CacheableResponseInterface;
|
||||
use Drupal\Core\PageCache\RequestPolicyInterface;
|
||||
use Drupal\Core\PageCache\ResponsePolicyInterface;
|
||||
use Drupal\Core\Render\Element;
|
||||
use Drupal\Core\Render\RenderCacheInterface;
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
use Symfony\Component\HttpKernel\Event\FilterResponseEvent;
|
||||
|
@ -40,14 +34,6 @@ use Symfony\Component\HttpKernel\KernelEvents;
|
|||
*/
|
||||
class DynamicPageCacheSubscriber implements EventSubscriberInterface {
|
||||
|
||||
/**
|
||||
* Attribute name of the Dynamic Page Cache request policy result.
|
||||
*
|
||||
* @see onRouteMatch()
|
||||
* @see onRespond()
|
||||
*/
|
||||
const ATTRIBUTE_REQUEST_POLICY_RESULT = '_dynamic_page_cache_request_policy_result';
|
||||
|
||||
/**
|
||||
* Name of Dynamic Page Cache's response header.
|
||||
*/
|
||||
|
@ -103,6 +89,13 @@ class DynamicPageCacheSubscriber implements EventSubscriberInterface {
|
|||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* Internal cache of request policy results.
|
||||
*
|
||||
* @var \SplObjectStorage
|
||||
*/
|
||||
protected $requestPolicyResults;
|
||||
|
||||
/**
|
||||
* Constructs a new DynamicPageCacheSubscriber object.
|
||||
*
|
||||
|
@ -120,6 +113,7 @@ class DynamicPageCacheSubscriber implements EventSubscriberInterface {
|
|||
$this->responsePolicy = $response_policy;
|
||||
$this->renderCache = $render_cache;
|
||||
$this->rendererConfig = $renderer_config;
|
||||
$this->requestPolicyResults = new \SplObjectStorage();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -134,7 +128,7 @@ class DynamicPageCacheSubscriber implements EventSubscriberInterface {
|
|||
// does not have to redo the request policy check.
|
||||
$request = $event->getRequest();
|
||||
$request_policy_result = $this->requestPolicy->check($request);
|
||||
$request->attributes->set(self::ATTRIBUTE_REQUEST_POLICY_RESULT, $request_policy_result);
|
||||
$this->requestPolicyResults[$request] = $request_policy_result;
|
||||
if ($request_policy_result === RequestPolicyInterface::DENY) {
|
||||
return;
|
||||
}
|
||||
|
@ -189,14 +183,14 @@ class DynamicPageCacheSubscriber implements EventSubscriberInterface {
|
|||
// @see \Drupal\Core\Routing\AccessAwareRouter::checkAccess()
|
||||
// @see \Drupal\Core\EventSubscriber\DefaultExceptionHtmlSubscriber::on403()
|
||||
$request = $event->getRequest();
|
||||
if (!$request->attributes->has(self::ATTRIBUTE_REQUEST_POLICY_RESULT)) {
|
||||
if (!isset($this->requestPolicyResults[$request])) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Don't cache the response if the Dynamic Page Cache request & response
|
||||
// policies are not met.
|
||||
// @see onRouteMatch()
|
||||
if ($request->attributes->get(self::ATTRIBUTE_REQUEST_POLICY_RESULT) === RequestPolicyInterface::DENY || $this->responsePolicy->check($response, $request) === ResponsePolicyInterface::DENY) {
|
||||
if ($this->requestPolicyResults[$request] === RequestPolicyInterface::DENY || $this->responsePolicy->check($response, $request) === ResponsePolicyInterface::DENY) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\dynamic_page_cache\PageCache\RequestPolicy\DefaultRequestPolicy.
|
||||
*/
|
||||
|
||||
namespace Drupal\dynamic_page_cache\PageCache\RequestPolicy;
|
||||
|
||||
use Drupal\Core\PageCache\ChainRequestPolicy;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\dynamic_page_cache\PageCache\ResponsePolicy\DenyAdminRoutes.
|
||||
*/
|
||||
|
||||
namespace Drupal\dynamic_page_cache\PageCache\ResponsePolicy;
|
||||
|
||||
use Drupal\Core\PageCache\ResponsePolicyInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\dynamic_page_cache\Tests\DynamicPageCacheIntegrationTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\dynamic_page_cache\Tests;
|
||||
|
||||
use Drupal\Core\EventSubscriber\MainContentViewSubscriber;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\dynamic_page_cache_test\DynamicPageCacheTestController.
|
||||
*/
|
||||
|
||||
namespace Drupal\dynamic_page_cache_test;
|
||||
|
||||
use Drupal\Core\Cache\CacheableResponse;
|
||||
|
|
Reference in a new issue