Update to Drupal 8.0.0-rc3. For more information, see https://www.drupal.org/node/2608078
This commit is contained in:
parent
6419a031d7
commit
4afb23bbd3
762 changed files with 20080 additions and 6368 deletions
|
@ -26,7 +26,7 @@ class MockFileFinder implements ClassFinderInterface {
|
|||
protected $filename;
|
||||
|
||||
/**
|
||||
* Implements Doctrine\Common\Reflection\ClassFinderInterface::findFile().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function findFile($class) {
|
||||
return $this->filename;
|
||||
|
|
|
@ -71,7 +71,7 @@ class ContainerAwareEventDispatcher implements EventDispatcherInterface {
|
|||
/**
|
||||
* Constructs a container aware event dispatcher.
|
||||
*
|
||||
* @param \Symfony\Component\EventDispatcher\IntrospectableContainerInterface $container
|
||||
* @param \Symfony\Component\DependencyInjection\IntrospectableContainerInterface $container
|
||||
* The service container.
|
||||
* @param array $listeners
|
||||
* A nested array of listener definitions keyed by event name and priority.
|
||||
|
|
|
@ -27,7 +27,7 @@ class PoMemoryWriter implements PoWriterInterface {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Component\Gettext\PoWriterInterface::writeItem().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function writeItem(PoItem $item) {
|
||||
if (is_array($item->getSource())) {
|
||||
|
@ -39,7 +39,7 @@ class PoMemoryWriter implements PoWriterInterface {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Component\Gettext\PoWriterInterface::writeItems().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function writeItems(PoReaderInterface $reader, $count = -1) {
|
||||
$forever = $count == -1;
|
||||
|
|
|
@ -103,21 +103,21 @@ class PoStreamReader implements PoStreamInterface, PoReaderInterface {
|
|||
private $_errors;
|
||||
|
||||
/**
|
||||
* Implements Drupal\Component\Gettext\PoMetadataInterface::getLangcode().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getLangcode() {
|
||||
return $this->_langcode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Component\Gettext\PoMetadataInterface::setLangcode().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setLangcode($langcode) {
|
||||
$this->_langcode = $langcode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Component\Gettext\PoMetadataInterface::getHeader().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getHeader() {
|
||||
return $this->_header;
|
||||
|
@ -132,14 +132,14 @@ class PoStreamReader implements PoStreamInterface, PoReaderInterface {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Component\Gettext\PoStreamInterface::getURI().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getURI() {
|
||||
return $this->_uri;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Component\Gettext\PoStreamInterface::setURI().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setURI($uri) {
|
||||
$this->_uri = $uri;
|
||||
|
@ -180,7 +180,7 @@ class PoStreamReader implements PoStreamInterface, PoReaderInterface {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Component\Gettext\PoReaderInterface::readItem().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function readItem() {
|
||||
// Clear out the last item.
|
||||
|
|
|
@ -74,7 +74,7 @@ class PoStreamWriter implements PoWriterInterface, PoStreamInterface {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Component\Gettext\PoStreamInterface::open().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function open() {
|
||||
// Open in write mode. Will overwrite the stream if it already exists.
|
||||
|
@ -123,14 +123,14 @@ class PoStreamWriter implements PoWriterInterface, PoStreamInterface {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Component\Gettext\PoWriterInterface::writeItem().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function writeItem(PoItem $item) {
|
||||
$this->write($item);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Component\Gettext\PoWriterInterface::writeItems().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function writeItems(PoReaderInterface $reader, $count = -1) {
|
||||
$forever = $count == -1;
|
||||
|
@ -153,7 +153,7 @@ class PoStreamWriter implements PoWriterInterface, PoStreamInterface {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Component\Gettext\PoStreamInterface::setURI().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setURI($uri) {
|
||||
$this->_uri = $uri;
|
||||
|
|
|
@ -46,6 +46,11 @@ abstract class SecuredRedirectResponse extends RedirectResponse {
|
|||
protected function fromResponse(RedirectResponse $response) {
|
||||
$this->setProtocolVersion($response->getProtocolVersion());
|
||||
$this->setCharset($response->getCharset());
|
||||
// Cookies are separate from other headers and have to be copied over
|
||||
// directly.
|
||||
foreach ($response->headers->getCookies() as $cookie) {
|
||||
$this->headers->setCookie($cookie);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -34,14 +34,14 @@ class FileReadOnlyStorage implements PhpStorageInterface {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Component\PhpStorage\PhpStorageInterface::exists().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function exists($name) {
|
||||
return file_exists($this->getFullPath($name));
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Component\PhpStorage\PhpStorageInterface::load().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function load($name) {
|
||||
// The FALSE returned on failure is enough for the caller to handle this,
|
||||
|
@ -50,14 +50,14 @@ class FileReadOnlyStorage implements PhpStorageInterface {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Component\PhpStorage\PhpStorageInterface::save().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function save($name, $code) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Component\PhpStorage\PhpStorageInterface::delete().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function delete($name) {
|
||||
return FALSE;
|
||||
|
@ -71,14 +71,14 @@ class FileReadOnlyStorage implements PhpStorageInterface {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Component\PhpStorage\PhpStorageInterface::writeable().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
function writeable() {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Component\PhpStorage\PhpStorageInterface::deleteAll().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function deleteAll() {
|
||||
return FALSE;
|
||||
|
|
|
@ -33,14 +33,14 @@ class FileStorage implements PhpStorageInterface {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Component\PhpStorage\PhpStorageInterface::exists().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function exists($name) {
|
||||
return file_exists($this->getFullPath($name));
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Component\PhpStorage\PhpStorageInterface::load().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function load($name) {
|
||||
// The FALSE returned on failure is enough for the caller to handle this,
|
||||
|
@ -49,7 +49,7 @@ class FileStorage implements PhpStorageInterface {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Component\PhpStorage\PhpStorageInterface::save().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function save($name, $code) {
|
||||
$path = $this->getFullPath($name);
|
||||
|
@ -183,7 +183,7 @@ EOF;
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Component\PhpStorage\PhpStorageInterface::delete().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function delete($name) {
|
||||
$path = $this->getFullPath($name);
|
||||
|
@ -201,14 +201,14 @@ EOF;
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Component\PhpStorage\PhpStorageInterface::writeable().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function writeable() {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Component\PhpStorage\PhpStorageInterface::deleteAll().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function deleteAll() {
|
||||
return $this->unlink($this->directory);
|
||||
|
|
|
@ -36,7 +36,7 @@ namespace Drupal\Component\PhpStorage;
|
|||
class MTimeProtectedFileStorage extends MTimeProtectedFastFileStorage {
|
||||
|
||||
/**
|
||||
* Implements Drupal\Component\PhpStorage\PhpStorageInterface::load().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function load($name) {
|
||||
if (($filename = $this->checkFile($name)) !== FALSE) {
|
||||
|
@ -47,7 +47,7 @@ class MTimeProtectedFileStorage extends MTimeProtectedFastFileStorage {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Component\PhpStorage\PhpStorageInterface::exists().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function exists($name) {
|
||||
return $this->checkFile($name) !== FALSE;
|
||||
|
|
|
@ -44,7 +44,7 @@ class Context implements ContextInterface {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements \Drupal\Component\Plugin\Context\ContextInterface::getContextValue().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getContextValue() {
|
||||
// Support optional contexts.
|
||||
|
@ -71,14 +71,14 @@ class Context implements ContextInterface {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements \Drupal\Component\Plugin\Context\ContextInterface::getContextDefinition().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getContextDefinition() {
|
||||
return $this->contextDefinition;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements \Drupal\Component\Plugin\Context\ContextInterface::getConstraints().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getConstraints() {
|
||||
if (empty($this->contextDefinition['class'])) {
|
||||
|
@ -88,7 +88,7 @@ class Context implements ContextInterface {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements \Drupal\Component\Plugin\Context\ContextInterface::validate().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function validate() {
|
||||
$validator = Validation::createValidatorBuilder()
|
||||
|
|
|
@ -33,22 +33,22 @@ interface ContextAwarePluginInterface extends PluginInspectionInterface {
|
|||
* @param string $name
|
||||
* The name of the context in the plugin definition.
|
||||
*
|
||||
* @throws \Drupal\Component\Plugin\Exception\PluginException
|
||||
* If the requested context is not defined.
|
||||
*
|
||||
* @return \Drupal\Component\Plugin\Context\ContextDefinitionInterface.
|
||||
* The definition against which the context value must validate.
|
||||
*
|
||||
* @throws \Drupal\Component\Plugin\Exception\PluginException
|
||||
* If the requested context is not defined.
|
||||
*/
|
||||
public function getContextDefinition($name);
|
||||
|
||||
/**
|
||||
* Gets the defined contexts.
|
||||
*
|
||||
* @throws \Drupal\Component\Plugin\Exception\PluginException
|
||||
* If contexts are defined but not set.
|
||||
*
|
||||
* @return array
|
||||
* The set context objects.
|
||||
*
|
||||
* @throws \Drupal\Component\Plugin\Exception\PluginException
|
||||
* If contexts are defined but not set.
|
||||
*/
|
||||
public function getContexts();
|
||||
|
||||
|
@ -58,11 +58,11 @@ interface ContextAwarePluginInterface extends PluginInspectionInterface {
|
|||
* @param string $name
|
||||
* The name of the context in the plugin definition.
|
||||
*
|
||||
* @throws \Drupal\Component\Plugin\Exception\PluginException
|
||||
* If the requested context is not set.
|
||||
*
|
||||
* @return \Drupal\Component\Plugin\Context\ContextInterface
|
||||
* The context object.
|
||||
*
|
||||
* @throws \Drupal\Component\Plugin\Exception\PluginException
|
||||
* If the requested context is not set.
|
||||
*/
|
||||
public function getContext($name);
|
||||
|
||||
|
@ -81,11 +81,11 @@ interface ContextAwarePluginInterface extends PluginInspectionInterface {
|
|||
* @param string $name
|
||||
* The name of the context in the plugin configuration.
|
||||
*
|
||||
* @throws \Drupal\Component\Plugin\Exception\PluginException
|
||||
* If the requested context is not set.
|
||||
*
|
||||
* @return mixed
|
||||
* The currently set context value.
|
||||
*
|
||||
* @throws \Drupal\Component\Plugin\Exception\PluginException
|
||||
* If the requested context is not set.
|
||||
*/
|
||||
public function getContextValue($name);
|
||||
|
||||
|
@ -108,11 +108,11 @@ interface ContextAwarePluginInterface extends PluginInspectionInterface {
|
|||
* The value to set the context to. The value has to validate against the
|
||||
* provided context definition.
|
||||
*
|
||||
* @throws \Drupal\Component\Plugin\Exception\PluginException
|
||||
* If the value does not pass validation.
|
||||
*
|
||||
* @return \Drupal\Component\Plugin\ContextAwarePluginInterface.
|
||||
* A context aware plugin object for chaining.
|
||||
*
|
||||
* @throws \Drupal\Component\Plugin\Exception\PluginException
|
||||
* If the value does not pass validation.
|
||||
*/
|
||||
public function setContextValue($name, $value);
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Component\Plugin\PluginDefinitionInterface.
|
||||
* Contains \Drupal\Component\Plugin\Definition\PluginDefinitionInterface.
|
||||
*/
|
||||
|
||||
namespace Drupal\Component\Plugin\Definition;
|
||||
|
|
|
@ -16,7 +16,7 @@ class StaticDiscovery implements DiscoveryInterface {
|
|||
use DiscoveryCachedTrait;
|
||||
|
||||
/**
|
||||
* Implements Drupal\Component\Plugin\Discovery\DiscoveryInterface::getDefinitions().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getDefinitions() {
|
||||
if (!$this->definitions) {
|
||||
|
|
|
@ -52,7 +52,7 @@ class StaticDiscoveryDecorator extends StaticDiscovery {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Component\Plugin\Discovery\DiscoveryInterface::getDefinitions().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getDefinitions() {
|
||||
if (isset($this->registerDefinitions)) {
|
||||
|
|
|
@ -51,7 +51,7 @@ class DefaultFactory implements FactoryInterface {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Component\Plugin\Factory\FactoryInterface::createInstance().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function createInstance($plugin_id, array $configuration = array()) {
|
||||
$plugin_definition = $this->discovery->getDefinition($plugin_id);
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace Drupal\Component\Plugin\Factory;
|
|||
class ReflectionFactory extends DefaultFactory {
|
||||
|
||||
/**
|
||||
* Implements Drupal\Component\Plugin\Factory\FactoryInterface::createInstance().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function createInstance($plugin_id, array $configuration = array()) {
|
||||
$plugin_definition = $this->discovery->getDefinition($plugin_id);
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
/**
|
||||
* @file
|
||||
* Contains Drupal\Component\Render\FormattableMarkup.
|
||||
* Contains \Drupal\Component\Render\FormattableMarkup.
|
||||
*/
|
||||
|
||||
namespace Drupal\Component\Render;
|
||||
|
@ -65,7 +65,7 @@ use Drupal\Component\Utility\UrlHelper;
|
|||
* @see \Drupal\Core\StringTranslation\PluralTranslatableMarkup
|
||||
* @see \Drupal\Component\Render\FormattableMarkup::placeholderFormat()
|
||||
*/
|
||||
class FormattableMarkup implements MarkupInterface {
|
||||
class FormattableMarkup implements MarkupInterface, \Countable {
|
||||
|
||||
/**
|
||||
* The arguments to replace placeholders with.
|
||||
|
@ -223,7 +223,6 @@ class FormattableMarkup implements MarkupInterface {
|
|||
break;
|
||||
|
||||
case '%':
|
||||
default:
|
||||
// Similarly to @, escape non-safe values. Also, add wrapping markup
|
||||
// in order to render as a placeholder. Not for use within attributes,
|
||||
// per the warning above about
|
||||
|
@ -231,6 +230,16 @@ class FormattableMarkup implements MarkupInterface {
|
|||
// due to the wrapping markup.
|
||||
$args[$key] = '<em class="placeholder">' . static::placeholderEscape($value) . '</em>';
|
||||
break;
|
||||
|
||||
default:
|
||||
// We do not trigger an error for placeholder that start with an
|
||||
// alphabetic character.
|
||||
if (!ctype_alpha($key[0])) {
|
||||
// We trigger an error as we may want to introduce new placeholders
|
||||
// in the future without breaking backward compatibility.
|
||||
trigger_error('Invalid placeholder: ' . $key, E_USER_ERROR);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ use Drupal\Component\Utility\Unicode;
|
|||
*
|
||||
* @ingroup sanitization
|
||||
*/
|
||||
class HtmlEscapedText implements MarkupInterface {
|
||||
class HtmlEscapedText implements MarkupInterface, \Countable {
|
||||
|
||||
/**
|
||||
* The string to escape.
|
||||
|
|
|
@ -41,6 +41,13 @@ class Crypt {
|
|||
$bytes .= openssl_random_pseudo_bytes($missing_bytes);
|
||||
}
|
||||
|
||||
// If OpenSSL is not available, we can use mcrypt. On Windows, this will
|
||||
// transparently pull from CryptGenRandom. On Unix-based systems, it will
|
||||
// read from /dev/urandom as expected.
|
||||
elseif (function_exists(('mcrypt_create_iv')) && defined('MCRYPT_DEV_URANDOM')) {
|
||||
$bytes .= mcrypt_create_iv($count, MCRYPT_DEV_URANDOM);
|
||||
}
|
||||
|
||||
// Else, read directly from /dev/urandom, which is available on many *nix
|
||||
// systems and is considered cryptographically secure.
|
||||
elseif ($fh = @fopen('/dev/urandom', 'rb')) {
|
||||
|
@ -125,6 +132,49 @@ class Crypt {
|
|||
return str_replace(['+', '/', '='], ['-', '_', ''], $hash);
|
||||
}
|
||||
|
||||
/**
|
||||
* Compares strings in constant time.
|
||||
*
|
||||
* @param string $known_string
|
||||
* The expected string.
|
||||
* @param string $user_string
|
||||
* The user supplied string to check.
|
||||
*
|
||||
* @return bool
|
||||
* Returns TRUE when the two strings are equal, FALSE otherwise.
|
||||
*/
|
||||
public static function hashEquals($known_string, $user_string) {
|
||||
if (function_exists('hash_equals')) {
|
||||
return hash_equals($known_string, $user_string);
|
||||
}
|
||||
else {
|
||||
// Backport of hash_equals() function from PHP 5.6
|
||||
// @see https://github.com/php/php-src/blob/PHP-5.6/ext/hash/hash.c#L739
|
||||
if (!is_string($known_string)) {
|
||||
trigger_error(sprintf("Expected known_string to be a string, %s given", gettype($known_string)), E_USER_WARNING);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!is_string($user_string)) {
|
||||
trigger_error(sprintf("Expected user_string to be a string, %s given", gettype($user_string)), E_USER_WARNING);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
$known_len = strlen($known_string);
|
||||
if ($known_len !== strlen($user_string)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// This is security sensitive code. Do not optimize this for speed.
|
||||
$result = 0;
|
||||
for ($i = 0; $i < $known_len; $i++) {
|
||||
$result |= (ord($known_string[$i]) ^ ord($user_string[$i]));
|
||||
}
|
||||
|
||||
return $result === 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a URL-safe, base64 encoded string of highly randomized bytes.
|
||||
*
|
||||
|
|
|
@ -155,11 +155,11 @@ class AccessManager implements AccessManagerInterface {
|
|||
* @param \Drupal\Component\Utility\ArgumentsResolverInterface $arguments_resolver
|
||||
* The parametrized arguments resolver instance.
|
||||
*
|
||||
* @throws \Drupal\Core\Access\AccessException
|
||||
* Thrown when the access check returns an invalid value.
|
||||
*
|
||||
* @return \Drupal\Core\Access\AccessResultInterface
|
||||
* The access result.
|
||||
*
|
||||
* @throws \Drupal\Core\Access\AccessException
|
||||
* Thrown when the access check returns an invalid value.
|
||||
*/
|
||||
protected function performCheck($service_id, ArgumentsResolverInterface $arguments_resolver) {
|
||||
$callable = $this->checkProvider->loadCheck($service_id);
|
||||
|
|
|
@ -148,6 +148,16 @@ class AjaxResponseAttachmentsProcessor implements AttachmentsResponseProcessorIn
|
|||
$css_assets = $this->assetResolver->getCssAssets($assets, $optimize_css);
|
||||
list($js_assets_header, $js_assets_footer) = $this->assetResolver->getJsAssets($assets, $optimize_js);
|
||||
|
||||
// First, AttachedAssets::setLibraries() ensures duplicate libraries are
|
||||
// removed: it converts it to a set of libraries if necessary. Second,
|
||||
// AssetResolver::getJsSettings() ensures $assets contains the final set of
|
||||
// JavaScript settings. AttachmentsResponseProcessorInterface also mandates
|
||||
// that the response it processes contains the final attachment values, so
|
||||
// update both the 'library' and 'drupalSettings' attachments accordingly.
|
||||
$attachments['library'] = $assets->getLibraries();
|
||||
$attachments['drupalSettings'] = $assets->getSettings();
|
||||
$response->setAttachments($attachments);
|
||||
|
||||
// Render the HTML to load these files, and add AJAX commands to insert this
|
||||
// HTML in the page. Settings are handled separately, afterwards.
|
||||
$settings = [];
|
||||
|
|
|
@ -42,7 +42,7 @@ class CloseDialogCommand implements CommandInterface {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements \Drupal\Core\Ajax\CommandInterface::render().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function render() {
|
||||
return array(
|
||||
|
|
|
@ -54,7 +54,7 @@ class SetDialogOptionCommand implements CommandInterface {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements \Drupal\Core\Ajax\CommandInterface::render().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function render() {
|
||||
return array(
|
||||
|
|
|
@ -39,7 +39,7 @@ class ArchiverManager extends DefaultPluginManager {
|
|||
}
|
||||
|
||||
/**
|
||||
* Overrides \Drupal\Component\Plugin\PluginManagerBase::createInstance().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function createInstance($plugin_id, array $configuration = array()) {
|
||||
$plugin_definition = $this->getDefinition($plugin_id);
|
||||
|
@ -48,7 +48,7 @@ class ArchiverManager extends DefaultPluginManager {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements \Drupal\Core\PluginManagerInterface::getInstance().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getInstance(array $options) {
|
||||
$filepath = $options['filepath'];
|
||||
|
|
|
@ -334,6 +334,9 @@ class AssetResolver implements AssetResolverInterface {
|
|||
// Allow modules and themes to alter the JavaScript settings.
|
||||
$this->moduleHandler->alter('js_settings', $settings, $assets);
|
||||
$this->themeManager->alter('js_settings', $settings, $assets);
|
||||
// Update the $assets object accordingly, so that it reflects the final
|
||||
// settings.
|
||||
$assets->setSettings($settings);
|
||||
$settings_as_inline_javascript = [
|
||||
'type' => 'setting',
|
||||
'group' => JS_SETTING,
|
||||
|
|
|
@ -69,6 +69,8 @@ interface AssetResolverInterface {
|
|||
*
|
||||
* @param \Drupal\Core\Asset\AttachedAssetsInterface $assets
|
||||
* The assets attached to the current response.
|
||||
* Note that this object is modified to reflect the final JavaScript
|
||||
* settings assets.
|
||||
* @param bool $optimize
|
||||
* Whether to apply the JavaScript asset collection optimizer, to return
|
||||
* optimized JavaScript asset collections rather than an unoptimized ones.
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
namespace Drupal\Core\Asset;
|
||||
|
||||
use Drupal\Core\Cache\CacheCollectorInterface;
|
||||
use Drupal\Core\Cache\CacheTagsInvalidatorInterface;
|
||||
|
||||
/**
|
||||
* Discovers available asset libraries in Drupal.
|
||||
|
@ -22,13 +21,6 @@ class LibraryDiscovery implements LibraryDiscoveryInterface {
|
|||
*/
|
||||
protected $collector;
|
||||
|
||||
/**
|
||||
* The cache tag invalidator.
|
||||
*
|
||||
* @var \Drupal\Core\Cache\CacheTagsInvalidatorInterface
|
||||
*/
|
||||
protected $cacheTagInvalidator;
|
||||
|
||||
/**
|
||||
* The final library definitions, statically cached.
|
||||
*
|
||||
|
@ -44,16 +36,9 @@ class LibraryDiscovery implements LibraryDiscoveryInterface {
|
|||
*
|
||||
* @param \Drupal\Core\Cache\CacheCollectorInterface $library_discovery_collector
|
||||
* The library discovery cache collector.
|
||||
* @param \Drupal\Core\Cache\CacheTagsInvalidatorInterface $cache_tag_invalidator
|
||||
* The cache tag invalidator.
|
||||
* @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
|
||||
* The module handler.
|
||||
* @param \Drupal\Core\Theme\ThemeManagerInterface $theme_manager
|
||||
* The theme manager.
|
||||
*/
|
||||
public function __construct(CacheCollectorInterface $library_discovery_collector, CacheTagsInvalidatorInterface $cache_tag_invalidator) {
|
||||
public function __construct(CacheCollectorInterface $library_discovery_collector) {
|
||||
$this->collector = $library_discovery_collector;
|
||||
$this->cacheTagInvalidator = $cache_tag_invalidator;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -64,7 +49,6 @@ class LibraryDiscovery implements LibraryDiscoveryInterface {
|
|||
$libraries = $this->collector->get($extension);
|
||||
$this->libraryDefinitions[$extension] = [];
|
||||
foreach ($libraries as $name => $definition) {
|
||||
$library_name = "$extension/$name";
|
||||
$this->libraryDefinitions[$extension][$name] = $definition;
|
||||
}
|
||||
}
|
||||
|
@ -84,7 +68,6 @@ class LibraryDiscovery implements LibraryDiscoveryInterface {
|
|||
* {@inheritdoc}
|
||||
*/
|
||||
public function clearCachedDefinitions() {
|
||||
$this->cacheTagInvalidator->invalidateTags(['library_info']);
|
||||
$this->libraryDefinitions = [];
|
||||
$this->collector->clear();
|
||||
}
|
||||
|
|
|
@ -88,7 +88,6 @@ class LibraryDiscoveryCollector extends CacheCollector {
|
|||
return $this->storage[$key];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the library definitions for a given extension.
|
||||
*
|
||||
|
@ -172,4 +171,13 @@ class LibraryDiscoveryCollector extends CacheCollector {
|
|||
}
|
||||
return $library_definition;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function reset() {
|
||||
parent::reset();
|
||||
$this->cid = NULL;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Core\Plugin\Block\PageTitleBlock.
|
||||
* Contains \Drupal\Core\Block\Plugin\Block\PageTitleBlock.
|
||||
*/
|
||||
|
||||
namespace Drupal\Core\Block\Plugin\Block;
|
||||
|
|
|
@ -74,7 +74,7 @@ class BackendChain implements CacheBackendInterface, CacheTagsInvalidatorInterfa
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Core\Cache\CacheBackendInterface::get().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function get($cid, $allow_invalid = FALSE) {
|
||||
foreach ($this->backends as $index => $backend) {
|
||||
|
@ -94,7 +94,7 @@ class BackendChain implements CacheBackendInterface, CacheTagsInvalidatorInterfa
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Core\Cache\CacheBackendInterface::getMultiple().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getMultiple(&$cids, $allow_invalid = FALSE) {
|
||||
$return = array();
|
||||
|
@ -125,7 +125,7 @@ class BackendChain implements CacheBackendInterface, CacheTagsInvalidatorInterfa
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Core\Cache\CacheBackendInterface::set().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function set($cid, $data, $expire = Cache::PERMANENT, array $tags = array()) {
|
||||
foreach ($this->backends as $backend) {
|
||||
|
@ -143,7 +143,7 @@ class BackendChain implements CacheBackendInterface, CacheTagsInvalidatorInterfa
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Core\Cache\CacheBackendInterface::delete().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function delete($cid) {
|
||||
foreach ($this->backends as $backend) {
|
||||
|
@ -152,7 +152,7 @@ class BackendChain implements CacheBackendInterface, CacheTagsInvalidatorInterfa
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Core\Cache\CacheBackendInterface::deleteMultiple().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function deleteMultiple(array $cids) {
|
||||
foreach ($this->backends as $backend) {
|
||||
|
@ -161,7 +161,7 @@ class BackendChain implements CacheBackendInterface, CacheTagsInvalidatorInterfa
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Core\Cache\CacheBackendInterface::deleteAll().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function deleteAll() {
|
||||
foreach ($this->backends as $backend) {
|
||||
|
@ -170,7 +170,7 @@ class BackendChain implements CacheBackendInterface, CacheTagsInvalidatorInterfa
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Core\Cache\CacheBackendInterface::invalidate().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function invalidate($cid) {
|
||||
foreach ($this->backends as $backend) {
|
||||
|
@ -179,7 +179,7 @@ class BackendChain implements CacheBackendInterface, CacheTagsInvalidatorInterfa
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Core\Cache\CacheBackendInterface::invalidateMultiple().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function invalidateMultiple(array $cids) {
|
||||
foreach ($this->backends as $backend) {
|
||||
|
@ -188,7 +188,7 @@ class BackendChain implements CacheBackendInterface, CacheTagsInvalidatorInterfa
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Core\Cache\CacheBackendInterface::invalidateTags().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function invalidateTags(array $tags) {
|
||||
foreach ($this->backends as $backend) {
|
||||
|
@ -199,7 +199,7 @@ class BackendChain implements CacheBackendInterface, CacheTagsInvalidatorInterfa
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Core\Cache\CacheBackendInterface::invalidateAll().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function invalidateAll() {
|
||||
foreach ($this->backends as $backend) {
|
||||
|
@ -208,7 +208,7 @@ class BackendChain implements CacheBackendInterface, CacheTagsInvalidatorInterfa
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Core\Cache\CacheBackendInterface::garbageCollection().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function garbageCollection() {
|
||||
foreach ($this->backends as $backend) {
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Core\Cache\CacheableResponse.
|
||||
* Contains \Drupal\Core\Cache\CacheableJsonResponse.
|
||||
*/
|
||||
|
||||
namespace Drupal\Core\Cache;
|
||||
|
|
|
@ -61,7 +61,7 @@ class DatabaseBackend implements CacheBackendInterface {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Core\Cache\CacheBackendInterface::get().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function get($cid, $allow_invalid = FALSE) {
|
||||
$cids = array($cid);
|
||||
|
@ -70,7 +70,7 @@ class DatabaseBackend implements CacheBackendInterface {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Core\Cache\CacheBackendInterface::getMultiple().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getMultiple(&$cids, $allow_invalid = FALSE) {
|
||||
$cid_mapping = array();
|
||||
|
@ -240,14 +240,14 @@ class DatabaseBackend implements CacheBackendInterface {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Core\Cache\CacheBackendInterface::delete().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function delete($cid) {
|
||||
$this->deleteMultiple(array($cid));
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Core\Cache\CacheBackendInterface::deleteMultiple().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function deleteMultiple(array $cids) {
|
||||
$cids = array_values(array_map(array($this, 'normalizeCid'), $cids));
|
||||
|
@ -270,7 +270,7 @@ class DatabaseBackend implements CacheBackendInterface {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Core\Cache\CacheBackendInterface::deleteAll().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function deleteAll() {
|
||||
try {
|
||||
|
@ -287,14 +287,14 @@ class DatabaseBackend implements CacheBackendInterface {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Core\Cache\CacheBackendInterface::invalidate().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function invalidate($cid) {
|
||||
$this->invalidateMultiple(array($cid));
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Core\Cache\CacheBackendInterface::invalidateMultiple().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function invalidateMultiple(array $cids) {
|
||||
$cids = array_values(array_map(array($this, 'normalizeCid'), $cids));
|
||||
|
@ -313,7 +313,7 @@ class DatabaseBackend implements CacheBackendInterface {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Core\Cache\CacheBackendInterface::invalidateAll().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function invalidateAll() {
|
||||
try {
|
||||
|
@ -327,7 +327,7 @@ class DatabaseBackend implements CacheBackendInterface {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Core\Cache\CacheBackendInterface::garbageCollection().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function garbageCollection() {
|
||||
try {
|
||||
|
|
|
@ -34,7 +34,7 @@ class MemoryBackend implements CacheBackendInterface, CacheTagsInvalidatorInterf
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Core\Cache\CacheBackendInterface::get().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function get($cid, $allow_invalid = FALSE) {
|
||||
if (isset($this->cache[$cid])) {
|
||||
|
@ -46,7 +46,7 @@ class MemoryBackend implements CacheBackendInterface, CacheTagsInvalidatorInterf
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Core\Cache\CacheBackendInterface::getMultiple().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getMultiple(&$cids, $allow_invalid = FALSE) {
|
||||
$ret = array();
|
||||
|
@ -104,7 +104,7 @@ class MemoryBackend implements CacheBackendInterface, CacheTagsInvalidatorInterf
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Core\Cache\CacheBackendInterface::set().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function set($cid, $data, $expire = Cache::PERMANENT, array $tags = array()) {
|
||||
assert('\Drupal\Component\Assertion\Inspector::assertAllStrings($tags)', 'Cache Tags must be strings.');
|
||||
|
@ -130,28 +130,28 @@ class MemoryBackend implements CacheBackendInterface, CacheTagsInvalidatorInterf
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Core\Cache\CacheBackendInterface::delete().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function delete($cid) {
|
||||
unset($this->cache[$cid]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Core\Cache\CacheBackendInterface::deleteMultiple().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function deleteMultiple(array $cids) {
|
||||
$this->cache = array_diff_key($this->cache, array_flip($cids));
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Core\Cache\CacheBackendInterface::deleteAll().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function deleteAll() {
|
||||
$this->cache = array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Core\Cache\CacheBackendInterface::invalidate().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function invalidate($cid) {
|
||||
if (isset($this->cache[$cid])) {
|
||||
|
@ -160,7 +160,7 @@ class MemoryBackend implements CacheBackendInterface, CacheTagsInvalidatorInterf
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Core\Cache\CacheBackendInterface::invalidateMultiple().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function invalidateMultiple(array $cids) {
|
||||
foreach ($cids as $cid) {
|
||||
|
@ -180,7 +180,7 @@ class MemoryBackend implements CacheBackendInterface, CacheTagsInvalidatorInterf
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Core\Cache\CacheBackendInterface::invalidateAll().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function invalidateAll() {
|
||||
foreach ($this->cache as $cid => $item) {
|
||||
|
@ -189,7 +189,7 @@ class MemoryBackend implements CacheBackendInterface, CacheTagsInvalidatorInterf
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Core\Cache\CacheBackendInterface::garbageCollection()
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function garbageCollection() {
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ class MemoryCounterBackend extends MemoryBackend {
|
|||
protected $counter = array();
|
||||
|
||||
/**
|
||||
* Implements \Drupal\Core\Cache\CacheBackendInterface::get().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function get($cid, $allow_invalid = FALSE) {
|
||||
$this->increaseCounter(__FUNCTION__, $cid);
|
||||
|
@ -34,7 +34,7 @@ class MemoryCounterBackend extends MemoryBackend {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements \Drupal\Core\Cache\CacheBackendInterface::set().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function set($cid, $data, $expire = Cache::PERMANENT, array $tags = array()) {
|
||||
$this->increaseCounter(__FUNCTION__, $cid);
|
||||
|
@ -42,7 +42,7 @@ class MemoryCounterBackend extends MemoryBackend {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements \Drupal\Core\Cache\CacheBackendInterface::delete().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function delete($cid) {
|
||||
$this->increaseCounter(__FUNCTION__, $cid);
|
||||
|
|
|
@ -31,21 +31,21 @@ class NullBackend implements CacheBackendInterface {
|
|||
public function __construct($bin) {}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Core\Cache\CacheBackendInterface::get().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function get($cid, $allow_invalid = FALSE) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Core\Cache\CacheBackendInterface::getMultiple().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getMultiple(&$cids, $allow_invalid = FALSE) {
|
||||
return array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Core\Cache\CacheBackendInterface::set().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function set($cid, $data, $expire = Cache::PERMANENT, array $tags = array()) {}
|
||||
|
||||
|
@ -55,37 +55,37 @@ class NullBackend implements CacheBackendInterface {
|
|||
public function setMultiple(array $items = array()) {}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Core\Cache\CacheBackendInterface::delete().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function delete($cid) {}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Core\Cache\CacheBackendInterface::deleteMultiple().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function deleteMultiple(array $cids) {}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Core\Cache\CacheBackendInterface::deleteAll().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function deleteAll() {}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Core\Cache\CacheBackendInterface::invalidate().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function invalidate($cid) {}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Core\Cache\CacheBackendInterface::invalidateMultiple().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function invalidateMultiple(array $cids) {}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Core\Cache\CacheBackendInterface::invalidateAll().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function invalidateAll() {}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Core\Cache\CacheBackendInterface::garbageCollection().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function garbageCollection() {}
|
||||
|
||||
|
|
80
core/lib/Drupal/Core/Cache/UseCacheBackendTrait.php
Normal file
80
core/lib/Drupal/Core/Cache/UseCacheBackendTrait.php
Normal file
|
@ -0,0 +1,80 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Core\Cache\UseCacheBackendTrait.
|
||||
*/
|
||||
|
||||
namespace Drupal\Core\Cache;
|
||||
|
||||
/**
|
||||
* Provides methods to use a cache backend while respecting a 'use caches' flag.
|
||||
*/
|
||||
trait UseCacheBackendTrait {
|
||||
|
||||
/**
|
||||
* Cache backend instance.
|
||||
*
|
||||
* @var \Drupal\Core\Cache\CacheBackendInterface
|
||||
*/
|
||||
protected $cacheBackend;
|
||||
|
||||
/**
|
||||
* Flag whether caches should be used or skipped.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected $useCaches = TRUE;
|
||||
|
||||
/**
|
||||
* Fetches from the cache backend, respecting the use caches flag.
|
||||
*
|
||||
* @param string $cid
|
||||
* The cache ID of the data to retrieve.
|
||||
*
|
||||
* @return object|false
|
||||
* The cache item or FALSE on failure.
|
||||
*
|
||||
* @see \Drupal\Core\Cache\CacheBackendInterface::get()
|
||||
*/
|
||||
protected function cacheGet($cid) {
|
||||
if ($this->useCaches && $this->cacheBackend) {
|
||||
return $this->cacheBackend->get($cid);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Stores data in the persistent cache, respecting the use caches flag.
|
||||
*
|
||||
* @param string $cid
|
||||
* The cache ID of the data to store.
|
||||
* @param mixed $data
|
||||
* The data to store in the cache.
|
||||
* Some storage engines only allow objects up to a maximum of 1MB in size to
|
||||
* be stored by default. When caching large arrays or similar, take care to
|
||||
* ensure $data does not exceed this size.
|
||||
* @param int $expire
|
||||
* One of the following values:
|
||||
* - CacheBackendInterface::CACHE_PERMANENT: Indicates that the item should
|
||||
* not be removed unless it is deleted explicitly.
|
||||
* - A Unix timestamp: Indicates that the item will be considered invalid
|
||||
* after this time, i.e. it will not be returned by get() unless
|
||||
* $allow_invalid has been set to TRUE. When the item has expired, it may
|
||||
* be permanently deleted by the garbage collector at any time.
|
||||
* @param array $tags
|
||||
* An array of tags to be stored with the cache item. These should normally
|
||||
* identify objects used to build the cache item, which should trigger
|
||||
* cache invalidation when updated. For example if a cached item represents
|
||||
* a node, both the node ID and the author's user ID might be passed in as
|
||||
* tags. For example array('node' => array(123), 'user' => array(92)).
|
||||
*
|
||||
* @see \Drupal\Core\Cache\CacheBackendInterface::set()
|
||||
*/
|
||||
protected function cacheSet($cid, $data, $expire = Cache::PERMANENT, array $tags = []) {
|
||||
if ($this->cacheBackend && $this->useCaches) {
|
||||
$this->cacheBackend->set($cid, $data, $expire, $tags);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Core\Command\DbDumpCommand.
|
||||
* Contains \Drupal\Core\Command\DbImportCommand.
|
||||
*/
|
||||
|
||||
namespace Drupal\Core\Command;
|
||||
|
|
|
@ -31,6 +31,8 @@ class Composer {
|
|||
'fabpot/goutte' => ['Goutte/Tests'],
|
||||
'guzzlehttp/promises' => ['tests'],
|
||||
'guzzlehttp/psr7' => ['tests'],
|
||||
'jcalderonzumba/gastonjs' => ['docs', 'examples', 'tests'],
|
||||
'jcalderonzumba/mink-phantomjs-driver' => ['tests'],
|
||||
'masterminds/html5' => ['test'],
|
||||
'mikey179/vfsStream' => ['src/test'],
|
||||
'phpdocumentor/reflection-docblock' => ['tests'],
|
||||
|
|
|
@ -65,7 +65,7 @@ class ConditionManager extends DefaultPluginManager implements ExecutableManager
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Core\Executable\ExecutableManagerInterface::execute().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function execute(ExecutableInterface $condition) {
|
||||
$result = $condition->evaluate();
|
||||
|
|
|
@ -55,7 +55,7 @@ class CachedStorage implements StorageInterface, StorageCacheInterface {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Core\Config\StorageInterface::exists().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function exists($name) {
|
||||
// The cache would read in the entire data (instead of only checking whether
|
||||
|
@ -65,7 +65,7 @@ class CachedStorage implements StorageInterface, StorageCacheInterface {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Core\Config\StorageInterface::read().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function read($name) {
|
||||
$cache_key = $this->getCacheKey($name);
|
||||
|
@ -123,7 +123,7 @@ class CachedStorage implements StorageInterface, StorageCacheInterface {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Core\Config\StorageInterface::write().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function write($name, array $data) {
|
||||
if ($this->storage->write($name, $data)) {
|
||||
|
@ -137,7 +137,7 @@ class CachedStorage implements StorageInterface, StorageCacheInterface {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Core\Config\StorageInterface::delete().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function delete($name) {
|
||||
// If the cache was the first to be deleted, another process might start
|
||||
|
@ -151,7 +151,7 @@ class CachedStorage implements StorageInterface, StorageCacheInterface {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Core\Config\StorageInterface::rename().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function rename($name, $new_name) {
|
||||
// If the cache was the first to be deleted, another process might start
|
||||
|
@ -166,14 +166,14 @@ class CachedStorage implements StorageInterface, StorageCacheInterface {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Core\Config\StorageInterface::encode().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function encode($data) {
|
||||
return $this->storage->encode($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Core\Config\StorageInterface::decode().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function decode($raw) {
|
||||
return $this->storage->decode($raw);
|
||||
|
@ -215,7 +215,7 @@ class CachedStorage implements StorageInterface, StorageCacheInterface {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Core\Config\StorageInterface::deleteAll().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function deleteAll($prefix = '') {
|
||||
// If the cache was the first to be deleted, another process might start
|
||||
|
|
|
@ -111,25 +111,26 @@ class ConfigFactory implements ConfigFactoryInterface, EventSubscriberInterface
|
|||
}
|
||||
else {
|
||||
// If the configuration object does not exist in the configuration
|
||||
// storage, create a new object and add it to the static cache.
|
||||
$cache_key = $this->getConfigCacheKey($name, $immutable);
|
||||
$this->cache[$cache_key] = $this->createConfigObject($name, $immutable);
|
||||
// storage, create a new object.
|
||||
$config = $this->createConfigObject($name, $immutable);
|
||||
|
||||
if ($immutable) {
|
||||
// Get and apply any overrides.
|
||||
$overrides = $this->loadOverrides(array($name));
|
||||
if (isset($overrides[$name])) {
|
||||
$this->cache[$cache_key]->setModuleOverride($overrides[$name]);
|
||||
$config->setModuleOverride($overrides[$name]);
|
||||
}
|
||||
// Apply any settings.php overrides.
|
||||
if (isset($GLOBALS['config'][$name])) {
|
||||
$this->cache[$cache_key]->setSettingsOverride($GLOBALS['config'][$name]);
|
||||
$config->setSettingsOverride($GLOBALS['config'][$name]);
|
||||
}
|
||||
}
|
||||
|
||||
$this->propagateConfigOverrideCacheability($cache_key, $name);
|
||||
foreach ($this->configFactoryOverrides as $override) {
|
||||
$config->addCacheableDependency($override->getCacheableMetadata($name));
|
||||
}
|
||||
|
||||
return $this->cache[$cache_key];
|
||||
return $config;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -454,10 +454,10 @@ class ConfigImporter {
|
|||
/**
|
||||
* Imports the changelist to the target storage.
|
||||
*
|
||||
* @throws \Drupal\Core\Config\ConfigException
|
||||
*
|
||||
* @return \Drupal\Core\Config\ConfigImporter
|
||||
* The ConfigImporter instance.
|
||||
*
|
||||
* @throws \Drupal\Core\Config\ConfigException
|
||||
*/
|
||||
public function import() {
|
||||
if ($this->hasUnprocessedConfigurationChanges()) {
|
||||
|
@ -828,10 +828,10 @@ class ConfigImporter {
|
|||
* @param string $name
|
||||
* The name of the configuration to process.
|
||||
*
|
||||
* @throws \Drupal\Core\Config\ConfigImporterException
|
||||
*
|
||||
* @return bool
|
||||
* TRUE is to continue processing, FALSE otherwise.
|
||||
*
|
||||
* @throws \Drupal\Core\Config\ConfigImporterException
|
||||
*/
|
||||
protected function checkOp($collection, $op, $name) {
|
||||
if ($op == 'rename') {
|
||||
|
@ -939,13 +939,13 @@ class ConfigImporter {
|
|||
* @param string $name
|
||||
* The name of the configuration to process.
|
||||
*
|
||||
* @throws \Drupal\Core\Entity\EntityStorageException
|
||||
* Thrown if the data is owned by an entity type, but the entity storage
|
||||
* does not support imports.
|
||||
*
|
||||
* @return bool
|
||||
* TRUE if the configuration was imported as a configuration entity. FALSE
|
||||
* otherwise.
|
||||
*
|
||||
* @throws \Drupal\Core\Entity\EntityStorageException
|
||||
* Thrown if the data is owned by an entity type, but the entity storage
|
||||
* does not support imports.
|
||||
*/
|
||||
protected function importInvokeOwner($collection, $op, $name) {
|
||||
// Renames are handled separately.
|
||||
|
@ -989,14 +989,14 @@ class ConfigImporter {
|
|||
* The rename configuration name, as provided by
|
||||
* \Drupal\Core\Config\StorageComparer::createRenameName().
|
||||
*
|
||||
* @throws \Drupal\Core\Entity\EntityStorageException
|
||||
* Thrown if the data is owned by an entity type, but the entity storage
|
||||
* does not support imports.
|
||||
*
|
||||
* @return bool
|
||||
* TRUE if the configuration was imported as a configuration entity. FALSE
|
||||
* otherwise.
|
||||
*
|
||||
* @throws \Drupal\Core\Entity\EntityStorageException
|
||||
* Thrown if the data is owned by an entity type, but the entity storage
|
||||
* does not support imports.
|
||||
*
|
||||
* @see \Drupal\Core\Config\ConfigImporter::createRenameName()
|
||||
*/
|
||||
protected function importInvokeRename($collection, $rename_name) {
|
||||
|
|
|
@ -67,7 +67,7 @@ class DatabaseStorage implements StorageInterface {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Core\Config\StorageInterface::exists().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function exists($name) {
|
||||
try {
|
||||
|
@ -247,7 +247,7 @@ class DatabaseStorage implements StorageInterface {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Core\Config\StorageInterface::encode().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function encode($data) {
|
||||
return serialize($data);
|
||||
|
|
|
@ -111,7 +111,7 @@ abstract class ConfigEntityBase extends Entity implements ConfigEntityInterface
|
|||
protected $trustedData = FALSE;
|
||||
|
||||
/**
|
||||
* Overrides Entity::__construct().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function __construct(array $values, $entity_type) {
|
||||
parent::__construct($values, $entity_type);
|
||||
|
|
|
@ -138,7 +138,7 @@ class ConfigEntityStorage extends EntityStorageBase implements ConfigEntityStora
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Core\Entity\EntityStorageInterface::deleteRevision().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function deleteRevision($revision_id) {
|
||||
return NULL;
|
||||
|
|
|
@ -20,7 +20,7 @@ use Drupal\Core\Entity\Query\QueryException;
|
|||
class Condition extends ConditionBase {
|
||||
|
||||
/**
|
||||
* Implements \Drupal\Core\Entity\Query\ConditionInterface::compile().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function compile($configs) {
|
||||
$and = strtoupper($this->conjunction) == 'AND';
|
||||
|
@ -86,14 +86,14 @@ class Condition extends ConditionBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements \Drupal\Core\Entity\Query\ConditionInterface::exists().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function exists($field, $langcode = NULL) {
|
||||
return $this->condition($field, NULL, 'IS NOT NULL', $langcode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements \Drupal\Core\Entity\Query\ConditionInterface::notExists().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function notExists($field, $langcode = NULL) {
|
||||
return $this->condition($field, NULL, 'IS NULL', $langcode);
|
||||
|
|
|
@ -80,7 +80,7 @@ class Query extends QueryBase implements QueryInterface {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements \Drupal\Core\Entity\Query\QueryInterface::execute().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function execute() {
|
||||
// Load the relevant config records.
|
||||
|
|
|
@ -80,7 +80,7 @@ class FileStorage implements StorageInterface {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Core\Config\StorageInterface::exists().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function exists($name) {
|
||||
return file_exists($this->getFilePath($name));
|
||||
|
@ -146,7 +146,7 @@ class FileStorage implements StorageInterface {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Core\Config\StorageInterface::delete().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function delete($name) {
|
||||
if (!$this->exists($name)) {
|
||||
|
@ -160,7 +160,7 @@ class FileStorage implements StorageInterface {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Core\Config\StorageInterface::rename().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function rename($name, $new_name) {
|
||||
$status = @rename($this->getFilePath($name), $this->getFilePath($new_name));
|
||||
|
@ -171,14 +171,14 @@ class FileStorage implements StorageInterface {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Core\Config\StorageInterface::encode().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function encode($data) {
|
||||
return Yaml::encode($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Core\Config\StorageInterface::decode().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function decode($raw) {
|
||||
$data = Yaml::decode($raw);
|
||||
|
@ -190,7 +190,7 @@ class FileStorage implements StorageInterface {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Core\Config\StorageInterface::listAll().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function listAll($prefix = '') {
|
||||
$dir = $this->getCollectionDirectory();
|
||||
|
@ -216,7 +216,7 @@ class FileStorage implements StorageInterface {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Core\Config\StorageInterface::deleteAll().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function deleteAll($prefix = '') {
|
||||
$success = TRUE;
|
||||
|
|
|
@ -129,7 +129,7 @@ class InstallStorage extends FileStorage {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Core\Config\StorageInterface::listAll().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function listAll($prefix = '') {
|
||||
$names = array_keys($this->getAllFolders());
|
||||
|
|
|
@ -24,70 +24,70 @@ namespace Drupal\Core\Config;
|
|||
class NullStorage implements StorageInterface {
|
||||
|
||||
/**
|
||||
* Implements Drupal\Core\Config\StorageInterface::exists().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function exists($name) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Core\Config\StorageInterface::read().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function read($name) {
|
||||
return array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Core\Config\StorageInterface::readMultiple().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function readMultiple(array $names) {
|
||||
return array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Core\Config\StorageInterface::write().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function write($name, array $data) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Core\Config\StorageInterface::delete().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function delete($name) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Core\Config\StorageInterface::rename().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function rename($name, $new_name) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Core\Config\StorageInterface::encode().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function encode($data) {
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Core\Config\StorageInterface::decode().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function decode($raw) {
|
||||
return $raw;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Core\Config\StorageInterface::listAll().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function listAll($prefix = '') {
|
||||
return array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Core\Config\StorageInterface::deleteAll().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function deleteAll($prefix = '') {
|
||||
return FALSE;
|
||||
|
|
|
@ -115,7 +115,7 @@ abstract class ArrayElement extends Element implements \IteratorAggregate, Typed
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements IteratorAggregate::getIterator();
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getIterator() {
|
||||
return new \ArrayIterator($this->getElements());
|
||||
|
|
|
@ -45,11 +45,11 @@ interface TypedConfigInterface extends TraversableTypedDataInterface {
|
|||
* elements can be get using multiple dot delimited names, for example,
|
||||
* 'page.front'.
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
* If an invalid property name is given.
|
||||
*
|
||||
* @return \Drupal\Core\TypedData\TypedDataInterface
|
||||
* The property object.
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
* If an invalid property name is given.
|
||||
*/
|
||||
public function get($name);
|
||||
|
||||
|
|
|
@ -60,7 +60,6 @@ class TitleResolver implements TitleResolverInterface {
|
|||
if (($raw_parameters = $request->attributes->get('_raw_variables'))) {
|
||||
foreach ($raw_parameters->all() as $key => $value) {
|
||||
$args['@' . $key] = $value;
|
||||
$args['!' . $key] = $value;
|
||||
$args['%' . $key] = $value;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,6 +21,9 @@ use Drupal\Component\Utility\Unicode;
|
|||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* MySQL implementation of \Drupal\Core\Database\Connection.
|
||||
*/
|
||||
class Connection extends DatabaseConnection {
|
||||
|
||||
/**
|
||||
|
@ -33,6 +36,16 @@ class Connection extends DatabaseConnection {
|
|||
*/
|
||||
const UNSUPPORTED_CHARSET = 2019;
|
||||
|
||||
/**
|
||||
* Driver-specific error code for "Unknown character set" error.
|
||||
*/
|
||||
const UNKNOWN_CHARSET = 1115;
|
||||
|
||||
/**
|
||||
* SQLSTATE error code for "Syntax error or access rule violation".
|
||||
*/
|
||||
const SQLSTATE_SYNTAX_ERROR = 42000;
|
||||
|
||||
/**
|
||||
* Flag to indicate if the cleanup function in __destruct() should run.
|
||||
*
|
||||
|
|
|
@ -9,4 +9,7 @@ namespace Drupal\Core\Database\Driver\mysql;
|
|||
|
||||
use Drupal\Core\Database\Query\Delete as QueryDelete;
|
||||
|
||||
/**
|
||||
* MySQL implementation of \Drupal\Core\Database\Query\Delete.
|
||||
*/
|
||||
class Delete extends QueryDelete { }
|
||||
|
|
|
@ -9,6 +9,9 @@ namespace Drupal\Core\Database\Driver\mysql;
|
|||
|
||||
use Drupal\Core\Database\Query\Insert as QueryInsert;
|
||||
|
||||
/**
|
||||
* MySQL implementation of \Drupal\Core\Database\Query\Insert.
|
||||
*/
|
||||
class Insert extends QueryInsert {
|
||||
|
||||
public function execute() {
|
||||
|
|
|
@ -71,7 +71,7 @@ class Tasks extends InstallTasks {
|
|||
}
|
||||
catch (\Exception $e) {
|
||||
// Detect utf8mb4 incompability.
|
||||
if ($e->getCode() == Connection::UNSUPPORTED_CHARSET) {
|
||||
if ($e->getCode() == Connection::UNSUPPORTED_CHARSET || ($e->getCode() == Connection::SQLSTATE_SYNTAX_ERROR && $e->errorInfo[1] == Connection::UNKNOWN_CHARSET)) {
|
||||
$this->fail(t('Your MySQL server and PHP MySQL driver must support utf8mb4 character encoding. Make sure to use a database system that supports this (such as MySQL/MariaDB/Percona 5.5.3 and up), and that the utf8mb4 character set is compiled in. See the <a href=":documentation" target="_blank">MySQL documentation</a> for more information.', array(':documentation' => 'https://dev.mysql.com/doc/refman/5.0/en/cannot-initialize-character-set.html')));
|
||||
$info = Database::getConnectionInfo();
|
||||
$info_copy = $info;
|
||||
|
|
|
@ -9,4 +9,7 @@ namespace Drupal\Core\Database\Driver\mysql;
|
|||
|
||||
use Drupal\Core\Database\Query\Merge as QueryMerge;
|
||||
|
||||
/**
|
||||
* MySQL implementation of \Drupal\Core\Database\Query\Merge.
|
||||
*/
|
||||
class Merge extends QueryMerge { }
|
||||
|
|
|
@ -19,6 +19,9 @@ use Drupal\Component\Utility\Unicode;
|
|||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* MySQL implementation of \Drupal\Core\Database\Schema.
|
||||
*/
|
||||
class Schema extends DatabaseSchema {
|
||||
|
||||
/**
|
||||
|
|
|
@ -9,4 +9,7 @@ namespace Drupal\Core\Database\Driver\mysql;
|
|||
|
||||
use Drupal\Core\Database\Query\Select as QuerySelect;
|
||||
|
||||
/**
|
||||
* MySQL implementation of \Drupal\Core\Database\Query\Select.
|
||||
*/
|
||||
class Select extends QuerySelect { }
|
||||
|
|
|
@ -9,4 +9,7 @@ namespace Drupal\Core\Database\Driver\mysql;
|
|||
|
||||
use Drupal\Core\Database\Transaction as DatabaseTransaction;
|
||||
|
||||
/**
|
||||
* MySQL implementation of \Drupal\Core\Database\Transaction.
|
||||
*/
|
||||
class Transaction extends DatabaseTransaction { }
|
||||
|
|
|
@ -9,4 +9,7 @@ namespace Drupal\Core\Database\Driver\mysql;
|
|||
|
||||
use Drupal\Core\Database\Query\Truncate as QueryTruncate;
|
||||
|
||||
/**
|
||||
* MySQL implementation of \Drupal\Core\Database\Query\Truncate.
|
||||
*/
|
||||
class Truncate extends QueryTruncate { }
|
||||
|
|
|
@ -9,4 +9,7 @@ namespace Drupal\Core\Database\Driver\mysql;
|
|||
|
||||
use Drupal\Core\Database\Query\Update as QueryUpdate;
|
||||
|
||||
/**
|
||||
* MySQL implementation of \Drupal\Core\Database\Query\Update.
|
||||
*/
|
||||
class Update extends QueryUpdate { }
|
||||
|
|
|
@ -10,7 +10,7 @@ namespace Drupal\Core\Database\Driver\mysql;
|
|||
use Drupal\Core\Database\Query\Upsert as QueryUpsert;
|
||||
|
||||
/**
|
||||
* Implements the Upsert query for the MySQL database driver.
|
||||
* MySQL implementation of \Drupal\Core\Database\Query\Upsert.
|
||||
*/
|
||||
class Upsert extends QueryUpsert {
|
||||
|
||||
|
|
|
@ -16,6 +16,9 @@ use Drupal\Core\Database\DatabaseNotFoundException;
|
|||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* PostgreSQL implementation of \Drupal\Core\Database\Connection.
|
||||
*/
|
||||
class Connection extends DatabaseConnection {
|
||||
|
||||
/**
|
||||
|
|
|
@ -9,6 +9,9 @@ namespace Drupal\Core\Database\Driver\pgsql;
|
|||
|
||||
use Drupal\Core\Database\Query\Delete as QueryDelete;
|
||||
|
||||
/**
|
||||
* PostgreSQL implementation of \Drupal\Core\Database\Query\Delete.
|
||||
*/
|
||||
class Delete extends QueryDelete {
|
||||
|
||||
/**
|
||||
|
|
|
@ -15,6 +15,9 @@ use Drupal\Core\Database\Query\Insert as QueryInsert;
|
|||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* PostgreSQL implementation of \Drupal\Core\Database\Query\Insert.
|
||||
*/
|
||||
class Insert extends QueryInsert {
|
||||
|
||||
public function execute() {
|
||||
|
|
|
@ -9,4 +9,7 @@ namespace Drupal\Core\Database\Driver\pgsql;
|
|||
|
||||
use Drupal\Core\Database\Query\Merge as QueryMerge;
|
||||
|
||||
/**
|
||||
* PostgreSQL implementation of \Drupal\Core\Database\Query\Merge.
|
||||
*/
|
||||
class Merge extends QueryMerge { }
|
||||
|
|
|
@ -10,7 +10,7 @@ namespace Drupal\Core\Database\Driver\pgsql;
|
|||
use Drupal\Core\Database\Query\Upsert as QueryUpsert;
|
||||
|
||||
/**
|
||||
* Implements the native Upsert query for the PostgreSQL database driver.
|
||||
* PostgreSQL implementation of native \Drupal\Core\Database\Query\Upsert.
|
||||
*
|
||||
* @see http://www.postgresql.org/docs/9.5/static/sql-insert.html#SQL-ON-CONFLICT
|
||||
*/
|
||||
|
|
|
@ -17,6 +17,9 @@ use Drupal\Core\Database\Schema as DatabaseSchema;
|
|||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* PostgreSQL implementation of \Drupal\Core\Database\Schema.
|
||||
*/
|
||||
class Schema extends DatabaseSchema {
|
||||
|
||||
/**
|
||||
|
|
|
@ -14,6 +14,9 @@ use Drupal\Core\Database\Query\Select as QuerySelect;
|
|||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* PostgreSQL implementation of \Drupal\Core\Database\Query\Select.
|
||||
*/
|
||||
class Select extends QuerySelect {
|
||||
|
||||
public function orderRandom() {
|
||||
|
|
|
@ -9,4 +9,7 @@ namespace Drupal\Core\Database\Driver\pgsql;
|
|||
|
||||
use Drupal\Core\Database\Transaction as DatabaseTransaction;
|
||||
|
||||
/**
|
||||
* PostgreSQL implementation of \Drupal\Core\Database\Transaction.
|
||||
*/
|
||||
class Transaction extends DatabaseTransaction { }
|
||||
|
|
|
@ -9,6 +9,9 @@ namespace Drupal\Core\Database\Driver\pgsql;
|
|||
|
||||
use Drupal\Core\Database\Query\Truncate as QueryTruncate;
|
||||
|
||||
/**
|
||||
* PostgreSQL implementation of \Drupal\Core\Database\Query\Truncate.
|
||||
*/
|
||||
class Truncate extends QueryTruncate {
|
||||
|
||||
/**
|
||||
|
|
|
@ -11,6 +11,9 @@ use Drupal\Core\Database\Database;
|
|||
use Drupal\Core\Database\Query\Update as QueryUpdate;
|
||||
use Drupal\Core\Database\Query\SelectInterface;
|
||||
|
||||
/**
|
||||
* PostgreSQL implementation of \Drupal\Core\Database\Query\Update.
|
||||
*/
|
||||
class Update extends QueryUpdate {
|
||||
|
||||
public function execute() {
|
||||
|
|
|
@ -10,7 +10,7 @@ namespace Drupal\Core\Database\Driver\pgsql;
|
|||
use Drupal\Core\Database\Query\Upsert as QueryUpsert;
|
||||
|
||||
/**
|
||||
* Implements the Upsert query for the PostgreSQL database driver.
|
||||
* PostgreSQL implementation of \Drupal\Core\Database\Query\Upsert.
|
||||
*/
|
||||
class Upsert extends QueryUpsert {
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ use Drupal\Core\Database\DatabaseNotFoundException;
|
|||
use Drupal\Core\Database\Connection as DatabaseConnection;
|
||||
|
||||
/**
|
||||
* Specific SQLite implementation of DatabaseConnection.
|
||||
* SQLite implementation of \Drupal\Core\Database\Connection.
|
||||
*/
|
||||
class Connection extends DatabaseConnection {
|
||||
|
||||
|
|
|
@ -10,6 +10,6 @@ namespace Drupal\Core\Database\Driver\sqlite;
|
|||
use Drupal\Core\Database\Query\Delete as QueryDelete;
|
||||
|
||||
/**
|
||||
* SQLite specific implementation of \Drupal\Core\Database\Query\Delete.
|
||||
* SQLite implementation of \Drupal\Core\Database\Query\Delete.
|
||||
*/
|
||||
class Delete extends QueryDelete { }
|
||||
|
|
|
@ -10,7 +10,7 @@ namespace Drupal\Core\Database\Driver\sqlite;
|
|||
use Drupal\Core\Database\Query\Insert as QueryInsert;
|
||||
|
||||
/**
|
||||
* SQLite specific implementation of InsertQuery.
|
||||
* SQLite implementation of \Drupal\Core\Database\Query\Insert.
|
||||
*
|
||||
* We ignore all the default fields and use the clever SQLite syntax:
|
||||
* INSERT INTO table DEFAULT VALUES
|
||||
|
|
|
@ -9,4 +9,7 @@ namespace Drupal\Core\Database\Driver\sqlite;
|
|||
|
||||
use Drupal\Core\Database\Query\Merge as QueryMerge;
|
||||
|
||||
/**
|
||||
* SQLite implementation of \Drupal\Core\Database\Query\Merge.
|
||||
*/
|
||||
class Merge extends QueryMerge { }
|
||||
|
|
|
@ -17,6 +17,9 @@ use Drupal\Core\Database\Schema as DatabaseSchema;
|
|||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* SQLite implementation of \Drupal\Core\Database\Schema.
|
||||
*/
|
||||
class Schema extends DatabaseSchema {
|
||||
|
||||
/**
|
||||
|
|
|
@ -9,6 +9,9 @@ namespace Drupal\Core\Database\Driver\sqlite;
|
|||
|
||||
use Drupal\Core\Database\Query\Select as QuerySelect;
|
||||
|
||||
/**
|
||||
* SQLite implementation of \Drupal\Core\Database\Query\Select.
|
||||
*/
|
||||
class Select extends QuerySelect {
|
||||
public function forUpdate($set = TRUE) {
|
||||
// SQLite does not support FOR UPDATE so nothing to do.
|
||||
|
|
|
@ -11,7 +11,7 @@ use Drupal\Core\Database\StatementPrefetch;
|
|||
use Drupal\Core\Database\StatementInterface;
|
||||
|
||||
/**
|
||||
* Specific SQLite implementation of DatabaseConnection.
|
||||
* SQLite implementation of \Drupal\Core\Database\Statement.
|
||||
*
|
||||
* The PDO SQLite driver only closes SELECT statements when the PDOStatement
|
||||
* destructor is called and SQLite does not allow data change (INSERT,
|
||||
|
|
|
@ -9,4 +9,7 @@ namespace Drupal\Core\Database\Driver\sqlite;
|
|||
|
||||
use Drupal\Core\Database\Transaction as DatabaseTransaction;
|
||||
|
||||
/**
|
||||
* SQLite implementation of \Drupal\Core\Database\Transaction.
|
||||
*/
|
||||
class Transaction extends DatabaseTransaction { }
|
||||
|
|
|
@ -10,7 +10,7 @@ namespace Drupal\Core\Database\Driver\sqlite;
|
|||
use Drupal\Core\Database\Query\Truncate as QueryTruncate;
|
||||
|
||||
/**
|
||||
* SQLite specific implementation of TruncateQuery.
|
||||
* SQLite implementation of \Drupal\Core\Database\Query\Truncate.
|
||||
*
|
||||
* SQLite doesn't support TRUNCATE, but a DELETE query with no condition has
|
||||
* exactly the effect (it is implemented by DROPing the table).
|
||||
|
|
|
@ -9,4 +9,7 @@ namespace Drupal\Core\Database\Driver\sqlite;
|
|||
|
||||
use Drupal\Core\Database\Query\Update as QueryUpdate;
|
||||
|
||||
/**
|
||||
* SQLite implementation of \Drupal\Core\Database\Query\Update.
|
||||
*/
|
||||
class Update extends QueryUpdate { }
|
||||
|
|
|
@ -10,7 +10,7 @@ namespace Drupal\Core\Database\Driver\sqlite;
|
|||
use Drupal\Core\Database\Query\Upsert as QueryUpsert;
|
||||
|
||||
/**
|
||||
* Implements the Upsert query for the SQLite database driver.
|
||||
* SQLite implementation of \Drupal\Core\Database\Query\Upsert.
|
||||
*/
|
||||
class Upsert extends QueryUpsert {
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@ class Condition implements ConditionInterface, \Countable {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Core\Database\Query\ConditionInterface::condition().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function condition($field, $value = NULL, $operator = '=') {
|
||||
if (empty($operator)) {
|
||||
|
@ -88,7 +88,7 @@ class Condition implements ConditionInterface, \Countable {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Core\Database\Query\ConditionInterface::where().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function where($snippet, $args = array()) {
|
||||
$this->conditions[] = array(
|
||||
|
@ -102,42 +102,42 @@ class Condition implements ConditionInterface, \Countable {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Core\Database\Query\ConditionInterface::isNull().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function isNull($field) {
|
||||
return $this->condition($field, NULL, 'IS NULL');
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Core\Database\Query\ConditionInterface::isNotNull().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function isNotNull($field) {
|
||||
return $this->condition($field, NULL, 'IS NOT NULL');
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Core\Database\Query\ConditionInterface::exists().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function exists(SelectInterface $select) {
|
||||
return $this->condition('', $select, 'EXISTS');
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Core\Database\Query\ConditionInterface::notExists().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function notExists(SelectInterface $select) {
|
||||
return $this->condition('', $select, 'NOT EXISTS');
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Core\Database\Query\ConditionInterface::conditions().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function &conditions() {
|
||||
return $this->conditions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Core\Database\Query\ConditionInterface::arguments().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function arguments() {
|
||||
// If the caller forgot to call compile() first, refuse to run.
|
||||
|
@ -148,7 +148,7 @@ class Condition implements ConditionInterface, \Countable {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Core\Database\Query\ConditionInterface::compile().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function compile(Connection $connection, PlaceholderInterface $queryPlaceholder) {
|
||||
// Re-compile if this condition changed or if we are compiled against a
|
||||
|
@ -247,7 +247,7 @@ class Condition implements ConditionInterface, \Countable {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Core\Database\Query\ConditionInterface::compiled().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function compiled() {
|
||||
return !$this->changed;
|
||||
|
|
|
@ -47,8 +47,8 @@ class Delete extends Query implements ConditionInterface {
|
|||
/**
|
||||
* Executes the DELETE query.
|
||||
*
|
||||
* @return
|
||||
* The return value is dependent on the database connection.
|
||||
* @return int
|
||||
* The number of rows affected by the delete query.
|
||||
*/
|
||||
public function execute() {
|
||||
$values = array();
|
||||
|
|
|
@ -26,7 +26,7 @@ trait QueryConditionTrait {
|
|||
protected $condition;
|
||||
|
||||
/**
|
||||
* Implements Drupal\Core\Database\Query\ConditionInterface::condition().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function condition($field, $value = NULL, $operator = '=') {
|
||||
$this->condition->condition($field, $value, $operator);
|
||||
|
@ -34,7 +34,7 @@ trait QueryConditionTrait {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Core\Database\Query\ConditionInterface::isNull().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function isNull($field) {
|
||||
$this->condition->isNull($field);
|
||||
|
@ -42,7 +42,7 @@ trait QueryConditionTrait {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Core\Database\Query\ConditionInterface::isNotNull().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function isNotNull($field) {
|
||||
$this->condition->isNotNull($field);
|
||||
|
@ -50,7 +50,7 @@ trait QueryConditionTrait {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Core\Database\Query\ConditionInterface::exists().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function exists(SelectInterface $select) {
|
||||
$this->condition->exists($select);
|
||||
|
@ -58,7 +58,7 @@ trait QueryConditionTrait {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Core\Database\Query\ConditionInterface::notExists().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function notExists(SelectInterface $select) {
|
||||
$this->condition->notExists($select);
|
||||
|
@ -66,21 +66,21 @@ trait QueryConditionTrait {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Core\Database\Query\ConditionInterface::conditions().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function &conditions() {
|
||||
return $this->condition->conditions();
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Core\Database\Query\ConditionInterface::arguments().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function arguments() {
|
||||
return $this->condition->arguments();
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Core\Database\Query\ConditionInterface::where().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function where($snippet, $args = array()) {
|
||||
$this->condition->where($snippet, $args);
|
||||
|
@ -88,35 +88,35 @@ trait QueryConditionTrait {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Core\Database\Query\ConditionInterface::compile().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function compile(Connection $connection, PlaceholderInterface $queryPlaceholder) {
|
||||
$this->condition->compile($connection, $queryPlaceholder);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Core\Database\Query\ConditionInterface::compiled().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function compiled() {
|
||||
return $this->condition->compiled();
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Core\Database\Query\ConditionInterface::conditionGroupFactory().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function conditionGroupFactory($conjunction = 'AND') {
|
||||
return new Condition($conjunction);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Core\Database\Query\ConditionInterface::andConditionGroup().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function andConditionGroup() {
|
||||
return $this->conditionGroupFactory('AND');
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Core\Database\Query\ConditionInterface::orConditionGroup().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function orConditionGroup() {
|
||||
return $this->conditionGroupFactory('OR');
|
||||
|
|
|
@ -40,14 +40,14 @@ class Truncate extends Query {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Core\Database\Query\ConditionInterface::compile().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function compile(Connection $connection, PlaceholderInterface $queryPlaceholder) {
|
||||
return $this->condition->compile($connection, $queryPlaceholder);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements Drupal\Core\Database\Query\ConditionInterface::compiled().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function compiled() {
|
||||
return $this->condition->compiled();
|
||||
|
|
|
@ -56,14 +56,14 @@ abstract class Schema implements PlaceholderInterface {
|
|||
}
|
||||
|
||||
/**
|
||||
* Implements PlaceHolderInterface::uniqueIdentifier().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function uniqueIdentifier() {
|
||||
return $this->uniqueIdentifier;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements PlaceHolderInterface::nextPlaceholder().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function nextPlaceholder() {
|
||||
return $this->placeholder++;
|
||||
|
|
|
@ -16,7 +16,7 @@ use Drupal\Core\StringTranslation\StringTranslationTrait;
|
|||
use Symfony\Component\HttpFoundation\RequestStack;
|
||||
|
||||
/**
|
||||
* Provides a service to handler various date related functionality.
|
||||
* Provides a service to handle various date related functionality.
|
||||
*
|
||||
* @ingroup i18n
|
||||
*/
|
||||
|
|
|
@ -440,7 +440,7 @@ class DateHelper {
|
|||
* Identifies the number of days in a month for a date.
|
||||
*
|
||||
* @param mixed $date
|
||||
* (optional) A date object, timestamp, or a date string.
|
||||
* (optional) A DrupalDateTime object or a date string.
|
||||
* Defaults to NULL, which means to use the current date.
|
||||
*
|
||||
* @return int
|
||||
|
@ -460,7 +460,7 @@ class DateHelper {
|
|||
* Identifies the number of days in a year for a date.
|
||||
*
|
||||
* @param mixed $date
|
||||
* (optional) A date object, timestamp, or a date string.
|
||||
* (optional) A DrupalDateTime object or a date string.
|
||||
* Defaults to NULL, which means to use the current date.
|
||||
*
|
||||
* @return int
|
||||
|
@ -485,7 +485,7 @@ class DateHelper {
|
|||
* Returns day of week for a given date (0 = Sunday).
|
||||
*
|
||||
* @param mixed $date
|
||||
* (optional) A date object, timestamp, or a date string.
|
||||
* (optional) A DrupalDateTime object or a date string.
|
||||
* Defaults to NULL, which means use the current date.
|
||||
*
|
||||
* @return int
|
||||
|
@ -505,7 +505,7 @@ class DateHelper {
|
|||
* Returns translated name of the day of week for a given date.
|
||||
*
|
||||
* @param mixed $date
|
||||
* (optional) A date object, timestamp, or a date string.
|
||||
* (optional) A DrupalDateTime object or a date string.
|
||||
* Defaults to NULL, which means use the current date.
|
||||
* @param string $abbr
|
||||
* (optional) Whether to return the abbreviated name for that day.
|
||||
|
|
|
@ -36,8 +36,7 @@ class DrupalDateTime extends DateTimePlus {
|
|||
* Constructs a date object.
|
||||
*
|
||||
* @param string $time
|
||||
* A DateTime object, a date/input_time_adjusted string, a unix timestamp.
|
||||
* Defaults to 'now'.
|
||||
* A date/input_time_adjusted string. Defaults to 'now'.
|
||||
* @param mixed $timezone
|
||||
* PHP DateTimeZone object, string or NULL allowed.
|
||||
* Defaults to NULL.
|
||||
|
|
|
@ -20,12 +20,12 @@ interface ClassResolverInterface {
|
|||
* @param string $definition
|
||||
* A class name or service name.
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
* If $class is not a valid service identifier and the class does not exist.
|
||||
*
|
||||
* @return object
|
||||
* The instance of the class.
|
||||
*/
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
* If $class is not a valid service identifier and the class does not exist.
|
||||
*/
|
||||
public function getInstanceFromDefinition($definition);
|
||||
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
|
|||
class RegisterServicesForDestructionPass implements CompilerPassInterface {
|
||||
|
||||
/**
|
||||
* Implements \Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface::process().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function process(ContainerBuilder $container) {
|
||||
if (!$container->hasDefinition('kernel_destruct_subscriber')) {
|
||||
|
|
|
@ -821,6 +821,13 @@ class DrupalKernel implements DrupalKernelInterface, TerminableInterface {
|
|||
// If there is no container and no cached container definition, build a new
|
||||
// one from scratch.
|
||||
if (!isset($container) && !isset($container_definition)) {
|
||||
if (version_compare(phpversion(), '7.0.0-dev') >= 0) {
|
||||
// The service graph implementation is prone to corruption during GC.
|
||||
// Collect cycles now then disable the GC for the time of the compiler
|
||||
// run.
|
||||
// @see https://bugs.php.net/bug.php?id=70805
|
||||
gc_collect_cycles();
|
||||
}
|
||||
$container = $this->compileContainer();
|
||||
|
||||
// Only dump the container if dumping is allowed. This is useful for
|
||||
|
@ -1386,7 +1393,7 @@ class DrupalKernel implements DrupalKernelInterface, TerminableInterface {
|
|||
* The request object
|
||||
*
|
||||
* @return bool
|
||||
* TRUE if the hostmame is valid, or FALSE otherwise.
|
||||
* TRUE if the hostname is valid, or FALSE otherwise.
|
||||
*/
|
||||
public static function validateHostname(Request $request) {
|
||||
// $request->getHost() can throw an UnexpectedValueException if it
|
||||
|
@ -1412,7 +1419,7 @@ class DrupalKernel implements DrupalKernelInterface, TerminableInterface {
|
|||
* is possible to create an attack vectors against a site by overriding this.
|
||||
* Symfony provides a mechanism for creating a list of trusted Host values.
|
||||
*
|
||||
* Host patterns (as regular expressions) can be configured throught
|
||||
* Host patterns (as regular expressions) can be configured through
|
||||
* settings.php for multisite installations, sites using ServerAlias without
|
||||
* canonical redirection, or configurations where the site responds to default
|
||||
* requests. For example,
|
||||
|
|
|
@ -166,7 +166,7 @@ abstract class ContentEntityBase extends Entity implements \IteratorAggregate, C
|
|||
protected $validationRequired = FALSE;
|
||||
|
||||
/**
|
||||
* Overrides Entity::__construct().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function __construct(array $values, $entity_type, $bundle = FALSE, $translations = array()) {
|
||||
$this->entityTypeId = $entity_type;
|
||||
|
@ -998,7 +998,7 @@ abstract class ContentEntityBase extends Entity implements \IteratorAggregate, C
|
|||
}
|
||||
|
||||
/**
|
||||
* Overrides Entity::createDuplicate().
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function createDuplicate() {
|
||||
if ($this->translations[$this->activeLangcode]['status'] == static::TRANSLATION_REMOVED) {
|
||||
|
|
|
@ -91,11 +91,11 @@ class EntityRouteEnhancer implements RouteEnhancerInterface {
|
|||
* @param \Symfony\Component\HttpFoundation\Request $request
|
||||
* The Request instance.
|
||||
*
|
||||
* @throws \RuntimeException
|
||||
* Thrown when an entity of a type cannot be found in a route.
|
||||
*
|
||||
* @return array
|
||||
* The modified defaults.
|
||||
*
|
||||
* @throws \RuntimeException
|
||||
* Thrown when an entity of a type cannot be found in a route.
|
||||
*/
|
||||
protected function enhanceEntityView(array $defaults, Request $request) {
|
||||
$defaults['_controller'] = '\Drupal\Core\Entity\Controller\EntityViewController::view';
|
||||
|
|
|
@ -159,7 +159,7 @@ abstract class Entity implements EntityInterface {
|
|||
*/
|
||||
public function urlInfo($rel = 'canonical', array $options = []) {
|
||||
if ($this->id() === NULL) {
|
||||
throw new EntityMalformedException(sprintf('The "%s" entity cannot have a URI as it does have an ID', $this->getEntityTypeId()));
|
||||
throw new EntityMalformedException(sprintf('The "%s" entity cannot have a URI as it does not have an ID', $this->getEntityTypeId()));
|
||||
}
|
||||
|
||||
// The links array might contain URI templates set in annotations.
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Reference in a new issue