summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Pott2015-07-24 16:54:24 +0100
committerAlex Pott2015-07-24 16:54:24 +0100
commit58a6dbb8a4db115a2ab1ca7304553f3ffb8962ec (patch)
tree71beb447be89a79c36f8b3e4e1060a3b66c97d6e
parentfb15cca9cac3c53f574f793ab697fa821e8d0866 (diff)
Issue #2525884 by jesperjb, joshi.rohit100, Berdir: Avoid unecessary cache tag invalidations in ConfigEntityBase and aggregator Item entity
-rw-r--r--core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php2
-rw-r--r--core/modules/aggregator/src/Entity/Item.php4
-rw-r--r--core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityBaseUnitTest.php4
3 files changed, 3 insertions, 7 deletions
diff --git a/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php b/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php
index ea2c22c..db08412 100644
--- a/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php
+++ b/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php
@@ -192,8 +192,6 @@ abstract class ConfigEntityBase extends Entity implements ConfigEntityInterface
* {@inheritdoc}
*/
public function disable() {
- // An entity was disabled, invalidate its own cache tag.
- Cache::invalidateTags($this->getCacheTagsToInvalidate());
return $this->setStatus(FALSE);
}
diff --git a/core/modules/aggregator/src/Entity/Item.php b/core/modules/aggregator/src/Entity/Item.php
index 725f647..92c3b79 100644
--- a/core/modules/aggregator/src/Entity/Item.php
+++ b/core/modules/aggregator/src/Entity/Item.php
@@ -225,7 +225,9 @@ class Item extends ContentEntityBase implements ItemInterface {
// handles the regular cases. The Item entity has one special case: a newly
// created Item is *also* associated with a Feed, so we must invalidate the
// associated Feed's cache tag.
- Cache::invalidateTags($this->getCacheTagsToInvalidate());
+ if (!$update) {
+ Cache::invalidateTags($this->getCacheTagsToInvalidate());
+ }
}
/**
diff --git a/core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityBaseUnitTest.php b/core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityBaseUnitTest.php
index ba91710..fa1c006 100644
--- a/core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityBaseUnitTest.php
+++ b/core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityBaseUnitTest.php
@@ -376,10 +376,6 @@ class ConfigEntityBaseUnitTest extends UnitTestCase {
* @depends testSetStatus
*/
public function testDisable() {
- $this->cacheTagsInvalidator->expects($this->once())
- ->method('invalidateTags')
- ->with(array('config:test_provider.' . $this->entityTypeId . '.' . $this->id));
-
$this->entity->setStatus(TRUE);
$this->assertSame($this->entity, $this->entity->disable());
$this->assertFalse($this->entity->status());