Skip to content
Snippets Groups Projects
Commit 18b92564 authored by daffie's avatar daffie
Browse files

Issue #3506118 by daffie: Update the CacheTagsChecksumTrait to work with Redis

parent c523d857
Branches
Tags
1 merge request!40Update the CacheTagsChecksumTrait to work with Redis
Pipeline #422182 failed
...@@ -203,7 +203,7 @@ index 46f9fb97c0d6359da0cbd84279ba4bdd92b77523..fbc1d8dda75fbd8df70a779b60ab3103 ...@@ -203,7 +203,7 @@ index 46f9fb97c0d6359da0cbd84279ba4bdd92b77523..fbc1d8dda75fbd8df70a779b60ab3103
} }
diff --git a/core/lib/Drupal/Core/Cache/CacheTagsChecksumTrait.php b/core/lib/Drupal/Core/Cache/CacheTagsChecksumTrait.php diff --git a/core/lib/Drupal/Core/Cache/CacheTagsChecksumTrait.php b/core/lib/Drupal/Core/Cache/CacheTagsChecksumTrait.php
index 00bf806c3dee1df743646160e9f5110fdb3034b4..8893c3e25981d8378c26dab25fd14292ae80feeb 100644 index 00bf806c3dee1df743646160e9f5110fdb3034b4..9eb5b0471e67fa197ce2a0acf968c4ad688ee060 100644
--- a/core/lib/Drupal/Core/Cache/CacheTagsChecksumTrait.php --- a/core/lib/Drupal/Core/Cache/CacheTagsChecksumTrait.php
+++ b/core/lib/Drupal/Core/Cache/CacheTagsChecksumTrait.php +++ b/core/lib/Drupal/Core/Cache/CacheTagsChecksumTrait.php
@@ -32,6 +32,15 @@ trait CacheTagsChecksumTrait { @@ -32,6 +32,15 @@ trait CacheTagsChecksumTrait {
...@@ -226,7 +226,7 @@ index 00bf806c3dee1df743646160e9f5110fdb3034b4..8893c3e25981d8378c26dab25fd14292 ...@@ -226,7 +226,7 @@ index 00bf806c3dee1df743646160e9f5110fdb3034b4..8893c3e25981d8378c26dab25fd14292
* Implements \Drupal\Core\Cache\CacheTagsInvalidatorInterface::invalidateTags() * Implements \Drupal\Core\Cache\CacheTagsInvalidatorInterface::invalidateTags()
*/ */
public function invalidateTags(array $tags) { public function invalidateTags(array $tags) {
+ if (($this->connection->driver() == 'mongodb') && !$this->tableExists) { + if (isset($this->connection) && ($this->connection->driver() == 'mongodb') && !$this->tableExists) {
+ // For MongoDB the table needs to exist. Otherwise MongoDB creates one + // For MongoDB the table needs to exist. Otherwise MongoDB creates one
+ // without the correct validation. + // without the correct validation.
+ $this->tableExists = $this->ensureTableExists(); + $this->tableExists = $this->ensureTableExists();
...@@ -240,7 +240,7 @@ index 00bf806c3dee1df743646160e9f5110fdb3034b4..8893c3e25981d8378c26dab25fd14292 ...@@ -240,7 +240,7 @@ index 00bf806c3dee1df743646160e9f5110fdb3034b4..8893c3e25981d8378c26dab25fd14292
* Implements \Drupal\Core\Cache\CacheTagsChecksumInterface::getCurrentChecksum() * Implements \Drupal\Core\Cache\CacheTagsChecksumInterface::getCurrentChecksum()
*/ */
public function getCurrentChecksum(array $tags) { public function getCurrentChecksum(array $tags) {
+ if (($this->connection->driver() == 'mongodb') && !$this->tableExists) { + if (isset($this->connection) && ($this->connection->driver() == 'mongodb') && !$this->tableExists) {
+ // For MongoDB the table needs to exist. Otherwise MongoDB creates one + // For MongoDB the table needs to exist. Otherwise MongoDB creates one
+ // without the correct validation. + // without the correct validation.
+ $this->tableExists = $this->ensureTableExists(); + $this->tableExists = $this->ensureTableExists();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment