diff --git a/core/lib/Drupal/Core/Cache/DatabaseBackend.php b/core/lib/Drupal/Core/Cache/DatabaseBackend.php index 4a9db05fe1888de2bef8f1e454e9a081769af74f..74d1292c01de7988fe3f0fa9d968c303b3cb0ffa 100644 --- a/core/lib/Drupal/Core/Cache/DatabaseBackend.php +++ b/core/lib/Drupal/Core/Cache/DatabaseBackend.php @@ -209,7 +209,12 @@ public function deleteMultiple(array $cids) { while (count($cids)); } catch (\Exception $e) { - $this->catchException($e); + // Create the cache table, which will be empty. This fixes cases during + // core install where a cache table is cleared before it is set + // with {cache_block} and {cache_menu}. + if (!$this->ensureBinExists()) { + $this->catchException($e); + } } } @@ -241,7 +246,12 @@ public function deleteAll() { $this->connection->truncate($this->bin)->execute(); } catch (\Exception $e) { - $this->catchException($e); + // Create the cache table, which will be empty. This fixes cases during + // core install where a cache table is cleared before it is set + // with {cache_block} and {cache_menu}. + if (!$this->ensureBinExists()) { + $this->catchException($e); + } } }