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
|
@ -277,7 +277,7 @@ class HttpCache implements HttpKernelInterface, TerminableInterface
|
|||
// invalidate only when the response is successful
|
||||
if ($response->isSuccessful() || $response->isRedirect()) {
|
||||
try {
|
||||
$this->store->invalidate($request, $catch);
|
||||
$this->store->invalidate($request);
|
||||
|
||||
// As per the RFC, invalidate Location and Content-Location URLs if present
|
||||
foreach (array('Location', 'Content-Location') as $header) {
|
||||
|
@ -503,7 +503,7 @@ class HttpCache implements HttpKernelInterface, TerminableInterface
|
|||
$this->processResponseBody($request, $response);
|
||||
|
||||
if ($this->isPrivateRequest($request) && !$response->headers->hasCacheControlDirective('public')) {
|
||||
$response->setPrivate(true);
|
||||
$response->setPrivate();
|
||||
} elseif ($this->options['default_ttl'] > 0 && null === $response->getTtl() && !$response->headers->getCacheControlDirective('must-revalidate')) {
|
||||
$response->setTtl($this->options['default_ttl']);
|
||||
}
|
||||
|
@ -566,7 +566,7 @@ class HttpCache implements HttpKernelInterface, TerminableInterface
|
|||
$wait += 50000;
|
||||
}
|
||||
|
||||
if ($wait < 2000000) {
|
||||
if ($wait < 5000000) {
|
||||
// replace the current entry with the fresh one
|
||||
$new = $this->lookup($request);
|
||||
$entry->headers = $new->headers;
|
||||
|
|
|
@ -32,6 +32,7 @@ class ResponseCacheStrategy implements ResponseCacheStrategyInterface
|
|||
private $embeddedResponses = 0;
|
||||
private $ttls = array();
|
||||
private $maxAges = array();
|
||||
private $isNotCacheableResponseEmbedded = false;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
|
@ -41,8 +42,13 @@ class ResponseCacheStrategy implements ResponseCacheStrategyInterface
|
|||
if ($response->isValidateable()) {
|
||||
$this->cacheable = false;
|
||||
} else {
|
||||
$maxAge = $response->getMaxAge();
|
||||
$this->ttls[] = $response->getTtl();
|
||||
$this->maxAges[] = $response->getMaxAge();
|
||||
$this->maxAges[] = $maxAge;
|
||||
|
||||
if (null === $maxAge) {
|
||||
$this->isNotCacheableResponseEmbedded = true;
|
||||
}
|
||||
}
|
||||
|
||||
++$this->embeddedResponses;
|
||||
|
@ -76,7 +82,9 @@ class ResponseCacheStrategy implements ResponseCacheStrategyInterface
|
|||
$this->ttls[] = $response->getTtl();
|
||||
$this->maxAges[] = $response->getMaxAge();
|
||||
|
||||
if (null !== $maxAge = min($this->maxAges)) {
|
||||
if ($this->isNotCacheableResponseEmbedded) {
|
||||
$response->headers->removeCacheControlDirective('s-maxage');
|
||||
} elseif (null !== $maxAge = min($this->maxAges)) {
|
||||
$response->setSharedMaxAge($maxAge);
|
||||
$response->headers->set('Age', $maxAge - min($this->ttls));
|
||||
}
|
||||
|
|
23
vendor/symfony/http-kernel/HttpCache/Store.php
vendored
23
vendor/symfony/http-kernel/HttpCache/Store.php
vendored
|
@ -32,12 +32,14 @@ class Store implements StoreInterface
|
|||
* Constructor.
|
||||
*
|
||||
* @param string $root The path to the cache directory
|
||||
*
|
||||
* @throws \RuntimeException
|
||||
*/
|
||||
public function __construct($root)
|
||||
{
|
||||
$this->root = $root;
|
||||
if (!is_dir($this->root)) {
|
||||
mkdir($this->root, 0777, true);
|
||||
if (!is_dir($this->root) && !@mkdir($this->root, 0777, true) && !is_dir($this->root)) {
|
||||
throw new \RuntimeException(sprintf('Unable to create the store directory (%s).', $this->root));
|
||||
}
|
||||
$this->keyCache = new \SplObjectStorage();
|
||||
$this->locks = array();
|
||||
|
@ -74,7 +76,7 @@ class Store implements StoreInterface
|
|||
public function lock(Request $request)
|
||||
{
|
||||
$path = $this->getPath($this->getCacheKey($request).'.lck');
|
||||
if (!is_dir(dirname($path)) && false === @mkdir(dirname($path), 0777, true)) {
|
||||
if (!is_dir(dirname($path)) && false === @mkdir(dirname($path), 0777, true) && !is_dir(dirname($path))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -106,7 +108,10 @@ class Store implements StoreInterface
|
|||
|
||||
public function isLocked(Request $request)
|
||||
{
|
||||
return is_file($this->getPath($this->getCacheKey($request).'.lck'));
|
||||
$path = $this->getPath($this->getCacheKey($request).'.lck');
|
||||
clearstatcache(true, $path);
|
||||
|
||||
return is_file($path);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -242,10 +247,8 @@ class Store implements StoreInterface
|
|||
}
|
||||
}
|
||||
|
||||
if ($modified) {
|
||||
if (false === $this->save($key, serialize($entries))) {
|
||||
throw new \RuntimeException('Unable to store the metadata.');
|
||||
}
|
||||
if ($modified && false === $this->save($key, serialize($entries))) {
|
||||
throw new \RuntimeException('Unable to store the metadata.');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -266,7 +269,7 @@ class Store implements StoreInterface
|
|||
}
|
||||
|
||||
foreach (preg_split('/[\s,]+/', $vary) as $header) {
|
||||
$key = strtr(strtolower($header), '_', '-');
|
||||
$key = str_replace('_', '-', strtolower($header));
|
||||
$v1 = isset($env1[$key]) ? $env1[$key] : null;
|
||||
$v2 = isset($env2[$key]) ? $env2[$key] : null;
|
||||
if ($v1 !== $v2) {
|
||||
|
@ -338,7 +341,7 @@ class Store implements StoreInterface
|
|||
private function save($key, $data)
|
||||
{
|
||||
$path = $this->getPath($key);
|
||||
if (!is_dir(dirname($path)) && false === @mkdir(dirname($path), 0777, true)) {
|
||||
if (!is_dir(dirname($path)) && false === @mkdir(dirname($path), 0777, true) && !is_dir(dirname($path))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
Reference in a new issue