Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
809854e0
Commit
809854e0
authored
Mar 10, 2015
by
Alex Pott
Browse files
Issue
#2449069
by Berdir: Remove default block_plugin cache tags, because they're useless
parent
1506a99f
Changes
6
Hide whitespace changes
Inline
Side-by-side
core/lib/Drupal/Core/Block/BlockBase.php
View file @
809854e0
...
...
@@ -370,10 +370,7 @@ public function getCacheContexts() {
* {@inheritdoc}
*/
public
function
getCacheTags
()
{
// If a block plugin's output changes, then it must be able to invalidate a
// cache tag that affects all instances of this block: across themes and
// across regions.
return
array
(
'block_plugin:'
.
str_replace
(
':'
,
'__'
,
$this
->
getPluginID
()));
return
[];
}
/**
...
...
core/modules/aggregator/src/Tests/AggregatorRenderingTest.php
View file @
809854e0
...
...
@@ -58,7 +58,6 @@ public function testBlockLinks() {
$this
->
assert
(
isset
(
$links
[
0
]),
format_string
(
'Link to href %href found.'
,
array
(
'%href'
=>
$href
)));
$cache_tags_header
=
$this
->
drupalGetHeader
(
'X-Drupal-Cache-Tags'
);
$cache_tags
=
explode
(
' '
,
$cache_tags_header
);
$this
->
assertTrue
(
in_array
(
'block_plugin:aggregator_feed_block'
,
$cache_tags
));
$this
->
assertTrue
(
in_array
(
'aggregator_feed:'
.
$feed
->
id
(),
$cache_tags
));
// Visit that page.
...
...
core/modules/block/src/Tests/BlockTest.php
View file @
809854e0
...
...
@@ -330,7 +330,6 @@ public function testBlockCacheTags() {
'config:block_list'
,
'block_view'
,
'config:block.block.powered'
,
'block_plugin:system_powered_by_block'
,
'rendered'
,
);
sort
(
$expected_cache_tags
);
...
...
@@ -339,7 +338,6 @@ public function testBlockCacheTags() {
$expected_cache_tags
=
array
(
'block_view'
,
'config:block.block.powered'
,
'block_plugin:system_powered_by_block'
,
'rendered'
,
);
sort
(
$expected_cache_tags
);
...
...
@@ -371,7 +369,6 @@ public function testBlockCacheTags() {
'block_view'
,
'config:block.block.powered'
,
'config:block.block.powered-2'
,
'block_plugin:system_powered_by_block'
,
'rendered'
,
);
sort
(
$expected_cache_tags
);
...
...
@@ -379,7 +376,6 @@ public function testBlockCacheTags() {
$expected_cache_tags
=
array
(
'block_view'
,
'config:block.block.powered'
,
'block_plugin:system_powered_by_block'
,
'rendered'
,
);
sort
(
$expected_cache_tags
);
...
...
@@ -388,19 +384,12 @@ public function testBlockCacheTags() {
$expected_cache_tags
=
array
(
'block_view'
,
'config:block.block.powered-2'
,
'block_plugin:system_powered_by_block'
,
'rendered'
,
);
sort
(
$expected_cache_tags
);
$cache_entry
=
\
Drupal
::
cache
(
'render'
)
->
get
(
'entity_view:block:powered-2:en:classy'
);
$this
->
assertIdentical
(
$cache_entry
->
tags
,
$expected_cache_tags
);
// The plugin providing the "Powered by Drupal" block is modified; verify a
// cache miss.
Cache
::
invalidateTags
(
array
(
'block_plugin:system_powered_by_block'
));
$this
->
drupalGet
(
'<front>'
);
$this
->
assertEqual
(
$this
->
drupalGetHeader
(
'X-Drupal-Cache'
),
'MISS'
);
// Now we should have a cache hit again.
$this
->
drupalGet
(
'<front>'
);
$this
->
assertEqual
(
$this
->
drupalGetHeader
(
'X-Drupal-Cache'
),
'HIT'
);
...
...
core/modules/block/src/Tests/BlockViewBuilderTest.php
View file @
809854e0
...
...
@@ -215,7 +215,7 @@ public function testBlockViewBuilderAlter() {
$request
->
setMethod
(
'GET'
);
$default_keys
=
array
(
'entity_view'
,
'block'
,
'test_block'
);
$default_tags
=
array
(
'block_view'
,
'config:block.block.test_block'
,
'block_plugin:test_cache'
);
$default_tags
=
array
(
'block_view'
,
'config:block.block.test_block'
);
// Advanced: cached block, but an alter hook adds an additional cache key.
$this
->
setBlockCacheConfig
(
array
(
...
...
core/modules/menu_ui/src/Tests/MenuCacheTagsTest.php
View file @
809854e0
...
...
@@ -53,7 +53,6 @@ public function testMenuBlock() {
'block_view'
,
'config:block_list'
,
'config:block.block.'
.
$block
->
id
(),
'block_plugin:system_menu_block__llama'
,
'config:system.menu.llama'
,
);
$this
->
verifyPageCache
(
$url
,
'HIT'
,
$expected_tags
);
...
...
core/modules/system/src/Tests/Cache/PageCacheTagsIntegrationTest.php
View file @
809854e0
...
...
@@ -94,14 +94,6 @@ function testPageCacheTags() {
'config:block.block.bartik_powered'
,
'config:block.block.bartik_main_menu'
,
'config:block.block.bartik_account_menu'
,
'block_plugin:system_breadcrumb_block'
,
'block_plugin:system_main_block'
,
'block_plugin:system_menu_block__account'
,
'block_plugin:system_menu_block__main'
,
'block_plugin:system_menu_block__tools'
,
'block_plugin:user_login_block'
,
'block_plugin:system_menu_block__footer'
,
'block_plugin:system_powered_by_block'
,
'node_view'
,
'node:'
.
$node_1
->
id
(),
'user:'
.
$author_1
->
id
(),
...
...
@@ -127,15 +119,6 @@ function testPageCacheTags() {
'config:block.block.bartik_powered'
,
'config:block.block.bartik_main_menu'
,
'config:block.block.bartik_account_menu'
,
'block_plugin:system_breadcrumb_block'
,
'block_plugin:system_main_block'
,
'block_plugin:system_menu_block__account'
,
'block_plugin:system_menu_block__main'
,
'block_plugin:system_menu_block__tools'
,
'block_plugin:user_login_block'
,
'block_plugin:views_block__comments_recent-block_1'
,
'block_plugin:system_menu_block__footer'
,
'block_plugin:system_powered_by_block'
,
'node_view'
,
'node:'
.
$node_2
->
id
(),
'user:'
.
$author_2
->
id
(),
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment