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:
parent
2f563ab520
commit
f1c8716f57
1732 changed files with 52334 additions and 11780 deletions
|
@ -51,11 +51,16 @@ abstract class AccessResult implements AccessResultInterface, RefinableCacheable
|
|||
/**
|
||||
* Creates an AccessResultInterface object with isForbidden() === TRUE.
|
||||
*
|
||||
* @param string|null $reason
|
||||
* (optional) The reason why access is forbidden. Intended for developers,
|
||||
* hence not translatable.
|
||||
*
|
||||
* @return \Drupal\Core\Access\AccessResult
|
||||
* isForbidden() will be TRUE.
|
||||
*/
|
||||
public static function forbidden() {
|
||||
return new AccessResultForbidden();
|
||||
public static function forbidden($reason = NULL) {
|
||||
assert('is_string($reason) || is_null($reason)');
|
||||
return new AccessResultForbidden($reason);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -334,8 +339,16 @@ abstract class AccessResult implements AccessResultInterface, RefinableCacheable
|
|||
if ($this->isForbidden() || $other->isForbidden()) {
|
||||
$result = static::forbidden();
|
||||
if (!$this->isForbidden()) {
|
||||
if ($other instanceof AccessResultReasonInterface) {
|
||||
$result->setReason($other->getReason());
|
||||
}
|
||||
$merge_other = TRUE;
|
||||
}
|
||||
else {
|
||||
if ($this instanceof AccessResultReasonInterface) {
|
||||
$result->setReason($this->getReason());
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif ($this->isAllowed() && $other->isAllowed()) {
|
||||
$result = static::allowed();
|
||||
|
|
|
@ -5,7 +5,25 @@ namespace Drupal\Core\Access;
|
|||
/**
|
||||
* Value object indicating a forbidden access result, with cacheability metadata.
|
||||
*/
|
||||
class AccessResultForbidden extends AccessResult {
|
||||
class AccessResultForbidden extends AccessResult implements AccessResultReasonInterface {
|
||||
|
||||
/**
|
||||
* The reason why access is forbidden. For use in error messages.
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
protected $reason;
|
||||
|
||||
/**
|
||||
* Constructs a new AccessResultForbidden instance.
|
||||
*
|
||||
* @param null|string $reason
|
||||
* (optional) a message to provide details about this access result
|
||||
*/
|
||||
public function __construct($reason = NULL) {
|
||||
$this->reason = $reason;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
|
@ -14,4 +32,19 @@ class AccessResultForbidden extends AccessResult {
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getReason() {
|
||||
return $this->reason;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setReason($reason) {
|
||||
$this->reason = $reason;
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
36
core/lib/Drupal/Core/Access/AccessResultReasonInterface.php
Normal file
36
core/lib/Drupal/Core/Access/AccessResultReasonInterface.php
Normal file
|
@ -0,0 +1,36 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\Core\Access;
|
||||
|
||||
/**
|
||||
* Interface for access result value objects with stored reason for developers.
|
||||
*
|
||||
* For example, a developer can specify the reason for forbidden access:
|
||||
* @code
|
||||
* new AccessResultForbidden('You are not authorized to hack core');
|
||||
* @endcode
|
||||
*
|
||||
* @see \Drupal\Core\Access\AccessResultInterface
|
||||
*/
|
||||
interface AccessResultReasonInterface extends AccessResultInterface {
|
||||
|
||||
/**
|
||||
* Gets the reason for this access result.
|
||||
*
|
||||
* @return string|null
|
||||
* The reason of this access result or NULL if no reason is provided.
|
||||
*/
|
||||
public function getReason();
|
||||
|
||||
/**
|
||||
* Sets the reason for this access result.
|
||||
*
|
||||
* @param $reason string|null
|
||||
* The reason of this access result or NULL if no reason is provided.
|
||||
*
|
||||
* @return \Drupal\Core\Access\AccessResultInterface
|
||||
* The access result instance.
|
||||
*/
|
||||
public function setReason($reason);
|
||||
|
||||
}
|
|
@ -3,14 +3,17 @@
|
|||
namespace Drupal\Core\Access;
|
||||
|
||||
use Drupal\Core\Routing\Access\AccessInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerAware;
|
||||
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerAwareTrait;
|
||||
use Symfony\Component\Routing\Route;
|
||||
use Symfony\Component\Routing\RouteCollection;
|
||||
|
||||
/**
|
||||
* Loads access checkers from the container.
|
||||
*/
|
||||
class CheckProvider extends ContainerAware implements CheckProviderInterface {
|
||||
class CheckProvider implements CheckProviderInterface, ContainerAwareInterface {
|
||||
|
||||
use ContainerAwareTrait;
|
||||
|
||||
/**
|
||||
* Array of registered access check service ids.
|
||||
|
|
112
core/lib/Drupal/Core/Access/CsrfRequestHeaderAccessCheck.php
Normal file
112
core/lib/Drupal/Core/Access/CsrfRequestHeaderAccessCheck.php
Normal file
|
@ -0,0 +1,112 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\Core\Access;
|
||||
|
||||
use Drupal\Core\Session\AccountInterface;
|
||||
use Drupal\Core\Session\SessionConfigurationInterface;
|
||||
use Symfony\Component\Routing\Route;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
/**
|
||||
* Access protection against CSRF attacks.
|
||||
*/
|
||||
class CsrfRequestHeaderAccessCheck implements AccessCheckInterface {
|
||||
|
||||
/**
|
||||
* A string key that will used to designate the token used by this class.
|
||||
*/
|
||||
const TOKEN_KEY = 'X-CSRF-Token request header';
|
||||
|
||||
/**
|
||||
* The session configuration.
|
||||
*
|
||||
* @var \Drupal\Core\Session\SessionConfigurationInterface
|
||||
*/
|
||||
protected $sessionConfiguration;
|
||||
|
||||
/**
|
||||
* The token generator.
|
||||
*
|
||||
* @var \Drupal\Core\Access\CsrfTokenGenerator
|
||||
*/
|
||||
protected $csrfToken;
|
||||
|
||||
/**
|
||||
* Constructs a new rest CSRF access check.
|
||||
*
|
||||
* @param \Drupal\Core\Session\SessionConfigurationInterface $session_configuration
|
||||
* The session configuration.
|
||||
* @param \Drupal\Core\Access\CsrfTokenGenerator $csrf_token
|
||||
* The token generator.
|
||||
*/
|
||||
public function __construct(SessionConfigurationInterface $session_configuration, CsrfTokenGenerator $csrf_token) {
|
||||
$this->sessionConfiguration = $session_configuration;
|
||||
$this->csrfToken = $csrf_token;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function applies(Route $route) {
|
||||
$requirements = $route->getRequirements();
|
||||
// Check for current requirement _csrf_request_header_token and deprecated
|
||||
// REST requirement.
|
||||
$applicable_requirements = [
|
||||
'_csrf_request_header_token',
|
||||
// @todo Remove _access_rest_csrf in Drupal 9.0.0.
|
||||
'_access_rest_csrf',
|
||||
];
|
||||
$requirement_keys = array_keys($requirements);
|
||||
|
||||
if (array_intersect($applicable_requirements, $requirement_keys)) {
|
||||
if (isset($requirements['_method'])) {
|
||||
// There could be more than one method requirement separated with '|'.
|
||||
$methods = explode('|', $requirements['_method']);
|
||||
// CSRF protection only applies to write operations, so we can filter
|
||||
// out any routes that require reading methods only.
|
||||
$write_methods = array_diff($methods, array('GET', 'HEAD', 'OPTIONS', 'TRACE'));
|
||||
if (empty($write_methods)) {
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
// No method requirement given, so we run this access check to be on the
|
||||
// safe side.
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks access.
|
||||
*
|
||||
* @param \Symfony\Component\HttpFoundation\Request $request
|
||||
* The request object.
|
||||
* @param \Drupal\Core\Session\AccountInterface $account
|
||||
* The currently logged in account.
|
||||
*
|
||||
* @return \Drupal\Core\Access\AccessResultInterface
|
||||
* The access result.
|
||||
*/
|
||||
public function access(Request $request, AccountInterface $account) {
|
||||
$method = $request->getMethod();
|
||||
|
||||
// This check only applies if
|
||||
// 1. this is a write operation
|
||||
// 2. the user was successfully authenticated and
|
||||
// 3. the request comes with a session cookie.
|
||||
if (!in_array($method, array('GET', 'HEAD', 'OPTIONS', 'TRACE'))
|
||||
&& $account->isAuthenticated()
|
||||
&& $this->sessionConfiguration->hasSession($request)
|
||||
) {
|
||||
$csrf_token = $request->headers->get('X-CSRF-Token');
|
||||
// @todo Remove validate call using 'rest' in 8.3.
|
||||
// Kept here for sessions active during update.
|
||||
if (!$this->csrfToken->validate($csrf_token, self::TOKEN_KEY)
|
||||
&& !$this->csrfToken->validate($csrf_token, 'rest')) {
|
||||
return AccessResult::forbidden()->setReason('X-CSRF-Token request header is missing')->setCacheMaxAge(0);
|
||||
}
|
||||
}
|
||||
// Let other access checkers decide if the request is legit.
|
||||
return AccessResult::allowed()->setCacheMaxAge(0);
|
||||
}
|
||||
|
||||
}
|
|
@ -40,13 +40,13 @@ class CssCollectionOptimizer implements AssetCollectionOptimizerInterface {
|
|||
/**
|
||||
* Constructs a CssCollectionOptimizer.
|
||||
*
|
||||
* @param \Drupal\Core\Asset\AssetCollectionGrouperInterface
|
||||
* @param \Drupal\Core\Asset\AssetCollectionGrouperInterface $grouper
|
||||
* The grouper for CSS assets.
|
||||
* @param \Drupal\Core\Asset\AssetOptimizerInterface
|
||||
* @param \Drupal\Core\Asset\AssetOptimizerInterface $optimizer
|
||||
* The optimizer for a single CSS asset.
|
||||
* @param \Drupal\Core\Asset\AssetDumperInterface
|
||||
* @param \Drupal\Core\Asset\AssetDumperInterface $dumper
|
||||
* The dumper for optimized CSS assets.
|
||||
* @param \Drupal\Core\State\StateInterface
|
||||
* @param \Drupal\Core\State\StateInterface $state
|
||||
* The state key/value store.
|
||||
*/
|
||||
public function __construct(AssetCollectionGrouperInterface $grouper, AssetOptimizerInterface $optimizer, AssetDumperInterface $dumper, StateInterface $state) {
|
||||
|
|
|
@ -63,7 +63,7 @@ class CssCollectionRenderer implements AssetCollectionRendererInterface {
|
|||
/**
|
||||
* Constructs a CssCollectionRenderer.
|
||||
*
|
||||
* @param \Drupal\Core\State\StateInterface
|
||||
* @param \Drupal\Core\State\StateInterface $state
|
||||
* The state key/value store.
|
||||
*/
|
||||
public function __construct(StateInterface $state) {
|
||||
|
|
|
@ -41,13 +41,13 @@ class JsCollectionOptimizer implements AssetCollectionOptimizerInterface {
|
|||
/**
|
||||
* Constructs a JsCollectionOptimizer.
|
||||
*
|
||||
* @param \Drupal\Core\Asset\AssetCollectionGrouperInterface
|
||||
* @param \Drupal\Core\Asset\AssetCollectionGrouperInterface $grouper
|
||||
* The grouper for JS assets.
|
||||
* @param \Drupal\Core\Asset\AssetOptimizerInterface
|
||||
* @param \Drupal\Core\Asset\AssetOptimizerInterface $optimizer
|
||||
* The optimizer for a single JS asset.
|
||||
* @param \Drupal\Core\Asset\AssetDumperInterface
|
||||
* @param \Drupal\Core\Asset\AssetDumperInterface $dumper
|
||||
* The dumper for optimized JS assets.
|
||||
* @param \Drupal\Core\State\StateInterface
|
||||
* @param \Drupal\Core\State\StateInterface $state
|
||||
* The state key/value store.
|
||||
*/
|
||||
public function __construct(AssetCollectionGrouperInterface $grouper, AssetOptimizerInterface $optimizer, AssetDumperInterface $dumper, StateInterface $state) {
|
||||
|
|
|
@ -20,7 +20,7 @@ class JsCollectionRenderer implements AssetCollectionRendererInterface {
|
|||
/**
|
||||
* Constructs a JsCollectionRenderer.
|
||||
*
|
||||
* @param \Drupal\Core\State\StateInterface
|
||||
* @param \Drupal\Core\State\StateInterface $state
|
||||
* The state key/value store.
|
||||
*/
|
||||
public function __construct(StateInterface $state) {
|
||||
|
|
|
@ -39,7 +39,7 @@ interface LibraryDiscoveryInterface {
|
|||
* @param string $name
|
||||
* The name of a registered library to retrieve.
|
||||
*
|
||||
* @return array|FALSE
|
||||
* @return array|false
|
||||
* The definition of the requested library, if $name was passed and it
|
||||
* exists, otherwise FALSE.
|
||||
*/
|
||||
|
|
|
@ -7,9 +7,9 @@ use Drupal\Core\Asset\Exception\InvalidLibrariesOverrideSpecificationException;
|
|||
use Drupal\Core\Asset\Exception\InvalidLibraryFileException;
|
||||
use Drupal\Core\Asset\Exception\LibraryDefinitionMissingLicenseException;
|
||||
use Drupal\Core\Extension\ModuleHandlerInterface;
|
||||
use Drupal\Core\Serialization\Yaml;
|
||||
use Drupal\Core\Theme\ThemeManagerInterface;
|
||||
use Drupal\Component\Serialization\Exception\InvalidDataTypeException;
|
||||
use Drupal\Component\Serialization\Yaml;
|
||||
use Drupal\Component\Utility\NestedArray;
|
||||
|
||||
/**
|
||||
|
|
|
@ -41,7 +41,7 @@ interface AuthenticationCollectorInterface {
|
|||
* @param string $provider_id
|
||||
* The provider ID.
|
||||
*
|
||||
* @return \Drupal\Core\Authentication\AuthenticationProviderInterface|NULL
|
||||
* @return \Drupal\Core\Authentication\AuthenticationProviderInterface|null
|
||||
* The authentication provider which matches the ID.
|
||||
*/
|
||||
public function getProvider($provider_id);
|
||||
|
|
|
@ -94,7 +94,7 @@ class AuthenticationManager implements AuthenticationProviderInterface, Authenti
|
|||
* @param \Symfony\Component\HttpFoundation\Request $request
|
||||
* The incoming request.
|
||||
*
|
||||
* @return string|NULL
|
||||
* @return string|null
|
||||
* The id of the first authentication provider which applies to the request.
|
||||
* If no application detects appropriate credentials, then NULL is returned.
|
||||
*/
|
||||
|
@ -112,7 +112,7 @@ class AuthenticationManager implements AuthenticationProviderInterface, Authenti
|
|||
* @param \Symfony\Component\HttpFoundation\Request $request
|
||||
* The incoming request.
|
||||
*
|
||||
* @return string|NULL
|
||||
* @return string|null
|
||||
* The ID of the first authentication provider which applies to the request.
|
||||
* If no application detects appropriate credentials, then NULL is returned.
|
||||
*/
|
||||
|
|
|
@ -21,7 +21,7 @@ interface AuthenticationProviderChallengeInterface {
|
|||
* @param \Exception $previous
|
||||
* The previous exception.
|
||||
*
|
||||
* @return \Symfony\Component\HttpKernel\Exception\HttpExceptionInterface|NULL
|
||||
* @return \Symfony\Component\HttpKernel\Exception\HttpExceptionInterface|null
|
||||
* An exception to be used in order to generate an authentication challenge.
|
||||
*/
|
||||
public function challengeException(Request $request, \Exception $previous);
|
||||
|
|
|
@ -24,10 +24,10 @@ interface AuthenticationProviderInterface {
|
|||
/**
|
||||
* Authenticates the user.
|
||||
*
|
||||
* @param \Symfony\Component\HttpFoundation\Request|NULL $request
|
||||
* @param \Symfony\Component\HttpFoundation\Request|null $request
|
||||
* The request object.
|
||||
*
|
||||
* @return \Drupal\Core\Session\AccountInterface|NULL
|
||||
* @return \Drupal\Core\Session\AccountInterface|null
|
||||
* AccountInterface - in case of a successful authentication.
|
||||
* NULL - in case where authentication failed.
|
||||
*/
|
||||
|
|
|
@ -10,6 +10,8 @@ use Drupal\Core\Plugin\ContextAwarePluginBase;
|
|||
use Drupal\Component\Utility\Unicode;
|
||||
use Drupal\Component\Utility\NestedArray;
|
||||
use Drupal\Core\Language\LanguageInterface;
|
||||
use Drupal\Core\Plugin\PluginWithFormsInterface;
|
||||
use Drupal\Core\Plugin\PluginWithFormsTrait;
|
||||
use Drupal\Core\Session\AccountInterface;
|
||||
use Drupal\Component\Transliteration\TransliterationInterface;
|
||||
|
||||
|
@ -22,9 +24,10 @@ use Drupal\Component\Transliteration\TransliterationInterface;
|
|||
*
|
||||
* @ingroup block_api
|
||||
*/
|
||||
abstract class BlockBase extends ContextAwarePluginBase implements BlockPluginInterface {
|
||||
abstract class BlockBase extends ContextAwarePluginBase implements BlockPluginInterface, PluginWithFormsInterface {
|
||||
|
||||
use ContextAwarePluginAssignmentTrait;
|
||||
use PluginWithFormsTrait;
|
||||
|
||||
/**
|
||||
* The transliteration service.
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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}
|
||||
|
|
35
core/lib/Drupal/Core/Cache/UncacheableDependencyTrait.php
Normal file
35
core/lib/Drupal/Core/Cache/UncacheableDependencyTrait.php
Normal 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;
|
||||
}
|
||||
|
||||
}
|
|
@ -33,7 +33,7 @@ class DbDumpCommand extends DbCommandBase {
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $excludeTables = ['simpletest.+'];
|
||||
protected $excludeTables = ['test[0-9]+'];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
|
|
|
@ -196,7 +196,7 @@ EOT;
|
|||
* @param string $package_name
|
||||
* The package name from composer. This is always already lower case.
|
||||
*
|
||||
* @return NULL|string
|
||||
* @return string|null
|
||||
* The string key, or NULL if none was found.
|
||||
*/
|
||||
protected static function findPackageKey($package_name) {
|
||||
|
|
|
@ -26,8 +26,9 @@ trait ConditionAccessResolverTrait {
|
|||
$pass = $condition->execute();
|
||||
}
|
||||
catch (ContextException $e) {
|
||||
// If a condition is missing context, consider that a fail.
|
||||
$pass = FALSE;
|
||||
// If a condition is missing context and is not negated, consider that a
|
||||
// fail.
|
||||
$pass = $condition->isNegated();
|
||||
}
|
||||
|
||||
// If a condition fails and all conditions were needed, deny access.
|
||||
|
|
|
@ -5,6 +5,7 @@ namespace Drupal\Core\Condition;
|
|||
use Drupal\Core\Executable\ExecutableManagerInterface;
|
||||
use Drupal\Core\Executable\ExecutablePluginBase;
|
||||
use Drupal\Core\Form\FormStateInterface;
|
||||
use Drupal\Core\Form\SubformStateInterface;
|
||||
use Drupal\Core\Plugin\ContextAwarePluginAssignmentTrait;
|
||||
|
||||
/**
|
||||
|
@ -47,6 +48,9 @@ abstract class ConditionPluginBase extends ExecutablePluginBase implements Condi
|
|||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
|
||||
if ($form_state instanceof SubformStateInterface) {
|
||||
$form_state = $form_state->getCompleteFormState();
|
||||
}
|
||||
$contexts = $form_state->getTemporaryValue('gathered_contexts') ?: [];
|
||||
$form['context_mapping'] = $this->addContextAssignmentElement($this, $contexts);
|
||||
$form['negate'] = array(
|
||||
|
@ -68,6 +72,9 @@ abstract class ConditionPluginBase extends ExecutablePluginBase implements Condi
|
|||
*/
|
||||
public function submitConfigurationForm(array &$form, FormStateInterface $form_state) {
|
||||
$this->configuration['negate'] = $form_state->getValue('negate');
|
||||
if ($form_state->hasValue('context_mapping')) {
|
||||
$this->setContextMapping($form_state->getValue('context_mapping'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -24,7 +24,7 @@ class ConfigCollectionInfo extends Event {
|
|||
*
|
||||
* @param string $collection
|
||||
* Collection name to add.
|
||||
* @param \Drupal\Core\Config\ConfigFactoryOverrideInterface
|
||||
* @param \Drupal\Core\Config\ConfigFactoryOverrideInterface $override_service
|
||||
* (optional) The configuration factory override service responsible for the
|
||||
* collection.
|
||||
*
|
||||
|
@ -63,7 +63,7 @@ class ConfigCollectionInfo extends Event {
|
|||
* @param string $collection
|
||||
* The configuration collection.
|
||||
*
|
||||
* @return \Drupal\Core\Config\ConfigFactoryOverrideInterface|NULL
|
||||
* @return \Drupal\Core\Config\ConfigFactoryOverrideInterface|null
|
||||
* The override service responsible for the collection if one exists. NULL
|
||||
* if not.
|
||||
*/
|
||||
|
|
|
@ -19,7 +19,7 @@ class ConfigCrudEvent extends Event {
|
|||
/**
|
||||
* Constructs a configuration event object.
|
||||
*
|
||||
* @param \Drupal\Core\Config\Config
|
||||
* @param \Drupal\Core\Config\Config $config
|
||||
* Configuration object.
|
||||
*/
|
||||
public function __construct(Config $config) {
|
||||
|
|
|
@ -511,6 +511,7 @@ class ConfigInstaller implements ConfigInstallerInterface {
|
|||
* TRUE if the dependencies are met, FALSE if not.
|
||||
*/
|
||||
protected function validateDependencies($config_name, array $data, array $enabled_extensions, array $all_config) {
|
||||
list($provider) = explode('.', $config_name, 2);
|
||||
if (isset($data['dependencies'])) {
|
||||
$all_dependencies = $data['dependencies'];
|
||||
|
||||
|
@ -521,7 +522,6 @@ class ConfigInstaller implements ConfigInstallerInterface {
|
|||
}
|
||||
// Ensure the configuration entity type provider is in the list of
|
||||
// dependencies.
|
||||
list($provider) = explode('.', $config_name, 2);
|
||||
if (!isset($all_dependencies['module'])) {
|
||||
$all_dependencies['module'][] = $provider;
|
||||
}
|
||||
|
@ -548,6 +548,10 @@ class ConfigInstaller implements ConfigInstallerInterface {
|
|||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Simple config or a config entity without dependencies.
|
||||
return in_array($provider, $enabled_extensions, TRUE);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ interface ConfigInstallerInterface {
|
|||
* - it's a configuration entity.
|
||||
* - its dependencies can be met.
|
||||
*
|
||||
* @param \Drupal\Core\Config\StorageInterface
|
||||
* @param \Drupal\Core\Config\StorageInterface $storage
|
||||
* (optional) The configuration storage to search for optional
|
||||
* configuration. If not provided, all enabled extension's optional
|
||||
* configuration directories will be searched.
|
||||
|
|
|
@ -3,12 +3,12 @@
|
|||
namespace Drupal\Core\Config;
|
||||
|
||||
use Drupal\Component\Diff\Diff;
|
||||
use Drupal\Component\Serialization\Yaml;
|
||||
use Drupal\Core\Config\Entity\ConfigDependencyManager;
|
||||
use Drupal\Core\Config\Entity\ConfigEntityInterface;
|
||||
use Drupal\Core\Config\Entity\ConfigEntityTypeInterface;
|
||||
use Drupal\Core\Entity\EntityManagerInterface;
|
||||
use Drupal\Core\Entity\EntityTypeInterface;
|
||||
use Drupal\Core\Serialization\Yaml;
|
||||
use Drupal\Core\StringTranslation\StringTranslationTrait;
|
||||
use Drupal\Core\StringTranslation\TranslationInterface;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||
|
|
|
@ -37,7 +37,7 @@ class ConfigModuleOverridesEvent extends Event {
|
|||
*
|
||||
* @param array $names
|
||||
* A list of configuration names.
|
||||
* @param \Drupal\Core\Language\LanguageInterface
|
||||
* @param \Drupal\Core\Language\LanguageInterface $language
|
||||
* (optional) The language for this configuration.
|
||||
*/
|
||||
public function __construct(array $names, LanguageInterface $language = NULL) {
|
||||
|
|
|
@ -174,10 +174,34 @@ class ConfigDependencyManager {
|
|||
// always after field storages. This is because field storages need to be
|
||||
// created before a field.
|
||||
$graph = $this->getGraph();
|
||||
uasort($graph, array($this, 'sortGraph'));
|
||||
$sorts = $this->prepareMultisort($graph, ['weight', 'name']);
|
||||
array_multisort($sorts['weight'], SORT_DESC, SORT_NUMERIC, $sorts['name'], SORT_ASC, SORT_NATURAL | SORT_FLAG_CASE, $graph);
|
||||
return array_replace(array_intersect_key($graph, $dependencies), $dependencies);
|
||||
}
|
||||
|
||||
/**
|
||||
* Extracts data from the graph for use in array_multisort().
|
||||
*
|
||||
* @param array $graph
|
||||
* The graph to extract data from.
|
||||
* @param array $keys
|
||||
* The keys whose values to extract.
|
||||
*
|
||||
* @return
|
||||
* An array keyed by the $keys passed in. The values are arrays keyed by the
|
||||
* row from the graph and the value is the corresponding value for the key
|
||||
* from the graph.
|
||||
*/
|
||||
protected function prepareMultisort($graph, $keys) {
|
||||
$return = array_fill_keys($keys, []);
|
||||
foreach ($graph as $graph_key => $graph_row) {
|
||||
foreach ($keys as $key) {
|
||||
$return[$key][$graph_key] = $graph_row[$key];
|
||||
}
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sorts the dependencies in order of most dependent last.
|
||||
*
|
||||
|
@ -189,7 +213,8 @@ class ConfigDependencyManager {
|
|||
$graph = $this->getGraph();
|
||||
// Sort by weight and alphabetically. The most dependent entities
|
||||
// are last and entities with the same weight are alphabetically ordered.
|
||||
uasort($graph, array($this, 'sortGraphByWeight'));
|
||||
$sorts = $this->prepareMultisort($graph, ['weight', 'name']);
|
||||
array_multisort($sorts['weight'], SORT_ASC, SORT_NUMERIC, $sorts['name'], SORT_ASC, SORT_NATURAL | SORT_FLAG_CASE, $graph);
|
||||
// Use array_intersect_key() to exclude modules and themes from the list.
|
||||
return array_keys(array_intersect_key($graph, $this->data));
|
||||
}
|
||||
|
@ -197,6 +222,10 @@ class ConfigDependencyManager {
|
|||
/**
|
||||
* Sorts the dependency graph by weight and alphabetically.
|
||||
*
|
||||
* @deprecated in Drupal 8.2.0, will be removed before Drupal 9.0.0. Use
|
||||
* \Drupal\Core\Config\Entity\ConfigDependencyManager::prepareMultisort() and
|
||||
* array_multisort() instead.
|
||||
*
|
||||
* @param array $a
|
||||
* First item for comparison. The compared items should be associative
|
||||
* arrays that include a 'weight' and a 'name' key.
|
||||
|
@ -218,6 +247,10 @@ class ConfigDependencyManager {
|
|||
/**
|
||||
* Sorts the dependency graph by reverse weight and alphabetically.
|
||||
*
|
||||
* @deprecated in Drupal 8.2.0, will be removed before Drupal 9.0.0. Use
|
||||
* \Drupal\Core\Config\Entity\ConfigDependencyManager::prepareMultisort() and
|
||||
* array_multisort() instead.
|
||||
*
|
||||
* @param array $a
|
||||
* First item for comparison. The compared items should be associative
|
||||
* arrays that include a 'weight' and a 'name' key.
|
||||
|
|
|
@ -65,7 +65,7 @@ interface ConfigEntityTypeInterface extends EntityTypeInterface {
|
|||
/**
|
||||
* Gets the config entity properties to export if declared on the annotation.
|
||||
*
|
||||
* @return array|NULL
|
||||
* @return array|null
|
||||
* The properties to export or NULL if they can not be determine from the
|
||||
* config entity type annotation.
|
||||
*/
|
||||
|
|
|
@ -135,7 +135,7 @@ abstract class DraggableListBuilder extends ConfigEntityListBuilder implements F
|
|||
$form['actions']['#type'] = 'actions';
|
||||
$form['actions']['submit'] = array(
|
||||
'#type' => 'submit',
|
||||
'#value' => t('Save order'),
|
||||
'#value' => t('Save'),
|
||||
'#button_type' => 'primary',
|
||||
);
|
||||
|
||||
|
|
|
@ -66,8 +66,8 @@ class QueryFactory implements QueryFactoryInterface, EventSubscriberInterface {
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getAggregate(EntityTypeInterface $entity_type, $conjunction) {
|
||||
throw new QueryException('Aggregation over configuration entities is not supported');
|
||||
public function getAggregate(EntityTypeInterface $entity_type, $conjunction) {
|
||||
throw new QueryException('Aggregation over configuration entities is not supported');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -189,7 +189,7 @@ class QueryFactory implements QueryFactoryInterface, EventSubscriberInterface {
|
|||
* @param int $start
|
||||
* Which position of $parts we are processing. Defaults to 0.
|
||||
*
|
||||
* @return array|NULL
|
||||
* @return array|null
|
||||
* The array of configuration values the match the provided key. NULL if
|
||||
* the configuration object does not have a value that corresponds to the
|
||||
* key.
|
||||
|
|
|
@ -44,9 +44,8 @@ class ExtensionInstallStorage extends InstallStorage {
|
|||
* search and to get overrides from.
|
||||
*/
|
||||
public function __construct(StorageInterface $config_storage, $directory = self::CONFIG_INSTALL_DIRECTORY, $collection = StorageInterface::DEFAULT_COLLECTION, $include_profile = TRUE) {
|
||||
parent::__construct($directory, $collection);
|
||||
$this->configStorage = $config_storage;
|
||||
$this->directory = $directory;
|
||||
$this->collection = $collection;
|
||||
$this->includeProfile = $include_profile;
|
||||
}
|
||||
|
||||
|
|
|
@ -2,8 +2,9 @@
|
|||
|
||||
namespace Drupal\Core\Config;
|
||||
|
||||
use Drupal\Component\Serialization\Yaml;
|
||||
use Drupal\Component\FileCache\FileCacheFactory;
|
||||
use Drupal\Component\Serialization\Exception\InvalidDataTypeException;
|
||||
use Drupal\Core\Serialization\Yaml;
|
||||
|
||||
/**
|
||||
* Defines the file storage.
|
||||
|
@ -24,6 +25,13 @@ class FileStorage implements StorageInterface {
|
|||
*/
|
||||
protected $directory = '';
|
||||
|
||||
/**
|
||||
* The file cache object.
|
||||
*
|
||||
* @var \Drupal\Component\FileCache\FileCacheInterface
|
||||
*/
|
||||
protected $fileCache;
|
||||
|
||||
/**
|
||||
* Constructs a new FileStorage.
|
||||
*
|
||||
|
@ -36,6 +44,11 @@ class FileStorage implements StorageInterface {
|
|||
public function __construct($directory, $collection = StorageInterface::DEFAULT_COLLECTION) {
|
||||
$this->directory = $directory;
|
||||
$this->collection = $collection;
|
||||
|
||||
// Use a NULL File Cache backend by default. This will ensure only the
|
||||
// internal statc caching of FileCache is used and thus avoids blowing up
|
||||
// the APCu cache.
|
||||
$this->fileCache = FileCacheFactory::get('config', ['cache_backend_class' => NULL]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -90,7 +103,12 @@ class FileStorage implements StorageInterface {
|
|||
if (!$this->exists($name)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
$filepath = $this->getFilePath($name);
|
||||
if ($data = $this->fileCache->get($filepath)) {
|
||||
return $data;
|
||||
}
|
||||
|
||||
$data = file_get_contents($filepath);
|
||||
try {
|
||||
$data = $this->decode($data);
|
||||
|
@ -98,6 +116,8 @@ class FileStorage implements StorageInterface {
|
|||
catch (InvalidDataTypeException $e) {
|
||||
throw new UnsupportedDataTypeConfigException('Invalid data type in config ' . $name . ', found in file' . $filepath . ' : ' . $e->getMessage());
|
||||
}
|
||||
$this->fileCache->set($filepath, $data);
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
@ -119,18 +139,18 @@ class FileStorage implements StorageInterface {
|
|||
*/
|
||||
public function write($name, array $data) {
|
||||
try {
|
||||
$data = $this->encode($data);
|
||||
$encoded_data = $this->encode($data);
|
||||
}
|
||||
catch (InvalidDataTypeException $e) {
|
||||
throw new StorageException("Invalid data type in config $name: {$e->getMessage()}");
|
||||
}
|
||||
|
||||
$target = $this->getFilePath($name);
|
||||
$status = @file_put_contents($target, $data);
|
||||
$status = @file_put_contents($target, $encoded_data);
|
||||
if ($status === FALSE) {
|
||||
// Try to make sure the directory exists and try writing again.
|
||||
$this->ensureStorage();
|
||||
$status = @file_put_contents($target, $data);
|
||||
$status = @file_put_contents($target, $encoded_data);
|
||||
}
|
||||
if ($status === FALSE) {
|
||||
throw new StorageException('Failed to write configuration file: ' . $this->getFilePath($name));
|
||||
|
@ -138,6 +158,9 @@ class FileStorage implements StorageInterface {
|
|||
else {
|
||||
drupal_chmod($target);
|
||||
}
|
||||
|
||||
$this->fileCache->set($target, $data);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -152,6 +175,7 @@ class FileStorage implements StorageInterface {
|
|||
}
|
||||
return FALSE;
|
||||
}
|
||||
$this->fileCache->delete($this->getFilePath($name));
|
||||
return drupal_unlink($this->getFilePath($name));
|
||||
}
|
||||
|
||||
|
@ -163,6 +187,8 @@ class FileStorage implements StorageInterface {
|
|||
if ($status === FALSE) {
|
||||
throw new StorageException('Failed to rename configuration file from: ' . $this->getFilePath($name) . ' to: ' . $this->getFilePath($new_name));
|
||||
}
|
||||
$this->fileCache->delete($this->getFilePath($name));
|
||||
$this->fileCache->delete($this->getFilePath($new_name));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -58,8 +58,7 @@ class InstallStorage extends FileStorage {
|
|||
* default collection.
|
||||
*/
|
||||
public function __construct($directory = self::CONFIG_INSTALL_DIRECTORY, $collection = StorageInterface::DEFAULT_COLLECTION) {
|
||||
$this->directory = $directory;
|
||||
$this->collection = $collection;
|
||||
parent::__construct($directory, $collection);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
namespace Drupal\Core\Controller;
|
||||
|
||||
use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
|
||||
use Drupal\Core\Logger\LoggerChannelTrait;
|
||||
use Drupal\Core\Routing\LinkGeneratorTrait;
|
||||
use Drupal\Core\Routing\RedirectDestinationTrait;
|
||||
use Drupal\Core\Routing\UrlGeneratorTrait;
|
||||
|
@ -33,6 +34,7 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
|
|||
abstract class ControllerBase implements ContainerInjectionInterface {
|
||||
|
||||
use LinkGeneratorTrait;
|
||||
use LoggerChannelTrait;
|
||||
use RedirectDestinationTrait;
|
||||
use StringTranslationTrait;
|
||||
use UrlGeneratorTrait;
|
||||
|
@ -107,13 +109,6 @@ abstract class ControllerBase implements ContainerInjectionInterface {
|
|||
*/
|
||||
protected $formBuilder;
|
||||
|
||||
/**
|
||||
* The logger factory.
|
||||
*
|
||||
* @var \Psr\Log\LoggerInterface
|
||||
*/
|
||||
protected $loggerFactory;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
@ -284,23 +279,6 @@ abstract class ControllerBase implements ContainerInjectionInterface {
|
|||
return $this->languageManager;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a channel logger object.
|
||||
*
|
||||
* @param string $channel
|
||||
* The name of the channel. Can be any string, but the general practice is
|
||||
* to use the name of the subsystem calling this.
|
||||
*
|
||||
* @return \Psr\Log\LoggerInterface
|
||||
* The logger for this channel.
|
||||
*/
|
||||
protected function getLogger($channel) {
|
||||
if (!$this->loggerFactory) {
|
||||
$this->loggerFactory = $this->container()->get('logger.factory');
|
||||
}
|
||||
return $this->loggerFactory->get($channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the service container.
|
||||
*
|
||||
|
|
|
@ -4,7 +4,9 @@ namespace Drupal\Core;
|
|||
|
||||
use Drupal\Core\Cache\Context\CacheContextsPass;
|
||||
use Drupal\Core\Cache\ListCacheBinsPass;
|
||||
use Drupal\Core\DependencyInjection\Compiler\AuthenticationProviderPass;
|
||||
use Drupal\Core\DependencyInjection\Compiler\BackendCompilerPass;
|
||||
use Drupal\Core\DependencyInjection\Compiler\CorsCompilerPass;
|
||||
use Drupal\Core\DependencyInjection\Compiler\GuzzleMiddlewarePass;
|
||||
use Drupal\Core\DependencyInjection\Compiler\ContextProvidersPass;
|
||||
use Drupal\Core\DependencyInjection\Compiler\ProxyServicesPass;
|
||||
|
@ -15,6 +17,7 @@ use Drupal\Core\DependencyInjection\Compiler\StackedKernelPass;
|
|||
use Drupal\Core\DependencyInjection\Compiler\StackedSessionHandlerPass;
|
||||
use Drupal\Core\DependencyInjection\Compiler\RegisterStreamWrappersPass;
|
||||
use Drupal\Core\DependencyInjection\Compiler\TwigExtensionPass;
|
||||
use Drupal\Core\DependencyInjection\ServiceModifierInterface;
|
||||
use Drupal\Core\DependencyInjection\ServiceProviderInterface;
|
||||
use Drupal\Core\DependencyInjection\ContainerBuilder;
|
||||
use Drupal\Core\DependencyInjection\Compiler\ModifyServiceDefinitionsPass;
|
||||
|
@ -39,12 +42,12 @@ use Symfony\Component\DependencyInjection\Compiler\PassConfig;
|
|||
*
|
||||
* @ingroup container
|
||||
*/
|
||||
class CoreServiceProvider implements ServiceProviderInterface {
|
||||
class CoreServiceProvider implements ServiceProviderInterface, ServiceModifierInterface {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function register(ContainerBuilder $container) {
|
||||
$this->registerUuid($container);
|
||||
$this->registerTest($container);
|
||||
|
||||
// Only register the private file stream wrapper if a file path has been set.
|
||||
|
@ -62,6 +65,8 @@ class CoreServiceProvider implements ServiceProviderInterface {
|
|||
|
||||
$container->addCompilerPass(new BackendCompilerPass());
|
||||
|
||||
$container->addCompilerPass(new CorsCompilerPass());
|
||||
|
||||
$container->addCompilerPass(new StackedKernelPass());
|
||||
|
||||
$container->addCompilerPass(new StackedSessionHandlerPass());
|
||||
|
@ -89,6 +94,7 @@ class CoreServiceProvider implements ServiceProviderInterface {
|
|||
$container->addCompilerPass(new ListCacheBinsPass());
|
||||
$container->addCompilerPass(new CacheContextsPass());
|
||||
$container->addCompilerPass(new ContextProvidersPass());
|
||||
$container->addCompilerPass(new AuthenticationProviderPass());
|
||||
|
||||
// Register plugin managers.
|
||||
$container->addCompilerPass(new PluginManagerPass());
|
||||
|
@ -97,30 +103,23 @@ class CoreServiceProvider implements ServiceProviderInterface {
|
|||
}
|
||||
|
||||
/**
|
||||
* Determines and registers the UUID service.
|
||||
* Alters the UUID service to use the most efficient method available.
|
||||
*
|
||||
* @param \Drupal\Core\DependencyInjection\ContainerBuilder $container
|
||||
* The container builder.
|
||||
*
|
||||
* @return string
|
||||
* Class name for the UUID service.
|
||||
*/
|
||||
public static function registerUuid(ContainerBuilder $container) {
|
||||
$uuid_class = 'Drupal\Component\Uuid\Php';
|
||||
|
||||
public function alter(ContainerBuilder $container) {
|
||||
$uuid_service = $container->getDefinition('uuid');
|
||||
// Debian/Ubuntu uses the (broken) OSSP extension as their UUID
|
||||
// implementation. The OSSP implementation is not compatible with the
|
||||
// PECL functions.
|
||||
if (function_exists('uuid_create') && !function_exists('uuid_make')) {
|
||||
$uuid_class = 'Drupal\Component\Uuid\Pecl';
|
||||
$uuid_service->setClass('Drupal\Component\Uuid\Pecl');
|
||||
}
|
||||
// Try to use the COM implementation for Windows users.
|
||||
elseif (function_exists('com_create_guid')) {
|
||||
$uuid_class = 'Drupal\Component\Uuid\Com';
|
||||
$uuid_service->setClass('Drupal\Component\Uuid\Com');
|
||||
}
|
||||
|
||||
$container->register('uuid', $uuid_class);
|
||||
return $uuid_class;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace Drupal\Core;
|
||||
|
||||
use Drupal\Component\Utility\Timer;
|
||||
use Drupal\Core\Extension\ModuleHandlerInterface;
|
||||
use Drupal\Core\Queue\QueueWorkerManagerInterface;
|
||||
use Drupal\Core\Queue\RequeueException;
|
||||
|
@ -82,7 +83,7 @@ class Cron implements CronInterface {
|
|||
* The account switching service.
|
||||
* @param \Psr\Log\LoggerInterface $logger
|
||||
* A logger instance.
|
||||
* @param \Drupal\Core\Queue\QueueWorkerManagerInterface
|
||||
* @param \Drupal\Core\Queue\QueueWorkerManagerInterface $queue_manager
|
||||
* The queue plugin manager.
|
||||
*/
|
||||
public function __construct(ModuleHandlerInterface $module_handler, LockBackendInterface $lock, QueueFactory $queue_factory, StateInterface $state, AccountSwitcherInterface $account_switcher, LoggerInterface $logger, QueueWorkerManagerInterface $queue_manager) {
|
||||
|
@ -193,8 +194,25 @@ class Cron implements CronInterface {
|
|||
* Invokes any cron handlers implementing hook_cron.
|
||||
*/
|
||||
protected function invokeCronHandlers() {
|
||||
$module_previous = '';
|
||||
|
||||
// Iterate through the modules calling their cron handlers (if any):
|
||||
foreach ($this->moduleHandler->getImplementations('cron') as $module) {
|
||||
|
||||
if (!$module_previous) {
|
||||
$this->logger->notice('Starting execution of @module_cron().', [
|
||||
'@module' => $module,
|
||||
]);
|
||||
}
|
||||
else {
|
||||
$this->logger->notice('Starting execution of @module_cron(), execution of @module_previous_cron() took @time.', [
|
||||
'@module' => $module,
|
||||
'@module_previous' => $module_previous,
|
||||
'@time' => Timer::read('cron_' . $module_previous) . 'ms',
|
||||
]);
|
||||
}
|
||||
Timer::start('cron_' . $module);
|
||||
|
||||
// Do not let an exception thrown by one module disturb another.
|
||||
try {
|
||||
$this->moduleHandler->invoke($module, 'cron');
|
||||
|
@ -202,6 +220,15 @@ class Cron implements CronInterface {
|
|||
catch (\Exception $e) {
|
||||
watchdog_exception('cron', $e);
|
||||
}
|
||||
|
||||
Timer::stop('cron_' . $module);
|
||||
$module_previous = $module;
|
||||
}
|
||||
if ($module_previous) {
|
||||
$this->logger->notice('Execution of @module_previous_cron() took @time.', [
|
||||
'@module_previous' => $module_previous,
|
||||
'@time' => Timer::read('cron_' . $module_previous) . 'ms',
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -129,7 +129,7 @@ abstract class Database {
|
|||
*/
|
||||
final public static function getLog($logging_key, $key = 'default') {
|
||||
if (empty(self::$logs[$key])) {
|
||||
return NULL;
|
||||
return [];
|
||||
}
|
||||
$queries = self::$logs[$key]->get($logging_key);
|
||||
self::$logs[$key]->end($logging_key);
|
||||
|
|
|
@ -411,6 +411,11 @@ class Schema extends DatabaseSchema {
|
|||
->fields(array($field => $spec['initial']))
|
||||
->execute();
|
||||
}
|
||||
if (isset($spec['initial_from_field'])) {
|
||||
$this->connection->update($table)
|
||||
->expression($field, $spec['initial_from_field'])
|
||||
->execute();
|
||||
}
|
||||
if ($fixnull) {
|
||||
$spec['not null'] = TRUE;
|
||||
$this->changeField($table, $field, $field, $spec);
|
||||
|
|
|
@ -210,13 +210,8 @@ class Connection extends DatabaseConnection {
|
|||
// need to be escaped.
|
||||
$escaped = $this->escapeTable($table) . '.' . $this->escapeAlias($column);
|
||||
}
|
||||
elseif (preg_match('/[A-Z]/', $escaped)) {
|
||||
// Quote the field name for case-sensitivity.
|
||||
$escaped = '"' . $escaped . '"';
|
||||
}
|
||||
elseif (in_array(strtolower($escaped), $this->postgresqlReservedKeyWords)) {
|
||||
// Quote the field name for PostgreSQL reserved key words.
|
||||
$escaped = '"' . $escaped . '"';
|
||||
else {
|
||||
$escaped = $this->doEscape($escaped);
|
||||
}
|
||||
|
||||
return $escaped;
|
||||
|
@ -227,16 +222,7 @@ class Connection extends DatabaseConnection {
|
|||
*/
|
||||
public function escapeAlias($field) {
|
||||
$escaped = preg_replace('/[^A-Za-z0-9_]+/', '', $field);
|
||||
|
||||
// Escape the alias in quotes for case-sensitivity.
|
||||
if (preg_match('/[A-Z]/', $escaped)) {
|
||||
$escaped = '"' . $escaped . '"';
|
||||
}
|
||||
elseif (in_array(strtolower($escaped), $this->postgresqlReservedKeyWords)) {
|
||||
// Quote the alias name for PostgreSQL reserved key words.
|
||||
$escaped = '"' . $escaped . '"';
|
||||
}
|
||||
|
||||
$escaped = $this->doEscape($escaped);
|
||||
return $escaped;
|
||||
}
|
||||
|
||||
|
@ -246,18 +232,35 @@ class Connection extends DatabaseConnection {
|
|||
public function escapeTable($table) {
|
||||
$escaped = parent::escapeTable($table);
|
||||
|
||||
// Quote identifier to make it case-sensitive.
|
||||
if (preg_match('/[A-Z]/', $escaped)) {
|
||||
$escaped = '"' . $escaped . '"';
|
||||
}
|
||||
elseif (in_array(strtolower($escaped), $this->postgresqlReservedKeyWords)) {
|
||||
// Quote the table name for PostgreSQL reserved key words.
|
||||
$escaped = '"' . $escaped . '"';
|
||||
}
|
||||
// Ensure that each part (database, schema and table) of the table name is
|
||||
// properly and independently escaped.
|
||||
$parts = explode('.', $escaped);
|
||||
$parts = array_map([$this, 'doEscape'], $parts);
|
||||
$escaped = implode('.', $parts);
|
||||
|
||||
return $escaped;
|
||||
}
|
||||
|
||||
/**
|
||||
* Escape a string if needed.
|
||||
*
|
||||
* @param $string
|
||||
* The string to escape.
|
||||
* @return string
|
||||
* The escaped string.
|
||||
*/
|
||||
protected function doEscape($string) {
|
||||
// Quote identifier to make it case-sensitive.
|
||||
if (preg_match('/[A-Z]/', $string)) {
|
||||
$string = '"' . $string . '"';
|
||||
}
|
||||
elseif (in_array(strtolower($string), $this->postgresqlReservedKeyWords)) {
|
||||
// Quote the string for PostgreSQL reserved key words.
|
||||
$string = '"' . $string . '"';
|
||||
}
|
||||
return $string;
|
||||
}
|
||||
|
||||
public function driver() {
|
||||
return 'pgsql';
|
||||
}
|
||||
|
|
|
@ -65,7 +65,7 @@ class Tasks extends InstallTasks {
|
|||
$this->pass('Drupal can CONNECT to the database ok.');
|
||||
}
|
||||
catch (\Exception $e) {
|
||||
// Attempt to create the database if it is not found.
|
||||
// Attempt to create the database if it is not found.
|
||||
if ($e->getCode() == Connection::DATABASE_NOT_FOUND) {
|
||||
// Remove the database string from connection info.
|
||||
$connection_info = Database::getConnectionInfo();
|
||||
|
|
|
@ -531,6 +531,11 @@ class Schema extends DatabaseSchema {
|
|||
->fields(array($field => $spec['initial']))
|
||||
->execute();
|
||||
}
|
||||
if (isset($spec['initial_from_field'])) {
|
||||
$this->connection->update($table)
|
||||
->expression($field, $spec['initial_from_field'])
|
||||
->execute();
|
||||
}
|
||||
if ($fixnull) {
|
||||
$this->connection->query("ALTER TABLE {" . $table . "} ALTER $field SET NOT NULL");
|
||||
}
|
||||
|
|
|
@ -124,6 +124,16 @@ class Connection extends DatabaseConnection {
|
|||
// Create a user-space case-insensitive collation with UTF-8 support.
|
||||
$pdo->sqliteCreateCollation('NOCASE_UTF8', array('Drupal\Component\Utility\Unicode', 'strcasecmp'));
|
||||
|
||||
// Set SQLite init_commands if not already defined. Enable the Write-Ahead
|
||||
// Logging (WAL) for SQLite. See https://www.drupal.org/node/2348137 and
|
||||
// https://www.sqlite.org/wal.html.
|
||||
$connection_options += array(
|
||||
'init_commands' => array(),
|
||||
);
|
||||
$connection_options['init_commands'] += array(
|
||||
'wal' => "PRAGMA journal_mode=WAL",
|
||||
);
|
||||
|
||||
// Execute sqlite init_commands.
|
||||
if (isset($connection_options['init_commands'])) {
|
||||
$pdo->exec(implode('; ', $connection_options['init_commands']));
|
||||
|
|
|
@ -316,6 +316,11 @@ class Schema extends DatabaseSchema {
|
|||
->fields(array($field => $specification['initial']))
|
||||
->execute();
|
||||
}
|
||||
if (isset($specification['initial_from_field'])) {
|
||||
$this->connection->update($table)
|
||||
->expression($field, $specification['initial_from_field'])
|
||||
->execute();
|
||||
}
|
||||
}
|
||||
else {
|
||||
// We cannot add the field directly. Use the slower table alteration
|
||||
|
@ -335,6 +340,13 @@ class Schema extends DatabaseSchema {
|
|||
'arguments' => array(':newfieldinitial' => $specification['initial']),
|
||||
);
|
||||
}
|
||||
elseif (isset($specification['initial_from_field'])) {
|
||||
// If we have a initial value, copy it over.
|
||||
$mapping[$field] = array(
|
||||
'expression' => $specification['initial_from_field'],
|
||||
'arguments' => [],
|
||||
);
|
||||
}
|
||||
else {
|
||||
// Else use the default of the field.
|
||||
$mapping[$field] = NULL;
|
||||
|
|
|
@ -300,6 +300,7 @@ class Condition implements ConditionInterface, \Countable {
|
|||
// $specials does not use drupal_static as its value never changes.
|
||||
static $specials = array(
|
||||
'BETWEEN' => array('delimiter' => ' AND '),
|
||||
'NOT BETWEEN' => array('delimiter' => ' AND '),
|
||||
'IN' => array('delimiter' => ', ', 'prefix' => ' (', 'postfix' => ')'),
|
||||
'NOT IN' => array('delimiter' => ', ', 'prefix' => ' (', 'postfix' => ')'),
|
||||
'EXISTS' => array('prefix' => ' (', 'postfix' => ')'),
|
||||
|
|
|
@ -340,6 +340,12 @@ interface SelectInterface extends ConditionInterface, AlterableInterface, Extend
|
|||
* An array of arguments to replace into the $condition of this join.
|
||||
* @return
|
||||
* The unique alias that was assigned for this table.
|
||||
*
|
||||
* @deprecated as of Drupal 8.1.x, will be removed in Drupal 9.0.0. Instead,
|
||||
* change the query to use leftJoin(). For instance:
|
||||
* db_query('A')->rightJoin('B') is identical to
|
||||
* db_query('B')->leftJoin('A'). This functionality has been deprecated
|
||||
* because SQLite does not support it.
|
||||
*/
|
||||
public function rightJoin($table, $alias = NULL, $condition = NULL, $arguments = array());
|
||||
|
||||
|
|
|
@ -305,6 +305,8 @@ abstract class Schema implements PlaceholderInterface {
|
|||
* created field will be set to the value of the key in all rows.
|
||||
* This is most useful for creating NOT NULL columns with no default
|
||||
* value in existing tables.
|
||||
* Alternatively, the 'initial_form_field' key may be used, which will
|
||||
* auto-populate the new field with values from the specified field.
|
||||
* @param $keys_new
|
||||
* (optional) Keys and indexes specification to be created on the
|
||||
* table along with adding the field. The format is the same as a
|
||||
|
|
|
@ -90,7 +90,7 @@ interface StatementInterface extends \Traversable {
|
|||
* If $mode is PDO::FETCH_CLASS, the optional arguments to pass to the
|
||||
* constructor.
|
||||
*/
|
||||
public function setFetchMode($mode, $a1 = NULL, $a2 = array());
|
||||
public function setFetchMode($mode, $a1 = NULL, $a2 = array());
|
||||
|
||||
/**
|
||||
* Fetches the next row from a result set.
|
||||
|
@ -109,7 +109,7 @@ interface StatementInterface extends \Traversable {
|
|||
* @return
|
||||
* A result, formatted according to $mode.
|
||||
*/
|
||||
public function fetch($mode = NULL, $cursor_orientation = NULL, $cursor_offset = NULL);
|
||||
public function fetch($mode = NULL, $cursor_orientation = NULL, $cursor_offset = NULL);
|
||||
|
||||
/**
|
||||
* Returns a single field from the next record of a result set.
|
||||
|
@ -128,7 +128,7 @@ interface StatementInterface extends \Traversable {
|
|||
* The object will be of the class specified by StatementInterface::setFetchMode()
|
||||
* or stdClass if not specified.
|
||||
*/
|
||||
public function fetchObject();
|
||||
public function fetchObject();
|
||||
|
||||
/**
|
||||
* Fetches the next row and returns it as an associative array.
|
||||
|
@ -155,7 +155,7 @@ interface StatementInterface extends \Traversable {
|
|||
* @return
|
||||
* An array of results.
|
||||
*/
|
||||
function fetchAll($mode = NULL, $column_index = NULL, $constructor_arguments = NULL);
|
||||
function fetchAll($mode = NULL, $column_index = NULL, $constructor_arguments = NULL);
|
||||
|
||||
/**
|
||||
* Returns an entire single column of a result set as an indexed array.
|
||||
|
|
|
@ -150,7 +150,7 @@ class Datetime extends DateElementBase {
|
|||
* list of the possible formats and HTML5 standards for the HTML5
|
||||
* requirements. Defaults to the right HTML5 format for the chosen element
|
||||
* if a HTML5 element is used, otherwise defaults to
|
||||
* entity_load('date_format', 'html_date')->getPattern().
|
||||
* DateFormat::load('html_date')->getPattern().
|
||||
* - #date_date_element: The date element. Options are:
|
||||
* - datetime: Use the HTML5 datetime element type.
|
||||
* - datetime-local: Use the HTML5 datetime-local element type.
|
||||
|
@ -170,7 +170,7 @@ class Datetime extends DateElementBase {
|
|||
* a list of the possible formats and HTML5 standards for the HTML5
|
||||
* requirements. Defaults to the right HTML5 format for the chosen element
|
||||
* if a HTML5 element is used, otherwise defaults to
|
||||
* entity_load('date_format', 'html_time')->getPattern().
|
||||
* DateFormat::load('html_time')->getPattern().
|
||||
* - #date_time_callbacks: An array of optional callbacks for the time
|
||||
* element. Can be used to add a jQuery timepicker or an 'All day' checkbox.
|
||||
* - #date_year_range: A description of the range of years to allow, like
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\Core\DependencyInjection\Compiler;
|
||||
|
||||
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
|
||||
/**
|
||||
* Registers the authentication_providers container parameter.
|
||||
*/
|
||||
class AuthenticationProviderPass implements CompilerPassInterface {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function process(ContainerBuilder $container) {
|
||||
$authentication_providers = [];
|
||||
foreach ($container->findTaggedServiceIds('authentication_provider') as $service_id => $attributes) {
|
||||
$authentication_provider = $attributes[0]['provider_id'];
|
||||
if ($provider_tag = $container->getDefinition($service_id)->getTag('_provider')) {
|
||||
$authentication_providers[$authentication_provider] = $provider_tag[0]['provider'];
|
||||
}
|
||||
}
|
||||
$container->setParameter('authentication_providers', $authentication_providers);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\Core\DependencyInjection\Compiler;
|
||||
|
||||
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
|
||||
/**
|
||||
* Provides a compiler pass which disables the CORS middleware in case disabled.
|
||||
*
|
||||
* @see core.services.yml
|
||||
*/
|
||||
class CorsCompilerPass implements CompilerPassInterface {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function process(ContainerBuilder $container) {
|
||||
$enabled = FALSE;
|
||||
|
||||
if ($cors_config = $container->getParameter('cors.config')) {
|
||||
$enabled = !empty($cors_config['enabled']);
|
||||
}
|
||||
|
||||
// Remove the CORS middleware completly in case it was not enabled.
|
||||
if (!$enabled) {
|
||||
$container->removeDefinition('http_middleware.cors');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -14,7 +14,7 @@ class Container extends DrupalContainer {
|
|||
* {@inheritdoc}
|
||||
*/
|
||||
public function set($id, $service, $scope = ContainerInterface::SCOPE_CONTAINER) {
|
||||
parent::set($id, $service, $scope);
|
||||
parent::set($id, $service, $scope);
|
||||
|
||||
// Ensure that the _serviceId property is set on synthetic services as well.
|
||||
if (isset($this->services[$id]) && is_object($this->services[$id]) && !isset($this->services[$id]->_serviceId)) {
|
||||
|
|
|
@ -7,11 +7,7 @@ use Symfony\Component\DependencyInjection\ContainerBuilder as SymfonyContainerBu
|
|||
use Symfony\Component\DependencyInjection\Container as SymfonyContainer;
|
||||
use Symfony\Component\DependencyInjection\Definition;
|
||||
use Symfony\Component\DependencyInjection\LazyProxy\Instantiator\RealServiceInstantiator;
|
||||
use Symfony\Component\DependencyInjection\Reference;
|
||||
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
|
||||
use Symfony\Component\DependencyInjection\Exception\RuntimeException;
|
||||
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
|
||||
use Symfony\Component\DependencyInjection\Exception\InactiveScopeException;
|
||||
|
||||
/**
|
||||
* Drupal's dependency injection container builder.
|
||||
|
@ -35,129 +31,6 @@ class ContainerBuilder extends SymfonyContainerBuilder {
|
|||
parent::__construct($parameterBag);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a service for a service definition.
|
||||
*
|
||||
* Overrides the parent implementation, but just changes one line about
|
||||
* deprecations, see below.
|
||||
*
|
||||
* @param \Symfony\Component\DependencyInjection\Definition $definition
|
||||
* @param string $id
|
||||
* @param bool|true $tryProxy
|
||||
*
|
||||
* @return mixed|object
|
||||
*/
|
||||
public function createService(Definition $definition, $id, $tryProxy = true)
|
||||
{
|
||||
if ($definition->isSynthetic()) {
|
||||
throw new RuntimeException(sprintf('You have requested a synthetic service ("%s"). The DIC does not know how to construct this service.', $id));
|
||||
}
|
||||
|
||||
if ($definition->isDeprecated()) {
|
||||
// Suppress deprecation warnings when a service is marked as
|
||||
// 'deprecated: %service_id%-no-warning'
|
||||
if ($definition->getDeprecationMessage($id) != ($id . '-no-warning')) {
|
||||
@trigger_error($definition->getDeprecationMessage($id), E_USER_DEPRECATED);
|
||||
}
|
||||
}
|
||||
|
||||
if ($tryProxy && $definition->isLazy()) {
|
||||
$container = $this;
|
||||
|
||||
$proxy = $this
|
||||
->getProxyInstantiator()
|
||||
->instantiateProxy(
|
||||
$container,
|
||||
$definition,
|
||||
$id, function () use ($definition, $id, $container) {
|
||||
return $container->createService($definition, $id, false);
|
||||
}
|
||||
);
|
||||
$this->shareService($definition, $proxy, $id);
|
||||
|
||||
return $proxy;
|
||||
}
|
||||
|
||||
$parameterBag = $this->getParameterBag();
|
||||
|
||||
if (null !== $definition->getFile()) {
|
||||
require_once $parameterBag->resolveValue($definition->getFile());
|
||||
}
|
||||
|
||||
$arguments = $this->resolveServices($parameterBag->unescapeValue($parameterBag->resolveValue($definition->getArguments())));
|
||||
|
||||
if (null !== $factory = $definition->getFactory()) {
|
||||
if (is_array($factory)) {
|
||||
$factory = array($this->resolveServices($parameterBag->resolveValue($factory[0])), $factory[1]);
|
||||
} elseif (!is_string($factory)) {
|
||||
throw new RuntimeException(sprintf('Cannot create service "%s" because of invalid factory', $id));
|
||||
}
|
||||
|
||||
$service = call_user_func_array($factory, $arguments);
|
||||
|
||||
if (!$definition->isDeprecated() && is_array($factory) && is_string($factory[0])) {
|
||||
$r = new \ReflectionClass($factory[0]);
|
||||
|
||||
if (0 < strpos($r->getDocComment(), "\n * @deprecated ")) {
|
||||
@trigger_error(sprintf('The "%s" service relies on the deprecated "%s" factory class. It should either be deprecated or its factory upgraded.', $id, $r->name), E_USER_DEPRECATED);
|
||||
}
|
||||
}
|
||||
} elseif (null !== $definition->getFactoryMethod(false)) {
|
||||
if (null !== $definition->getFactoryClass(false)) {
|
||||
$factory = $parameterBag->resolveValue($definition->getFactoryClass(false));
|
||||
} elseif (null !== $definition->getFactoryService(false)) {
|
||||
$factory = $this->get($parameterBag->resolveValue($definition->getFactoryService(false)));
|
||||
} else {
|
||||
throw new RuntimeException(sprintf('Cannot create service "%s" from factory method without a factory service or factory class.', $id));
|
||||
}
|
||||
|
||||
$service = call_user_func_array(array($factory, $definition->getFactoryMethod(false)), $arguments);
|
||||
} else {
|
||||
$r = new \ReflectionClass($parameterBag->resolveValue($definition->getClass()));
|
||||
|
||||
$service = null === $r->getConstructor() ? $r->newInstance() : $r->newInstanceArgs($arguments);
|
||||
|
||||
if (!$definition->isDeprecated() && 0 < strpos($r->getDocComment(), "\n * @deprecated ")) {
|
||||
// Skip deprecation notices for deprecations which opt out.
|
||||
@trigger_error(sprintf('The "%s" service relies on the deprecated "%s" class. It should either be deprecated or its implementation upgraded.', $id, $r->name), E_USER_DEPRECATED);
|
||||
}
|
||||
}
|
||||
|
||||
if ($tryProxy || !$definition->isLazy()) {
|
||||
// share only if proxying failed, or if not a proxy
|
||||
$this->shareService($definition, $service, $id);
|
||||
}
|
||||
|
||||
foreach ($definition->getMethodCalls() as $call) {
|
||||
$this->callMethod($service, $call);
|
||||
}
|
||||
|
||||
$properties = $this->resolveServices($parameterBag->unescapeValue($parameterBag->resolveValue($definition->getProperties())));
|
||||
foreach ($properties as $name => $value) {
|
||||
$service->$name = $value;
|
||||
}
|
||||
|
||||
if ($callable = $definition->getConfigurator()) {
|
||||
if (is_array($callable)) {
|
||||
$callable[0] = $parameterBag->resolveValue($callable[0]);
|
||||
|
||||
if ($callable[0] instanceof Reference) {
|
||||
$callable[0] = $this->get((string) $callable[0], $callable[0]->getInvalidBehavior());
|
||||
} elseif ($callable[0] instanceof Definition) {
|
||||
$callable[0] = $this->createService($callable[0], null);
|
||||
}
|
||||
}
|
||||
|
||||
if (!is_callable($callable)) {
|
||||
throw new InvalidArgumentException(sprintf('The configure callable for class "%s" is not a callable.', get_class($service)));
|
||||
}
|
||||
|
||||
call_user_func($callable, $service);
|
||||
}
|
||||
|
||||
return $service;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the currently set proxy instantiator or instantiates one.
|
||||
*
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
namespace Drupal\Core\DependencyInjection;
|
||||
|
||||
use Drupal\Component\FileCache\FileCacheFactory;
|
||||
use Drupal\Component\Serialization\Yaml;
|
||||
use Drupal\Core\Serialization\Yaml;
|
||||
use Symfony\Component\DependencyInjection\Alias;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
use Symfony\Component\DependencyInjection\Definition;
|
||||
|
@ -111,7 +111,16 @@ class YamlFileLoader
|
|||
throw new InvalidArgumentException(sprintf('The "services" key should contain an array in %s. Check your YAML syntax.', $file));
|
||||
}
|
||||
|
||||
// Some extensions split up their dependencies into multiple files.
|
||||
if (isset($content['_provider'])) {
|
||||
$provider = $content['_provider'];
|
||||
}
|
||||
else {
|
||||
$basename = basename($file);
|
||||
list($provider, ) = explode('.', $basename, 2);
|
||||
}
|
||||
foreach ($content['services'] as $id => $service) {
|
||||
$service['tags'][] = ['name' => '_provider', 'provider' => $provider];
|
||||
$this->parseDefinition($id, $service, $file);
|
||||
}
|
||||
}
|
||||
|
|
22
core/lib/Drupal/Core/Discovery/YamlDiscovery.php
Normal file
22
core/lib/Drupal/Core/Discovery/YamlDiscovery.php
Normal file
|
@ -0,0 +1,22 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\Core\Discovery;
|
||||
|
||||
use Drupal\Component\Discovery\YamlDiscovery as ComponentYamlDiscovery;
|
||||
use Drupal\Core\Serialization\Yaml;
|
||||
|
||||
/**
|
||||
* Provides discovery for YAML files within a given set of directories.
|
||||
*
|
||||
* This overrides the Component file decoding with the Core YAML implementation.
|
||||
*/
|
||||
class YamlDiscovery extends ComponentYamlDiscovery {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function decode($file) {
|
||||
return Yaml::decode(file_get_contents($file)) ?: [];
|
||||
}
|
||||
|
||||
}
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace Drupal\Core;
|
||||
|
||||
use Composer\Autoload\ClassLoader;
|
||||
use Drupal\Component\Assertion\Handle;
|
||||
use Drupal\Component\FileCache\FileCacheFactory;
|
||||
use Drupal\Component\Utility\Unicode;
|
||||
|
@ -18,6 +19,7 @@ use Drupal\Core\File\MimeType\MimeTypeGuesser;
|
|||
use Drupal\Core\Http\TrustedHostsRequestFactory;
|
||||
use Drupal\Core\Language\Language;
|
||||
use Drupal\Core\Site\Settings;
|
||||
use Drupal\Core\Test\TestDatabase;
|
||||
use Symfony\Cmf\Component\Routing\RouteObjectInterface;
|
||||
use Symfony\Component\ClassLoader\ApcClassLoader;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
|
@ -248,15 +250,18 @@ class DrupalKernel implements DrupalKernelInterface, TerminableInterface {
|
|||
* @param bool $allow_dumping
|
||||
* (optional) FALSE to stop the container from being written to or read
|
||||
* from disk. Defaults to TRUE.
|
||||
* @param string $app_root
|
||||
* (optional) The path to the application root as a string. If not supplied,
|
||||
* the application root will be computed.
|
||||
*
|
||||
* @return static
|
||||
*
|
||||
* @throws \Symfony\Component\HttpKernel\Exception\BadRequestHttpException
|
||||
* In case the host name in the request is not trusted.
|
||||
*/
|
||||
public static function createFromRequest(Request $request, $class_loader, $environment, $allow_dumping = TRUE) {
|
||||
$kernel = new static($environment, $class_loader, $allow_dumping);
|
||||
static::bootEnvironment();
|
||||
public static function createFromRequest(Request $request, $class_loader, $environment, $allow_dumping = TRUE, $app_root = NULL) {
|
||||
$kernel = new static($environment, $class_loader, $allow_dumping, $app_root);
|
||||
static::bootEnvironment($app_root);
|
||||
$kernel->initializeSettings($request);
|
||||
return $kernel;
|
||||
}
|
||||
|
@ -273,12 +278,28 @@ class DrupalKernel implements DrupalKernelInterface, TerminableInterface {
|
|||
* @param bool $allow_dumping
|
||||
* (optional) FALSE to stop the container from being written to or read
|
||||
* from disk. Defaults to TRUE.
|
||||
* @param string $app_root
|
||||
* (optional) The path to the application root as a string. If not supplied,
|
||||
* the application root will be computed.
|
||||
*/
|
||||
public function __construct($environment, $class_loader, $allow_dumping = TRUE) {
|
||||
public function __construct($environment, $class_loader, $allow_dumping = TRUE, $app_root = NULL) {
|
||||
$this->environment = $environment;
|
||||
$this->classLoader = $class_loader;
|
||||
$this->allowDumping = $allow_dumping;
|
||||
$this->root = dirname(dirname(substr(__DIR__, 0, -strlen(__NAMESPACE__))));
|
||||
if ($app_root === NULL) {
|
||||
$app_root = static::guessApplicationRoot();
|
||||
}
|
||||
$this->root = $app_root;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine the application root directory based on assumptions.
|
||||
*
|
||||
* @return string
|
||||
* The application root.
|
||||
*/
|
||||
protected static function guessApplicationRoot() {
|
||||
return dirname(dirname(substr(__DIR__, 0, -strlen(__NAMESPACE__))));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -320,6 +341,9 @@ class DrupalKernel implements DrupalKernelInterface, TerminableInterface {
|
|||
* Defaults to TRUE. During initial installation, this is set to FALSE so
|
||||
* that Drupal can detect a matching directory, then create a new
|
||||
* settings.php file in it.
|
||||
* @param string $app_root
|
||||
* (optional) The path to the application root as a string. If not supplied,
|
||||
* the application root will be computed.
|
||||
*
|
||||
* @return string
|
||||
* The path of the matching directory.
|
||||
|
@ -332,18 +356,23 @@ class DrupalKernel implements DrupalKernelInterface, TerminableInterface {
|
|||
* @see default.settings.php
|
||||
* @see example.sites.php
|
||||
*/
|
||||
public static function findSitePath(Request $request, $require_settings = TRUE) {
|
||||
public static function findSitePath(Request $request, $require_settings = TRUE, $app_root = NULL) {
|
||||
if (static::validateHostname($request) === FALSE) {
|
||||
throw new BadRequestHttpException();
|
||||
}
|
||||
|
||||
if ($app_root === NULL) {
|
||||
$app_root = static::guessApplicationRoot();
|
||||
}
|
||||
|
||||
// Check for a simpletest override.
|
||||
if ($test_prefix = drupal_valid_test_ua()) {
|
||||
return 'sites/simpletest/' . substr($test_prefix, 10);
|
||||
$test_db = new TestDatabase($test_prefix);
|
||||
return $test_db->getTestSitePath();
|
||||
}
|
||||
|
||||
// Determine whether multi-site functionality is enabled.
|
||||
if (!file_exists(DRUPAL_ROOT . '/sites/sites.php')) {
|
||||
if (!file_exists($app_root . '/sites/sites.php')) {
|
||||
return 'sites/default';
|
||||
}
|
||||
|
||||
|
@ -355,17 +384,17 @@ class DrupalKernel implements DrupalKernelInterface, TerminableInterface {
|
|||
$http_host = $request->getHttpHost();
|
||||
|
||||
$sites = array();
|
||||
include DRUPAL_ROOT . '/sites/sites.php';
|
||||
include $app_root . '/sites/sites.php';
|
||||
|
||||
$uri = explode('/', $script_name);
|
||||
$server = explode('.', implode('.', array_reverse(explode(':', rtrim($http_host, '.')))));
|
||||
for ($i = count($uri) - 1; $i > 0; $i--) {
|
||||
for ($j = count($server); $j > 0; $j--) {
|
||||
$dir = implode('.', array_slice($server, -$j)) . implode('.', array_slice($uri, 0, $i));
|
||||
if (isset($sites[$dir]) && file_exists(DRUPAL_ROOT . '/sites/' . $sites[$dir])) {
|
||||
if (isset($sites[$dir]) && file_exists($app_root . '/sites/' . $sites[$dir])) {
|
||||
$dir = $sites[$dir];
|
||||
}
|
||||
if (file_exists(DRUPAL_ROOT . '/sites/' . $dir . '/settings.php') || (!$require_settings && file_exists(DRUPAL_ROOT . '/sites/' . $dir))) {
|
||||
if (file_exists($app_root . '/sites/' . $dir . '/settings.php') || (!$require_settings && file_exists($app_root . '/sites/' . $dir))) {
|
||||
return "sites/$dir";
|
||||
}
|
||||
}
|
||||
|
@ -417,11 +446,6 @@ class DrupalKernel implements DrupalKernelInterface, TerminableInterface {
|
|||
|
||||
// Provide a default configuration, if not set.
|
||||
if (!isset($configuration['default'])) {
|
||||
$configuration['default'] = [
|
||||
'class' => '\Drupal\Component\FileCache\FileCache',
|
||||
'cache_backend_class' => NULL,
|
||||
'cache_backend_configuration' => [],
|
||||
];
|
||||
// @todo Use extension_loaded('apcu') for non-testbot
|
||||
// https://www.drupal.org/node/2447753.
|
||||
if (function_exists('apcu_fetch')) {
|
||||
|
@ -733,6 +757,10 @@ class DrupalKernel implements DrupalKernelInterface, TerminableInterface {
|
|||
* needed.
|
||||
*/
|
||||
public function updateModules(array $module_list, array $module_filenames = array()) {
|
||||
$pre_existing_module_namespaces = [];
|
||||
if ($this->booted && is_array($this->moduleList)) {
|
||||
$pre_existing_module_namespaces = $this->getModuleNamespacesPsr4($this->getModuleFileNames());
|
||||
}
|
||||
$this->moduleList = $module_list;
|
||||
foreach ($module_filenames as $name => $extension) {
|
||||
$this->moduleData[$name] = $extension;
|
||||
|
@ -745,6 +773,20 @@ class DrupalKernel implements DrupalKernelInterface, TerminableInterface {
|
|||
// container in order to refresh the serviceProvider list and container.
|
||||
$this->containerNeedsRebuild = TRUE;
|
||||
if ($this->booted) {
|
||||
// We need to register any new namespaces to a new class loader because
|
||||
// the current class loader might have stored a negative result for a
|
||||
// class that is now available.
|
||||
// @see \Composer\Autoload\ClassLoader::findFile()
|
||||
$new_namespaces = array_diff_key(
|
||||
$this->getModuleNamespacesPsr4($this->getModuleFileNames()),
|
||||
$pre_existing_module_namespaces
|
||||
);
|
||||
if (!empty($new_namespaces)) {
|
||||
$additional_class_loader = new ClassLoader();
|
||||
$this->classLoaderAddMultiplePsr4($new_namespaces, $additional_class_loader);
|
||||
$additional_class_loader->register();
|
||||
}
|
||||
|
||||
$this->initializeContainer();
|
||||
}
|
||||
}
|
||||
|
@ -877,15 +919,23 @@ class DrupalKernel implements DrupalKernelInterface, TerminableInterface {
|
|||
*
|
||||
* This method sets PHP environment options we want to be sure are set
|
||||
* correctly for security or just saneness.
|
||||
*
|
||||
* @param string $app_root
|
||||
* (optional) The path to the application root as a string. If not supplied,
|
||||
* the application root will be computed.
|
||||
*/
|
||||
public static function bootEnvironment() {
|
||||
public static function bootEnvironment($app_root = NULL) {
|
||||
if (static::$isEnvironmentInitialized) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Determine the application root if it's not supplied.
|
||||
if ($app_root === NULL) {
|
||||
$app_root = static::guessApplicationRoot();
|
||||
}
|
||||
|
||||
// Include our bootstrap file.
|
||||
$core_root = dirname(dirname(dirname(__DIR__)));
|
||||
require_once $core_root . '/includes/bootstrap.inc';
|
||||
require_once $app_root . '/core/includes/bootstrap.inc';
|
||||
|
||||
// Enforce E_STRICT, but allow users to set levels not part of E_STRICT.
|
||||
error_reporting(E_STRICT | E_ALL);
|
||||
|
@ -915,6 +965,7 @@ class DrupalKernel implements DrupalKernelInterface, TerminableInterface {
|
|||
// Indicate that code is operating in a test child site.
|
||||
if (!defined('DRUPAL_TEST_IN_CHILD_SITE')) {
|
||||
if ($test_prefix = drupal_valid_test_ua()) {
|
||||
$test_db = new TestDatabase($test_prefix);
|
||||
// Only code that interfaces directly with tests should rely on this
|
||||
// constant; e.g., the error/exception handler conditionally adds further
|
||||
// error information into HTTP response headers that are consumed by
|
||||
|
@ -929,7 +980,7 @@ class DrupalKernel implements DrupalKernelInterface, TerminableInterface {
|
|||
|
||||
// Log fatal errors to the test site directory.
|
||||
ini_set('log_errors', 1);
|
||||
ini_set('error_log', DRUPAL_ROOT . '/sites/simpletest/' . substr($test_prefix, 10) . '/error.log');
|
||||
ini_set('error_log', $app_root . '/' . $test_db->getTestSitePath() . '/error.log');
|
||||
|
||||
// Ensure that a rewritten settings.php is used if opcache is on.
|
||||
ini_set('opcache.validate_timestamps', 'on');
|
||||
|
@ -1193,7 +1244,8 @@ class DrupalKernel implements DrupalKernelInterface, TerminableInterface {
|
|||
// be automatically reinstantiated. Also include services tagged to persist.
|
||||
$persist_ids = array();
|
||||
foreach ($container->getDefinitions() as $id => $definition) {
|
||||
if ($definition->isSynthetic() || $definition->getTag('persist')) {
|
||||
// It does not make sense to persist the container itself, exclude it.
|
||||
if ($id !== 'service_container' && ($definition->isSynthetic() || $definition->getTag('persist'))) {
|
||||
$persist_ids[] = $id;
|
||||
}
|
||||
}
|
||||
|
@ -1349,8 +1401,15 @@ class DrupalKernel implements DrupalKernelInterface, TerminableInterface {
|
|||
* Array where each key is a namespace like 'Drupal\system', and each value
|
||||
* is either a PSR-4 base directory, or an array of PSR-4 base directories
|
||||
* associated with this namespace.
|
||||
* @param object $class_loader
|
||||
* The class loader. Normally \Composer\Autoload\ClassLoader, as included by
|
||||
* the front controller, but may also be decorated; e.g.,
|
||||
* \Symfony\Component\ClassLoader\ApcClassLoader.
|
||||
*/
|
||||
protected function classLoaderAddMultiplePsr4(array $namespaces = array()) {
|
||||
protected function classLoaderAddMultiplePsr4(array $namespaces = array(), $class_loader = NULL) {
|
||||
if ($class_loader === NULL) {
|
||||
$class_loader = $this->classLoader;
|
||||
}
|
||||
foreach ($namespaces as $prefix => $paths) {
|
||||
if (is_array($paths)) {
|
||||
foreach ($paths as $key => $value) {
|
||||
|
@ -1360,7 +1419,7 @@ class DrupalKernel implements DrupalKernelInterface, TerminableInterface {
|
|||
elseif (is_string($paths)) {
|
||||
$paths = $this->root . '/' . $paths;
|
||||
}
|
||||
$this->classLoader->addPsr4($prefix . '\\', $paths);
|
||||
$class_loader->addPsr4($prefix . '\\', $paths);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ interface DrupalKernelInterface extends HttpKernelInterface, ContainerAwareInter
|
|||
*
|
||||
* This also allows inspecting a built container for debugging purposes.
|
||||
*
|
||||
* @return array|NULL
|
||||
* @return array|null
|
||||
* The cached container definition or NULL if not found in cache.
|
||||
*/
|
||||
public function getCachedContainerDefinition();
|
||||
|
|
|
@ -436,6 +436,13 @@ abstract class ContentEntityStorageBase extends EntityStorageBase implements Con
|
|||
$result = [];
|
||||
$args = array_slice(func_get_args(), 2);
|
||||
$langcodes = array_keys($entity->getTranslationLanguages());
|
||||
// Ensure that the field method is invoked as first on the current entity
|
||||
// translation and then on all other translations.
|
||||
$current_entity_langcode = $entity->language()->getId();
|
||||
if (reset($langcodes) != $current_entity_langcode) {
|
||||
$langcodes = array_diff($langcodes, [$current_entity_langcode]);
|
||||
array_unshift($langcodes, $current_entity_langcode);
|
||||
}
|
||||
foreach ($langcodes as $langcode) {
|
||||
$translation = $entity->getTranslation($langcode);
|
||||
// For non translatable fields, there is only one field object instance
|
||||
|
|
|
@ -5,6 +5,7 @@ namespace Drupal\Core\Entity;
|
|||
use Drupal\Core\Extension\ModuleUninstallValidatorInterface;
|
||||
use Drupal\Core\StringTranslation\StringTranslationTrait;
|
||||
use Drupal\Core\StringTranslation\TranslationInterface;
|
||||
use Drupal\Core\Url;
|
||||
|
||||
/**
|
||||
* Validates module uninstall readiness based on existing content entities.
|
||||
|
@ -37,10 +38,14 @@ class ContentUninstallValidator implements ModuleUninstallValidatorInterface {
|
|||
*/
|
||||
public function validate($module) {
|
||||
$entity_types = $this->entityManager->getDefinitions();
|
||||
$reasons = array();
|
||||
$reasons = [];
|
||||
foreach ($entity_types as $entity_type) {
|
||||
if ($module == $entity_type->getProvider() && $entity_type instanceof ContentEntityTypeInterface && $this->entityManager->getStorage($entity_type->id())->hasData()) {
|
||||
$reasons[] = $this->t('There is content for the entity type: @entity_type', array('@entity_type' => $entity_type->getLabel()));
|
||||
$reasons[] = $this->t('There is content for the entity type: @entity_type. <a href=":url">Remove @entity_type_plural</a>.', [
|
||||
'@entity_type' => $entity_type->getLabel(),
|
||||
'@entity_type_plural' => $entity_type->getPluralLabel(),
|
||||
':url' => Url::fromRoute('system.prepare_modules_entity_uninstall', ['entity_type_id' => $entity_type->id()])->toString(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
return $reasons;
|
||||
|
|
|
@ -273,7 +273,7 @@ class EntityController implements ContainerInjectionInterface {
|
|||
* (optional) The entity, set in
|
||||
* \Drupal\Core\Entity\Enhancer\EntityRouteEnhancer.
|
||||
*
|
||||
* @return \Drupal\Core\Entity\EntityInterface|NULL
|
||||
* @return \Drupal\Core\Entity\EntityInterface|null
|
||||
* The entity, if it is passed in directly or if the first parameter of the
|
||||
* active route is an entity; otherwise, NULL.
|
||||
*/
|
||||
|
|
|
@ -346,8 +346,8 @@ class EntityAccessControlHandler extends EntityHandlerBase implements EntityAcce
|
|||
* is checked for the field definition, without any specific value
|
||||
* available. Defaults to NULL.
|
||||
*
|
||||
* @return bool
|
||||
* TRUE if access is allowed, FALSE otherwise.
|
||||
* @return \Drupal\Core\Access\AccessResultInterface
|
||||
* The access result.
|
||||
*/
|
||||
protected function checkFieldAccess($operation, FieldDefinitionInterface $field_definition, AccountInterface $account, FieldItemListInterface $items = NULL) {
|
||||
return AccessResult::allowed();
|
||||
|
|
|
@ -10,7 +10,9 @@ use Symfony\Component\DependencyInjection\ContainerAwareTrait;
|
|||
/**
|
||||
* Provides a wrapper around many other services relating to entities.
|
||||
*
|
||||
* @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
|
||||
* Deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0. We cannot
|
||||
* use the deprecated PHPDoc tag because this service class is still used in
|
||||
* legacy code paths. Symfony would fail test cases with deprecation warnings.
|
||||
*
|
||||
* @todo Enforce the deprecation of each method once
|
||||
* https://www.drupal.org/node/2578361 is in.
|
||||
|
|
|
@ -482,6 +482,7 @@ class EntityType implements EntityTypeInterface {
|
|||
public function setStorageClass($class) {
|
||||
$this->checkStorageClass($class);
|
||||
$this->handlers['storage'] = $class;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -526,7 +526,9 @@ interface EntityTypeInterface extends PluginDefinitionInterface {
|
|||
/**
|
||||
* Gets the name of the entity type which provides bundles.
|
||||
*
|
||||
* @return string
|
||||
* @return string|null
|
||||
* The name of the entity type which provides bundles, or NULL if the entity
|
||||
* type does not have a bundle entity type.
|
||||
*/
|
||||
public function getBundleEntityType();
|
||||
|
||||
|
|
|
@ -17,13 +17,21 @@ use Symfony\Component\DependencyInjection\ContainerAwareTrait;
|
|||
/**
|
||||
* Manages entity type plugin definitions.
|
||||
*
|
||||
* Each entity type definition array is set in the entity type's
|
||||
* annotation and altered by hook_entity_type_alter().
|
||||
* Each entity type definition array is set in the entity type's annotation and
|
||||
* altered by hook_entity_type_alter().
|
||||
*
|
||||
* Do not use hook_entity_type_alter() hook to add information to entity types,
|
||||
* unless one of the following is true:
|
||||
* - You are filling in default values.
|
||||
* - You need to dynamically add information only in certain circumstances.
|
||||
* - Your hook needs to run after hook_entity_type_build() implementations.
|
||||
* Use hook_entity_type_build() instead in all other cases.
|
||||
*
|
||||
* @see \Drupal\Core\Entity\Annotation\EntityType
|
||||
* @see \Drupal\Core\Entity\EntityInterface
|
||||
* @see \Drupal\Core\Entity\EntityTypeInterface
|
||||
* @see hook_entity_type_alter()
|
||||
* @see hook_entity_type_build()
|
||||
*/
|
||||
class EntityTypeManager extends DefaultPluginManager implements EntityTypeManagerInterface, ContainerAwareInterface {
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
namespace Drupal\Core\Entity\Plugin\DataType\Deriver;
|
||||
|
||||
use Drupal\Core\Entity\EntityManagerInterface;
|
||||
use Drupal\Core\Entity\EntityTypeBundleInfoInterface;
|
||||
use Drupal\Core\Plugin\Discovery\ContainerDeriverInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
|
||||
|
@ -32,6 +33,13 @@ class EntityDeriver implements ContainerDeriverInterface {
|
|||
*/
|
||||
protected $entityManager;
|
||||
|
||||
/**
|
||||
* The bundle info service.
|
||||
*
|
||||
* @var \Drupal\Core\Entity\EntityTypeBundleInfoInterface
|
||||
*/
|
||||
protected $bundleInfoService;
|
||||
|
||||
/**
|
||||
* Constructs an EntityDeriver object.
|
||||
*
|
||||
|
@ -40,9 +48,10 @@ class EntityDeriver implements ContainerDeriverInterface {
|
|||
* @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager
|
||||
* The entity manager.
|
||||
*/
|
||||
public function __construct($base_plugin_id, EntityManagerInterface $entity_manager) {
|
||||
public function __construct($base_plugin_id, EntityManagerInterface $entity_manager, EntityTypeBundleInfoInterface $bundle_info_service) {
|
||||
$this->basePluginId = $base_plugin_id;
|
||||
$this->entityManager = $entity_manager;
|
||||
$this->bundleInfoService = $bundle_info_service;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -51,7 +60,8 @@ class EntityDeriver implements ContainerDeriverInterface {
|
|||
public static function create(ContainerInterface $container, $base_plugin_id) {
|
||||
return new static(
|
||||
$base_plugin_id,
|
||||
$container->get('entity.manager')
|
||||
$container->get('entity.manager'),
|
||||
$container->get('entity_type.bundle.info')
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -82,7 +92,7 @@ class EntityDeriver implements ContainerDeriverInterface {
|
|||
) + $base_plugin_definition;
|
||||
|
||||
// Incorporate the bundles as entity:$entity_type:$bundle, if any.
|
||||
foreach (entity_get_bundles($entity_type_id) as $bundle => $bundle_info) {
|
||||
foreach ($this->bundleInfoService->getBundleInfo($entity_type_id) as $bundle => $bundle_info) {
|
||||
if ($bundle !== $entity_type_id) {
|
||||
$this->derivatives[$entity_type_id . ':' . $bundle] = array(
|
||||
'label' => $bundle_info['label'],
|
||||
|
|
|
@ -67,7 +67,9 @@ class EntityReference extends DataReferenceBase {
|
|||
public function getTarget() {
|
||||
if (!isset($this->target) && isset($this->id)) {
|
||||
// If we have a valid reference, return the entity's TypedData adapter.
|
||||
$entity = entity_load($this->getTargetDefinition()->getEntityTypeId(), $this->id);
|
||||
$entity = \Drupal::entityTypeManager()
|
||||
->getStorage($this->getTargetDefinition()->getEntityTypeId())
|
||||
->load($this->id);
|
||||
$this->target = isset($entity) ? $entity->getTypedData() : NULL;
|
||||
}
|
||||
return $this->target;
|
||||
|
|
|
@ -33,10 +33,10 @@ class ReferenceAccessConstraintValidator extends ConstraintValidator {
|
|||
$referenced_entities = $existing_entity->{$value->getFieldDefinition()->getName()}->referencedEntities();
|
||||
// Check permission if we are not already referencing the entity.
|
||||
foreach ($referenced_entities as $ref) {
|
||||
if (isset($referenced_entities[$ref->id()])) {
|
||||
$check_permission = FALSE;
|
||||
break;
|
||||
}
|
||||
if (isset($referenced_entities[$ref->id()])) {
|
||||
$check_permission = FALSE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
// We check that the current user had access to view any newly added
|
||||
|
|
|
@ -46,13 +46,6 @@ class Query extends QueryBase implements QueryInterface {
|
|||
*/
|
||||
protected $connection;
|
||||
|
||||
/**
|
||||
* Stores the entity manager used by the query.
|
||||
*
|
||||
* @var \Drupal\Core\Entity\EntityManagerInterface
|
||||
*/
|
||||
protected $entityManager;
|
||||
|
||||
/**
|
||||
* Constructs a query object.
|
||||
*
|
||||
|
@ -232,7 +225,7 @@ class Query extends QueryBase implements QueryInterface {
|
|||
if ($this->range) {
|
||||
$this->sqlQuery->range($this->range['start'], $this->range['length']);
|
||||
}
|
||||
foreach ($this->sqlGroupBy as $field) {
|
||||
foreach ($this->sqlGroupBy as $field) {
|
||||
$this->sqlQuery->groupBy($field);
|
||||
}
|
||||
foreach ($this->sqlFields as $field) {
|
||||
|
|
|
@ -23,6 +23,7 @@ use Symfony\Component\Routing\RouteCollection;
|
|||
* - add-form
|
||||
* - edit-form
|
||||
* - delete-form
|
||||
* - collection
|
||||
*
|
||||
* @see \Drupal\Core\Entity\Routing\AdminHtmlRouteProvider.
|
||||
*
|
||||
|
@ -95,6 +96,10 @@ class DefaultHtmlRouteProvider implements EntityRouteProviderInterface, EntityHa
|
|||
$collection->add("entity.{$entity_type_id}.delete_form", $delete_route);
|
||||
}
|
||||
|
||||
if ($collection_route = $this->getCollectionRoute($entity_type)) {
|
||||
$collection->add("entity.{$entity_type_id}.collection", $collection_route);
|
||||
}
|
||||
|
||||
return $collection;
|
||||
}
|
||||
|
||||
|
@ -298,6 +303,33 @@ class DefaultHtmlRouteProvider implements EntityRouteProviderInterface, EntityHa
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the collection route.
|
||||
*
|
||||
* @param \Drupal\Core\Entity\EntityTypeInterface $entity_type
|
||||
* The entity type.
|
||||
*
|
||||
* @return \Symfony\Component\Routing\Route|null
|
||||
* The generated route, if available.
|
||||
*/
|
||||
protected function getCollectionRoute(EntityTypeInterface $entity_type) {
|
||||
// If the entity type does not provide an admin permission, there is no way
|
||||
// to control access, so we cannot provide a route in a sensible way.
|
||||
if ($entity_type->hasLinkTemplate('collection') && $entity_type->hasListBuilderClass() && ($admin_permission = $entity_type->getAdminPermission())) {
|
||||
$route = new Route($entity_type->getLinkTemplate('collection'));
|
||||
$route
|
||||
->addDefaults([
|
||||
'_entity_list' => $entity_type->id(),
|
||||
// @todo Improve this in https://www.drupal.org/node/2767025
|
||||
'_title' => '@label entities',
|
||||
'_title_arguments' => ['@label' => $entity_type->getLabel()],
|
||||
])
|
||||
->setRequirement('_permission', $admin_permission);
|
||||
|
||||
return $route;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the type of the ID key for a given entity type.
|
||||
*
|
||||
|
|
|
@ -526,7 +526,7 @@ class SqlContentEntityStorage extends ContentEntityStorageBase implements SqlEnt
|
|||
$all_fields = $revisioned_fields;
|
||||
if ($data_fields) {
|
||||
$all_fields = array_merge($revisioned_fields, $data_fields);
|
||||
$query->leftJoin($this->dataTable, 'data', "(revision.$this->idKey = data.$this->idKey)");
|
||||
$query->leftJoin($this->dataTable, 'data', "(revision.$this->idKey = data.$this->idKey and revision.$this->langcodeKey = data.$this->langcodeKey)");
|
||||
$column_names = [];
|
||||
// Some fields can have more then one columns in the data table so
|
||||
// column names are needed.
|
||||
|
|
|
@ -1443,7 +1443,7 @@ class SqlContentEntityStorageSchema implements DynamicallyFieldableEntityStorage
|
|||
*
|
||||
* @param array $entity_schema
|
||||
* The entity schema definition.
|
||||
* @param \Drupal\Core\Field\FieldStorageDefinitionInterface|NULL $storage_definition
|
||||
* @param \Drupal\Core\Field\FieldStorageDefinitionInterface|null $storage_definition
|
||||
* (optional) If a field storage definition is specified, only indexes and
|
||||
* keys involving its columns will be processed. Otherwise all defined
|
||||
* entity indexes and keys will be processed.
|
||||
|
@ -1500,7 +1500,7 @@ class SqlContentEntityStorageSchema implements DynamicallyFieldableEntityStorage
|
|||
*
|
||||
* @param array $entity_schema_data
|
||||
* The entity schema data definition.
|
||||
* @param \Drupal\Core\Field\FieldStorageDefinitionInterface|NULL $storage_definition
|
||||
* @param \Drupal\Core\Field\FieldStorageDefinitionInterface|null $storage_definition
|
||||
* (optional) If a field storage definition is specified, only indexes and
|
||||
* keys involving its columns will be processed. Otherwise all defined
|
||||
* entity indexes and keys will be processed.
|
||||
|
|
|
@ -893,9 +893,9 @@ function hook_ENTITY_TYPE_storage_load(array $entities) {
|
|||
* @see hook_ENTITY_TYPE_presave()
|
||||
*/
|
||||
function hook_entity_presave(Drupal\Core\Entity\EntityInterface $entity) {
|
||||
if ($entity instanceof ContentEntityInterface && $entity->isTranslatable()) {
|
||||
$route_match = \Drupal::routeMatch();
|
||||
\Drupal::service('content_translation.synchronizer')->synchronizeFields($entity, $entity->language()->getId(), $route_match->getParameter('source_langcode'));
|
||||
if ($entity instanceof ContentEntityInterface && $entity->isTranslatable()) {
|
||||
$route_match = \Drupal::routeMatch();
|
||||
\Drupal::service('content_translation.synchronizer')->synchronizeFields($entity, $entity->language()->getId(), $route_match->getParameter('source_langcode'));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -30,14 +30,14 @@ class AuthenticationSubscriber implements EventSubscriberInterface {
|
|||
/**
|
||||
* Authentication provider filter.
|
||||
*
|
||||
* @var \Drupal\Core\Authentication\AuthenticationProviderFilterInterface|NULL
|
||||
* @var \Drupal\Core\Authentication\AuthenticationProviderFilterInterface|null
|
||||
*/
|
||||
protected $filter;
|
||||
|
||||
/**
|
||||
* Authentication challenge provider.
|
||||
*
|
||||
* @var \Drupal\Core\Authentication\AuthenticationProviderChallengeInterface|NULL
|
||||
* @var \Drupal\Core\Authentication\AuthenticationProviderChallengeInterface|null
|
||||
*/
|
||||
protected $challengeProvider;
|
||||
|
||||
|
|
|
@ -133,6 +133,14 @@ class DefaultExceptionHtmlSubscriber extends HttpExceptionSubscriberBase {
|
|||
// would execute a subrequest with the 404 route's URL, then it'd be
|
||||
// generated for *that* URL, not the *original* URL.
|
||||
$sub_request = clone $request;
|
||||
|
||||
// The routing to the 404 page should be done as GET request because it is
|
||||
// restricted to GET and POST requests only. Otherwise a DELETE request
|
||||
// would for example trigger a method not allowed exception.
|
||||
$request_context = clone ($this->accessUnawareRouter->getContext());
|
||||
$request_context->setMethod('GET');
|
||||
$this->accessUnawareRouter->setContext($request_context);
|
||||
|
||||
$sub_request->attributes->add($this->accessUnawareRouter->match($url));
|
||||
|
||||
// Add to query (GET) or request (POST) parameters:
|
||||
|
|
|
@ -30,7 +30,7 @@ class EntityRouteAlterSubscriber implements EventSubscriberInterface {
|
|||
/**
|
||||
* Constructs an EntityRouteAlterSubscriber instance.
|
||||
*
|
||||
* @param \Drupal\Core\Entity\EntityResolverManager
|
||||
* @param \Drupal\Core\Entity\EntityResolverManager $entity_resolver_manager
|
||||
* The entity resolver manager.
|
||||
*/
|
||||
public function __construct(EntityResolverManager $entity_resolver_manager) {
|
||||
|
|
|
@ -27,6 +27,17 @@ class ExceptionJsonSubscriber extends HttpExceptionSubscriberBase {
|
|||
return -75;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles a 400 error for JSON.
|
||||
*
|
||||
* @param \Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent $event
|
||||
* The event to process.
|
||||
*/
|
||||
public function on400(GetResponseForExceptionEvent $event) {
|
||||
$response = new JsonResponse(array('message' => $event->getException()->getMessage()), Response::HTTP_BAD_REQUEST);
|
||||
$event->setResponse($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles a 403 error for JSON.
|
||||
*
|
||||
|
@ -71,4 +82,15 @@ class ExceptionJsonSubscriber extends HttpExceptionSubscriberBase {
|
|||
$event->setResponse($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles a 415 error for JSON.
|
||||
*
|
||||
* @param \Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent $event
|
||||
* The event to process.
|
||||
*/
|
||||
public function on415(GetResponseForExceptionEvent $event) {
|
||||
$response = new JsonResponse(['message' => $event->getException()->getMessage()], Response::HTTP_UNSUPPORTED_MEDIA_TYPE);
|
||||
$event->setResponse($response);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -81,6 +81,20 @@ class RecursiveExtensionFilterIterator extends \RecursiveFilterIterator {
|
|||
*/
|
||||
protected $acceptTests = FALSE;
|
||||
|
||||
/**
|
||||
* Construct a RecursiveExtensionFilterIterator.
|
||||
*
|
||||
* @param \RecursiveIterator $iterator
|
||||
* The iterator to filter.
|
||||
* @param array $blacklist
|
||||
* (optional) Add to the blacklist of directories that should be filtered
|
||||
* out during the iteration.
|
||||
*/
|
||||
public function __construct(\RecursiveIterator $iterator, array $blacklist = []) {
|
||||
parent::__construct($iterator);
|
||||
$this->blacklist = array_merge($this->blacklist, $blacklist);
|
||||
}
|
||||
|
||||
/**
|
||||
* Controls whether test directories will be scanned.
|
||||
*
|
||||
|
@ -102,6 +116,8 @@ class RecursiveExtensionFilterIterator extends \RecursiveFilterIterator {
|
|||
*/
|
||||
public function getChildren() {
|
||||
$filter = parent::getChildren();
|
||||
// Pass on the blacklist.
|
||||
$filter->blacklist = $this->blacklist;
|
||||
// Pass the $acceptTests flag forward to child iterators.
|
||||
$filter->acceptTests($this->acceptTests);
|
||||
return $filter;
|
||||
|
|
|
@ -427,11 +427,17 @@ class ExtensionDiscovery {
|
|||
$flags |= \FilesystemIterator::CURRENT_AS_SELF;
|
||||
$directory_iterator = new \RecursiveDirectoryIterator($absolute_dir, $flags);
|
||||
|
||||
// Allow directories specified in settings.php to be ignored. You can use
|
||||
// this to not check for files in common special-purpose directories. For
|
||||
// example, node_modules and bower_components. Ignoring irrelevant
|
||||
// directories is a performance boost.
|
||||
$ignore_directories = Settings::get('file_scan_ignore_directories', []);
|
||||
|
||||
// Filter the recursive scan to discover extensions only.
|
||||
// Important: Without a RecursiveFilterIterator, RecursiveDirectoryIterator
|
||||
// would recurse into the entire filesystem directory tree without any kind
|
||||
// of limitations.
|
||||
$filter = new RecursiveExtensionFilterIterator($directory_iterator);
|
||||
$filter = new RecursiveExtensionFilterIterator($directory_iterator, $ignore_directories);
|
||||
$filter->acceptTests($include_tests);
|
||||
|
||||
// The actual recursive filesystem scan is only invoked by instantiating the
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
namespace Drupal\Core\Extension;
|
||||
|
||||
use Drupal\Component\Serialization\Yaml;
|
||||
use Drupal\Component\Serialization\Exception\InvalidDataTypeException;
|
||||
use Drupal\Core\Serialization\Yaml;
|
||||
|
||||
/**
|
||||
* Parses dynamic .info.yml files that might change during the page request.
|
||||
|
|
|
@ -581,8 +581,8 @@ class ModuleHandler implements ModuleHandlerInterface {
|
|||
$this->alter('module_implements', $implementations, $hook);
|
||||
// Verify new or modified implementations.
|
||||
foreach (array_diff_assoc($implementations, $implementations_before) as $module => $group) {
|
||||
// If drupal_alter('module_implements') changed or added a $group, the
|
||||
// respective file needs to be included.
|
||||
// If an implementation of hook_module_implements_alter() changed or
|
||||
// added a group, the respective file needs to be included.
|
||||
if ($group) {
|
||||
$this->loadInclude($module, 'inc', "$module.$group");
|
||||
}
|
||||
|
|
|
@ -2,12 +2,12 @@
|
|||
|
||||
namespace Drupal\Core\Extension;
|
||||
|
||||
use Drupal\Component\Serialization\Yaml;
|
||||
use Drupal\Core\Cache\Cache;
|
||||
use Drupal\Core\Cache\CacheBackendInterface;
|
||||
use Drupal\Core\DrupalKernelInterface;
|
||||
use Drupal\Core\Entity\EntityStorageException;
|
||||
use Drupal\Core\Entity\FieldableEntityInterface;
|
||||
use Drupal\Core\Serialization\Yaml;
|
||||
|
||||
/**
|
||||
* Default implementation of the module installer.
|
||||
|
|
|
@ -198,8 +198,10 @@ class ThemeHandler implements ThemeHandlerInterface {
|
|||
* {@inheritdoc}
|
||||
*/
|
||||
public function addTheme(Extension $theme) {
|
||||
foreach ($theme->info['libraries'] as $library => $name) {
|
||||
$theme->libraries[$library] = $name;
|
||||
if (!empty($theme->info['libraries'])) {
|
||||
foreach ($theme->info['libraries'] as $library => $name) {
|
||||
$theme->libraries[$library] = $name;
|
||||
}
|
||||
}
|
||||
if (isset($theme->info['engine'])) {
|
||||
$theme->engine = $theme->info['engine'];
|
||||
|
|
|
@ -223,7 +223,7 @@ class ThemeInstaller implements ThemeInstallerInterface {
|
|||
throw new \InvalidArgumentException("The current default theme $key cannot be uninstalled.");
|
||||
}
|
||||
if ($key === $theme_config->get('admin')) {
|
||||
throw new \InvalidArgumentException("The current admin theme $key cannot be uninstalled.");
|
||||
throw new \InvalidArgumentException("The current administration theme $key cannot be uninstalled.");
|
||||
}
|
||||
// Base themes cannot be uninstalled if sub themes are installed, and if
|
||||
// they are not uninstalled at the same time.
|
||||
|
|
|
@ -30,7 +30,7 @@ trait AllowedTagsXssTrait {
|
|||
* valid UTF-8.
|
||||
*/
|
||||
public function fieldFilterXss($string) {
|
||||
return FieldFilteredMarkup::create($string);
|
||||
return FieldFilteredMarkup::create($string);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -257,7 +257,7 @@ class FieldItemList extends ItemList implements FieldItemListInterface {
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function generateSampleItems($count = 1) {
|
||||
public function generateSampleItems($count = 1) {
|
||||
$field_definition = $this->getFieldDefinition();
|
||||
$field_type_class = \Drupal::service('plugin.manager.field.field_type')->getPluginClass($field_definition->getType());
|
||||
for ($delta = 0; $delta < $count; $delta++) {
|
||||
|
|
|
@ -245,7 +245,7 @@ interface FieldItemListInterface extends ListInterface, AccessibleInterface {
|
|||
* in order to be a valid runtime value for the field type; e.g., a date field
|
||||
* could process the defined value of 'NOW' to a valid date.
|
||||
*
|
||||
* @param array
|
||||
* @param array $default_value
|
||||
* The unprocessed default value defined for the field, as a numerically
|
||||
* indexed array of items, each item being an array of property/value pairs.
|
||||
* @param \Drupal\Core\Entity\FieldableEntityInterface $entity
|
||||
|
|
|
@ -34,7 +34,7 @@ class FieldTypePluginManager extends DefaultPluginManager implements FieldTypePl
|
|||
* keyed by the corresponding namespace to look for plugin implementations.
|
||||
* @param \Drupal\Core\Cache\CacheBackendInterface $cache_backend
|
||||
* Cache backend instance to use.
|
||||
* @param \Drupal\Core\Extension\ModuleHandlerInterface
|
||||
* @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
|
||||
* The module handler.
|
||||
* @param \Drupal\Core\TypedData\TypedDataManagerInterface $typed_data_manager
|
||||
* The typed data manager.
|
||||
|
|
|
@ -617,7 +617,7 @@ class EntityReferenceItem extends FieldItemBase implements OptionsProviderInterf
|
|||
$form_state->setRebuild();
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function getPreconfiguredOptions() {
|
||||
|
|
|
@ -13,7 +13,6 @@ use Drupal\Core\TypedData\DataDefinition;
|
|||
* id = "timestamp",
|
||||
* label = @Translation("Timestamp"),
|
||||
* description = @Translation("An entity field containing a UNIX timestamp value."),
|
||||
* no_ui = TRUE,
|
||||
* default_widget = "datetime_default",
|
||||
* default_formatter = "timestamp",
|
||||
* constraints = {
|
||||
|
|
|
@ -25,7 +25,7 @@ class BooleanCheckboxWidget extends WidgetBase {
|
|||
*/
|
||||
public static function defaultSettings() {
|
||||
return array(
|
||||
'display_label' => FALSE,
|
||||
'display_label' => TRUE,
|
||||
) + parent::defaultSettings();
|
||||
}
|
||||
|
||||
|
|
|
@ -190,7 +190,7 @@ abstract class OptionsWidgetBase extends WidgetBase {
|
|||
/**
|
||||
* Returns the empty option label to add to the list of options, if any.
|
||||
*
|
||||
* @return string|NULL
|
||||
* @return string|null
|
||||
* Either a label of the empty option, or NULL.
|
||||
*/
|
||||
protected function getEmptyLabel() { }
|
||||
|
|
|
@ -31,7 +31,7 @@ class MimeTypeGuesser implements MimeTypeGuesserInterface {
|
|||
*/
|
||||
protected $sortedGuessers = NULL;
|
||||
|
||||
/**
|
||||
/**
|
||||
* The stream wrapper manager.
|
||||
*
|
||||
* @var \Drupal\Core\StreamWrapper\StreamWrapperManagerInterface
|
||||
|
|
|
@ -37,7 +37,7 @@ class EnforcedResponse extends Response {
|
|||
* @param \Exception $e
|
||||
* The exception where the enforced response is to be extracted from.
|
||||
*
|
||||
* @return \Drupal\Core\Form\EnforcedResponse|NULL
|
||||
* @return \Drupal\Core\Form\EnforcedResponse|null
|
||||
* The enforced response or NULL if the exception chain does not contain a
|
||||
* \Drupal\Core\Form\EnforcedResponseException exception.
|
||||
*/
|
||||
|
|
|
@ -92,7 +92,7 @@ class FormAjaxSubscriber implements EventSubscriberInterface {
|
|||
$form_state = $exception->getFormState();
|
||||
|
||||
// Set the build ID from the request as the old build ID on the form.
|
||||
$form['#build_id_old'] = $request->get('form_build_id');
|
||||
$form['#build_id_old'] = $request->request->get('form_build_id');
|
||||
|
||||
try {
|
||||
$response = $this->formAjaxResponseBuilder->buildResponse($request, $form, $form_state, []);
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Reference in a new issue