Update to Drupal 8.2.0. For more information, see https://www.drupal.org/project/drupal/releases/8.2.0

This commit is contained in:
Pantheon Automation 2016-10-06 15:16:20 -07:00 committed by Greg Anderson
parent 2f563ab520
commit f1c8716f57
1732 changed files with 52334 additions and 11780 deletions

View file

@ -148,7 +148,7 @@ class Cache {
/**
* Gets all cache bin services.
*
* @return array
* @return \Drupal\Core\Cache\CacheBackendInterface[]
* An array of cache backend objects keyed by cache bins.
*/
public static function getBins() {

View file

@ -64,16 +64,20 @@ class CacheFactory implements CacheFactoryInterface, ContainerAwareInterface {
*/
public function get($bin) {
$cache_settings = $this->settings->get('cache');
// First, look for a cache bin specific setting.
if (isset($cache_settings['bins'][$bin])) {
$service_name = $cache_settings['bins'][$bin];
}
elseif (isset($cache_settings['default'])) {
$service_name = $cache_settings['default'];
}
// Second, use the default backend specified by the cache bin.
elseif (isset($this->defaultBinBackends[$bin])) {
$service_name = $this->defaultBinBackends[$bin];
}
// Third, use configured default backend.
elseif (isset($cache_settings['default'])) {
$service_name = $cache_settings['default'];
}
else {
// Fall back to the database backend if nothing else is configured.
$service_name = 'cache.backend.database';
}
return $this->container->get($service_name)->get($bin);

View file

@ -87,16 +87,8 @@ class ChainedFastBackend implements CacheBackendInterface, CacheTagsInvalidatorI
* The fast cache backend.
* @param string $bin
* The cache bin for which the object is created.
*
* @throws \Exception
* When the consistent cache backend and the fast cache backend are the same
* service.
*/
public function __construct(CacheBackendInterface $consistent_backend, CacheBackendInterface $fast_backend, $bin) {
if ($consistent_backend == $fast_backend) {
// @todo: should throw a proper exception. See https://www.drupal.org/node/2751847.
trigger_error('Consistent cache backend and fast cache backend cannot use the same service.', E_USER_ERROR);
}
$this->consistentBackend = $consistent_backend;
$this->fastBackend = $fast_backend;
$this->bin = 'cache_' . $bin;

View file

@ -28,14 +28,14 @@ class ChainedFastBackendFactory implements CacheFactoryInterface {
/**
* Constructs ChainedFastBackendFactory object.
*
* @param \Drupal\Core\Site\Settings|NULL $settings
* @param \Drupal\Core\Site\Settings|null $settings
* (optional) The settings object.
* @param string|NULL $consistent_service_name
* @param string|null $consistent_service_name
* (optional) The service name of the consistent backend factory. Defaults
* to:
* - $settings->get('cache')['default'] (if specified)
* - 'cache.backend.database' (if the above isn't specified)
* @param string|NULL $fast_service_name
* @param string|null $fast_service_name
* (optional) The service name of the fast backend factory. Defaults to:
* - 'cache.backend.apcu' (if the PHP process has APCu enabled)
* - NULL (if the PHP process doesn't have APCu enabled)

View file

@ -3,7 +3,8 @@
namespace Drupal\Core\Cache\Context;
use Drupal\Core\Cache\CacheableMetadata;
use Symfony\Component\DependencyInjection\ContainerAware;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerAwareTrait;
/**
* Defines the MenuActiveTrailsCacheContext service.
@ -11,7 +12,9 @@ use Symfony\Component\DependencyInjection\ContainerAware;
* This class is container-aware to avoid initializing the 'menu.active_trails'
* service (and its dependencies) when it is not necessary.
*/
class MenuActiveTrailsCacheContext extends ContainerAware implements CalculatedCacheContextInterface {
class MenuActiveTrailsCacheContext implements CalculatedCacheContextInterface, ContainerAwareInterface {
use ContainerAwareTrait;
/**
* {@inheritdoc}

View file

@ -0,0 +1,35 @@
<?php
namespace Drupal\Core\Cache;
/**
* Trait to implement CacheableDependencyInterface for uncacheable objects.
*
* Use this for objects that are never cacheable.
*
* @see \Drupal\Core\Cache\CacheableDependencyInterface
*/
trait UncacheableDependencyTrait {
/**
* {@inheritdoc}
*/
public function getCacheContexts() {
return [];
}
/**
* {@inheritdoc}
*/
public function getCacheTags() {
return [];
}
/**
* {@inheritdoc}
*/
public function getCacheMaxAge() {
return 0;
}
}