Commit 400baf16 authored by catch's avatar catch

Issue #2464427 by jibran, Wim Leers, Berdir, borisson_: Replace...

Issue #2464427 by jibran, Wim Leers, Berdir, borisson_: Replace CacheablePluginInterface with CacheableDependencyInterface
parent 07662ec6
......@@ -143,7 +143,7 @@ display:
- 'languages:language_interface'
- url.query_args
- user.permissions
cacheable: false
max-age: 0
feed_1:
display_plugin: feed
id: feed_1
......@@ -401,7 +401,7 @@ display:
- 'languages:language_content'
- 'languages:language_interface'
- user.permissions
cacheable: false
max-age: 0
page_1:
display_plugin: page
id: page_1
......@@ -423,4 +423,4 @@ display:
- 'languages:language_interface'
- url.query_args
- user.permissions
cacheable: false
max-age: 0
......@@ -468,7 +468,8 @@ display:
- url
- url.query_args
- user.permissions
cacheable: false
max-age: 0
tags: { }
page_1:
display_plugin: page
id: page_1
......@@ -492,4 +493,5 @@ display:
- url
- url.query_args
- user.permissions
cacheable: false
max-age: 0
tags: { }
......@@ -3,6 +3,7 @@ status: true
dependencies:
module:
- comment
- node
- user
id: comments_recent
label: 'Recent comments'
......@@ -241,7 +242,8 @@ display:
- 'languages:language_content'
- 'languages:language_interface'
- user.permissions
cacheable: false
max-age: -1
tags: { }
block_1:
display_plugin: block
id: block_1
......@@ -258,4 +260,5 @@ display:
- 'languages:language_content'
- 'languages:language_interface'
- user.permissions
cacheable: false
max-age: -1
tags: { }
......@@ -200,4 +200,4 @@ display:
contexts:
- languages
- user
cacheable: false
max-age: 0
......@@ -133,7 +133,7 @@ display:
contexts:
- 'languages:language_content'
- 'languages:language_interface'
cacheable: false
max-age: 0
page_1:
display_plugin: page
id: page_1
......@@ -146,4 +146,4 @@ display:
contexts:
- 'languages:language_content'
- 'languages:language_interface'
cacheable: false
max-age: 0
......@@ -117,4 +117,4 @@ display:
contexts:
- languages
- 'languages:language_interface'
cacheable: false
max-age: 0
......@@ -118,4 +118,4 @@ display:
- entity_test_view_grants
- languages
- 'languages:language_interface'
cacheable: false
max-age: 0
......@@ -127,4 +127,4 @@ display:
- entity_test_view_grants
- languages
- 'languages:language_interface'
cacheable: false
max-age: 0
......@@ -126,4 +126,4 @@ display:
contexts:
- languages
- 'languages:language_interface'
cacheable: false
max-age: 0
......@@ -723,7 +723,8 @@ display:
- url
- url.query_args
- user.permissions
cacheable: false
max-age: 0
tags: { }
page_1:
display_plugin: page
id: page_1
......@@ -759,7 +760,8 @@ display:
- url
- url.query_args
- user.permissions
cacheable: false
max-age: 0
tags: { }
page_2:
display_plugin: page
id: page_2
......@@ -1115,4 +1117,5 @@ display:
- url
- url.query_args
- user.permissions
cacheable: false
max-age: 0
tags: { }
......@@ -102,9 +102,9 @@ public function adminSummary() {
/**
* {@inheritdoc}
*/
public function isCacheable() {
public function getCacheMaxAge() {
// This filter depends on the current time and therefore is never cacheable.
return FALSE;
return 0;
}
}
langcode: en
status: false
dependencies:
config:
- core.entity_view_mode.node.teaser
module:
- node
- user
id: archive
label: Archive
module: node
......@@ -174,7 +177,8 @@ display:
- url.query_args
- 'user.node_grants:view'
- user.permissions
cacheable: false
max-age: -1
tags: { }
block_1:
id: block_1
display_title: Block
......@@ -212,7 +216,8 @@ display:
- url.query_args
- 'user.node_grants:view'
- user.permissions
cacheable: false
max-age: -1
tags: { }
page_1:
id: page_1
display_title: Page
......@@ -231,4 +236,5 @@ display:
- url.query_args
- 'user.node_grants:view'
- user.permissions
cacheable: false
max-age: -1
tags: { }
......@@ -568,7 +568,8 @@ display:
- user
- 'user.node_grants:view'
- user.permissions
cacheable: false
max-age: 0
tags: { }
page_1:
display_options:
path: admin/content/node
......@@ -599,4 +600,5 @@ display:
- user
- 'user.node_grants:view'
- user.permissions
cacheable: false
max-age: 0
tags: { }
......@@ -296,7 +296,8 @@ display:
- user
- 'user.node_grants:view'
- user.permissions
cacheable: false
max-age: 0
tags: { }
block_1:
display_plugin: block
id: block_1
......@@ -311,4 +312,5 @@ display:
- user
- 'user.node_grants:view'
- user.permissions
cacheable: false
max-age: 0
tags: { }
langcode: en
status: true
dependencies:
config:
- core.entity_view_mode.node.rss
- core.entity_view_mode.node.teaser
module:
- node
- user
......@@ -244,7 +247,8 @@ display:
- url.query_args
- 'user.node_grants:view'
- user.permissions
cacheable: false
max-age: -1
tags: { }
feed_1:
display_plugin: feed
id: feed_1
......@@ -278,7 +282,8 @@ display:
- 'languages:language_interface'
- 'user.node_grants:view'
- user.permissions
cacheable: false
max-age: -1
tags: { }
page_1:
display_options:
path: node
......@@ -293,4 +298,5 @@ display:
- url.query_args
- 'user.node_grants:view'
- user.permissions
cacheable: false
max-age: -1
tags: { }
......@@ -355,7 +355,8 @@ display:
- url.query_args
- 'user.node_grants:view'
- user.permissions
cacheable: false
max-age: 0
tags: { }
attachment_1:
id: attachment_1
display_title: Attachment
......@@ -422,7 +423,8 @@ display:
- url.query_args
- 'user.node_grants:view'
- user.permissions
cacheable: false
max-age: 0
tags: { }
page_1:
id: page_1
display_title: Page
......@@ -448,4 +450,5 @@ display:
- url.query_args
- 'user.node_grants:view'
- user.permissions
cacheable: false
max-age: 0
tags: { }
......@@ -7,8 +7,9 @@
namespace Drupal\node\Plugin\views\argument_default;
use Drupal\Core\Cache\Cache;
use Drupal\Core\Cache\CacheableDependencyInterface;
use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\views\Plugin\CacheablePluginInterface;
use Drupal\views\Plugin\views\argument_default\ArgumentDefaultPluginBase;
use Drupal\node\NodeInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
......@@ -23,7 +24,7 @@
* title = @Translation("Content ID from URL")
* )
*/
class Node extends ArgumentDefaultPluginBase implements CacheablePluginInterface {
class Node extends ArgumentDefaultPluginBase implements CacheableDependencyInterface {
/**
* The route match.
......@@ -75,8 +76,8 @@ public function getArgument() {
/**
* {@inheritdoc}
*/
public function isCacheable() {
return TRUE;
public function getCacheMaxAge() {
return Cache::PERMANENT;
}
/**
......
......@@ -7,8 +7,9 @@
namespace Drupal\rest\Plugin\views\style;
use Drupal\Core\Cache\Cache;
use Drupal\Core\Cache\CacheableDependencyInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\views\Plugin\CacheablePluginInterface;
use Drupal\views\ViewExecutable;
use Drupal\views\Plugin\views\display\DisplayPluginBase;
use Drupal\views\Plugin\views\style\StylePluginBase;
......@@ -27,7 +28,7 @@
* display_types = {"data"}
* )
*/
class Serializer extends StylePluginBase implements CacheablePluginInterface {
class Serializer extends StylePluginBase implements CacheableDependencyInterface {
/**
* Overrides \Drupal\views\Plugin\views\style\StylePluginBase::$usesRowPlugin.
......@@ -155,8 +156,8 @@ public function getFormats() {
/**
* {@inheritdoc}
*/
public function isCacheable() {
return TRUE;
public function getCacheMaxAge() {
return Cache::PERMANENT;
}
/**
......@@ -166,4 +167,11 @@ public function getCacheContexts() {
return ['request_format'];
}
/**
* {@inheritdoc}
*/
public function getCacheTags() {
return [];
}
}
......@@ -7,6 +7,7 @@
namespace Drupal\system\Plugin\views\field;
use Drupal\Core\Cache\CacheableDependencyInterface;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\EntityManagerInterface;
use Drupal\Core\Entity\RevisionableInterface;
......@@ -15,7 +16,6 @@
use Drupal\Core\Routing\RedirectDestinationTrait;
use Drupal\Core\TypedData\TranslatableInterface;
use Drupal\views\Entity\Render\EntityTranslationRenderTrait;
use Drupal\views\Plugin\CacheablePluginInterface;
use Drupal\views\Plugin\views\display\DisplayPluginBase;
use Drupal\views\Plugin\views\field\FieldPluginBase;
use Drupal\views\Plugin\views\field\UncacheableFieldHandlerTrait;
......@@ -29,7 +29,7 @@
*
* @ViewsField("bulk_form")
*/
class BulkForm extends FieldPluginBase implements CacheablePluginInterface {
class BulkForm extends FieldPluginBase implements CacheableDependencyInterface {
use RedirectDestinationTrait;
use UncacheableFieldHandlerTrait;
......@@ -114,10 +114,10 @@ public function init(ViewExecutable $view, DisplayPluginBase $display, array &$o
/**
* {@inheritdoc}
*/
public function isCacheable() {
public function getCacheMaxAge() {
// @todo Consider making the bulk operation form cacheable. See
// https://www.drupal.org/node/2503009.
return FALSE;
return 0;
}
/**
......@@ -127,6 +127,13 @@ public function getCacheContexts() {
return $this->languageManager->isMultilingual() ? $this->getEntityTranslationRenderer()->getCacheContexts() : [];
}
/**
* {@inheritdoc}
*/
public function getCacheTags() {
return [];
}
/**
* {@inheritdoc}
*/
......
......@@ -59,6 +59,7 @@ public function testPostUpdate() {
$this->assertIdentical($updates, \Drupal::state()->get('post_update_test_execution', []));
$key_value = \Drupal::keyValue('post_update');
array_unshift($updates, 'views_post_update_update_cacheability_metadata');
array_unshift($updates, 'block_post_update_disable_blocks_with_missing_contexts');
$this->assertEqual($updates, $key_value->get('existing_updates'));
......
......@@ -249,7 +249,8 @@ display:
- url.query_args
- 'user.node_grants:view'
- user.permissions
cacheable: false
max-age: -1
tags: { }
feed_1:
id: feed_1
display_title: Feed
......@@ -286,7 +287,8 @@ display:
- url
- 'user.node_grants:view'
- user.permissions
cacheable: false
max-age: -1
tags: { }
page_1:
id: page_1
display_title: Page
......@@ -305,4 +307,5 @@ display:
- url.query_args
- 'user.node_grants:view'
- user.permissions
cacheable: false
max-age: -1
tags: { }
......@@ -7,10 +7,11 @@
namespace Drupal\taxonomy\Plugin\views\argument_default;
use Drupal\Core\Cache\Cache;
use Drupal\Core\Cache\CacheableDependencyInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\taxonomy\TermInterface;
use Drupal\views\Plugin\CacheablePluginInterface;
use Drupal\views\ViewExecutable;
use Drupal\views\Plugin\views\display\DisplayPluginBase;
use Drupal\views\Plugin\views\argument_default\ArgumentDefaultPluginBase;
......@@ -28,7 +29,7 @@
* title = @Translation("Taxonomy term ID from URL")
* )
*/
class Tid extends ArgumentDefaultPluginBase implements CacheablePluginInterface {
class Tid extends ArgumentDefaultPluginBase implements CacheableDependencyInterface {
/**
* The route match.
......@@ -216,8 +217,8 @@ public function getArgument() {
/**
* {@inheritdoc}
*/
public function isCacheable() {
return TRUE;
public function getCacheMaxAge() {
return Cache::PERMANENT;
}
/**
......
......@@ -165,7 +165,7 @@ display:
- url.query_args
- 'user.node_grants:view'
- user.permissions
cacheable: false
max-age: 0
page_1:
display_plugin: page
id: page_1
......@@ -255,4 +255,4 @@ display:
- url.query_args
- 'user.node_grants:view'
- user.permissions
cacheable: false
max-age: 0
......@@ -199,4 +199,4 @@ display:
contexts:
- 'languages:language_content'
- 'languages:language_interface'
cacheable: false
max-age: 0
......@@ -875,7 +875,8 @@ display:
- url
- url.query_args
- user.permissions
cacheable: false
max-age: 0
tags: { }
page_1:
display_plugin: page
id: page_1
......@@ -907,4 +908,5 @@ display:
- url
- url.query_args
- user.permissions
cacheable: false
max-age: 0
tags: { }
......@@ -169,7 +169,8 @@ display:
- 'languages:language_content'
- 'languages:language_interface'
- user.permissions
cacheable: false
max-age: -1
tags: { }
block_1:
display_plugin: block
id: block_1
......@@ -185,4 +186,5 @@ display:
- 'languages:language_content'
- 'languages:language_interface'
- user.permissions
cacheable: false
max-age: -1
tags: { }
......@@ -199,7 +199,8 @@ display:
- 'languages:language_content'
- 'languages:language_interface'
- user.permissions
cacheable: false
max-age: -1
tags: { }
who_s_online_block:
display_plugin: block
id: who_s_online_block
......@@ -214,4 +215,5 @@ display:
- 'languages:language_content'
- 'languages:language_interface'
- user.permissions
cacheable: false
max-age: -1
tags: { }
......@@ -7,11 +7,12 @@
namespace Drupal\user\Plugin\views\access;
use Drupal\Core\Cache\Cache;
use Drupal\Core\Cache\CacheableDependencyInterface;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Session\AccountInterface;
use Drupal\user\PermissionHandlerInterface;
use Drupal\views\Plugin\CacheablePluginInterface;
use Drupal\views\Plugin\views\access\AccessPluginBase;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\Routing\Route;
......@@ -27,7 +28,7 @@
* help = @Translation("Access will be granted to users with the specified permission string.")
* )
*/
class Permission extends AccessPluginBase implements CacheablePluginInterface {
class Permission extends AccessPluginBase implements CacheableDependencyInterface {
/**
* Overrides Drupal\views\Plugin\Plugin::$usesOptions.
......@@ -135,8 +136,8 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) {
/**
* {@inheritdoc}
*/
public function isCacheable() {
return TRUE;
public function getCacheMaxAge() {
return Cache::PERMANENT;
}
/**
......@@ -146,4 +147,11 @@ public function getCacheContexts() {
return ['user.permissions'];
}
/**
* {@inheritdoc}
*/
public function getCacheTags() {
return [];
}
}
......@@ -8,9 +8,10 @@
namespace Drupal\user\Plugin\views\access;
use Drupal\Component\Utility\SafeMarkup;
use Drupal\Core\Cache\Cache;
use Drupal\Core\Cache\CacheableDependencyInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\user\RoleStorageInterface;
use Drupal\views\Plugin\CacheablePluginInterface;
use Drupal\views\Plugin\views\access\AccessPluginBase;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\Routing\Route;
......@@ -27,7 +28,7 @@
* help = @Translation("Access will be granted to users with any of the specified roles.")
* )
*/
class Role extends AccessPluginBase implements CacheablePluginInterface {
class Role extends AccessPluginBase implements CacheableDependencyInterface {
/**
* Overrides Drupal\views\Plugin\Plugin::$usesOptions.
......@@ -149,8 +150,8 @@ public function calculateDependencies() {
/**
* {@inheritdoc}
*/
public function isCacheable() {
return TRUE;
public function getCacheMaxAge() {
return Cache::PERMANENT;
}
/**
......@@ -160,5 +161,12 @@ public function getCacheContexts() {
return ['user.roles'];
}
/**
* {@inheritdoc}
*/
public function getCacheTags() {
return [];
}
}
......@@ -7,7 +7,8 @@
namespace Drupal\user\Plugin\views\argument_default;
use Drupal\views\Plugin\CacheablePluginInterface;
use Drupal\Core\Cache\Cache;
use Drupal\Core\Cache\CacheableDependencyInterface;
use Drupal\views\Plugin\views\argument_default\ArgumentDefaultPluginBase;
/**
......@@ -20,7 +21,7 @@
* title = @Translation("User ID from logged in user")
* )
*/
class CurrentUser extends ArgumentDefaultPluginBase implements CacheablePluginInterface {
class CurrentUser extends ArgumentDefaultPluginBase implements CacheableDependencyInterface {
public function getArgument() {
return \Drupal::currentUser()->id();
......@@ -29,8 +30,8 @@ public function getArgument() {
/**
* {@inheritdoc}
*/
public function isCacheable() {
return TRUE;
public function getCacheMaxAge() {
return Cache::PERMANENT;
}
/**
......
......@@ -7,9 +7,10 @@
namespace Drupal\user\Plugin\views\argument_default;
use Drupal\Core\Cache\Cache;
use Drupal\Core\Cache\CacheableDependencyInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\views\Plugin\CacheablePluginInterface;
use Drupal\views\Plugin\views\argument_default\ArgumentDefaultPluginBase;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\Request;
......@@ -24,7 +25,7 @@
* title = @Translation("User ID from route context")
* )
*/
class User extends ArgumentDefaultPluginBase implements CacheablePluginInterface {
class User extends ArgumentDefaultPluginBase implements CacheableDependencyInterface {
/**
* The route match.
......@@ -108,8 +109,8 @@ public function getArgument() {
/**
* {@inheritdoc}
*/
public function isCacheable() {
return TRUE;
public function getCacheMaxAge() {
return Cache::PERMANENT;
}
/**