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
4df43e48
Verified
Commit
4df43e48
authored
Jan 20, 2023
by
Dave Long
Browse files
Issue
#3335145
by catch, Berdir: Unnecessary workflow plugin manager cache tag
parent
86bced91
Changes
3
Hide whitespace changes
Inline
Side-by-side
core/modules/workflows/src/WorkflowAccessControlHandler.php
View file @
4df43e48
...
...
@@ -76,8 +76,7 @@ protected function checkCreateAccess(AccountInterface $account, array $context,
// Allow access if there is at least one workflow type. Since workflow types
// are provided by modules this is cacheable until extensions change.
return
$admin_access
->
andIf
(
AccessResult
::
allowedIf
(
$workflow_types_count
>
0
))
->
addCacheTags
([
'workflow_type_plugins'
]);
->
andIf
(
AccessResult
::
allowedIf
(
$workflow_types_count
>
0
));
}
}
core/modules/workflows/src/WorkflowTypeManager.php
View file @
4df43e48
...
...
@@ -30,7 +30,7 @@ class WorkflowTypeManager extends DefaultPluginManager {
public
function
__construct
(
\
Traversable
$namespaces
,
CacheBackendInterface
$cache_backend
,
ModuleHandlerInterface
$module_handler
)
{
parent
::
__construct
(
'Plugin/WorkflowType'
,
$namespaces
,
$module_handler
,
WorkflowTypeInterface
::
class
,
WorkflowType
::
class
);
$this
->
alterInfo
(
'workflow_type_info'
);
$this
->
setCacheBackend
(
$cache_backend
,
'workflow_type_info'
,
[
'workflow_type_plugins'
]
);
$this
->
setCacheBackend
(
$cache_backend
,
'workflow_type_info'
);
}
}
core/modules/workflows/tests/src/Kernel/WorkflowAccessControlHandlerTest.php
View file @
4df43e48
...
...
@@ -75,14 +75,12 @@ public function testCheckCreateAccess() {
$this
->
assertEquals
(
AccessResult
::
neutral
()
->
addCacheContexts
([
'user.permissions'
])
->
setReason
(
"The 'administer workflows' permission is required."
)
->
addCacheTags
([
'workflow_type_plugins'
]),
->
setReason
(
"The 'administer workflows' permission is required."
),
$this
->
accessControlHandler
->
createAccess
(
NULL
,
$this
->
user
,
[],
TRUE
)
);
$this
->
assertEquals
(
AccessResult
::
allowed
()
->
addCacheContexts
([
'user.permissions'
])
->
addCacheTags
([
'workflow_type_plugins'
]),
->
addCacheContexts
([
'user.permissions'
]),
$this
->
accessControlHandler
->
createAccess
(
NULL
,
$this
->
adminUser
,
[],
TRUE
)
);
...
...
@@ -92,8 +90,7 @@ public function testCheckCreateAccess() {
$this
->
accessControlHandler
->
resetCache
();
$this
->
assertEquals
(
AccessResult
::
neutral
()
->
addCacheContexts
([
'user.permissions'
])
->
addCacheTags
([
'workflow_type_plugins'
]),
->
addCacheContexts
([
'user.permissions'
]),
$this
->
accessControlHandler
->
createAccess
(
NULL
,
$this
->
adminUser
,
[],
TRUE
)
);
}
...
...
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