diff --git a/core/modules/user/src/RoleStorage.php b/core/modules/user/src/RoleStorage.php index 09bb9f8..a7f7c6a 100644 --- a/core/modules/user/src/RoleStorage.php +++ b/core/modules/user/src/RoleStorage.php @@ -30,26 +30,4 @@ public function isPermissionInRoles($permission, array $rids) { return $has_permission; } - /** - * {@inheritdoc} - */ - public function resetCache(array $ids = NULL) { - parent::resetCache($ids); - - // Clear all static cache. - if ($ids === NULL) { - drupal_static_reset('user_roles'); - } - // Selective clear the static cache. - elseif ($ids && $user_roles = &drupal_static('user_roles')) { - // Remove the entire cache cid, if at least one role has to be cleared. - // The cache cid can be either RoleInterface::ANONYMOUS_ID, either - // RoleInterface::AUTHENTICATED_ID. - // @see user_roles() - $user_roles = array_filter($user_roles, function (array $roles) use ($ids) { - return !array_intersect(array_keys($roles), $ids); - }); - } - } - } diff --git a/core/modules/user/user.module b/core/modules/user/user.module index 73b9413..d025656 100644 --- a/core/modules/user/user.module +++ b/core/modules/user/user.module @@ -1050,17 +1050,6 @@ function user_user_role_delete(RoleInterface $role) { * value. */ function user_roles($membersonly = FALSE, $permission = NULL) { - $user_roles = &drupal_static(__FUNCTION__); - - // Do not cache roles for specific permissions. This data is not requested - // frequently enough to justify the additional memory use. - if (empty($permission)) { - $cid = $membersonly ? RoleInterface::AUTHENTICATED_ID : RoleInterface::ANONYMOUS_ID; - if (isset($user_roles[$cid])) { - return $user_roles[$cid]; - } - } - $roles = Role::loadMultiple(); if ($membersonly) { unset($roles[RoleInterface::ANONYMOUS_ID]); @@ -1072,10 +1061,6 @@ function user_roles($membersonly = FALSE, $permission = NULL) { }); } - if (empty($permission)) { - $user_roles[$cid] = $roles; - } - return $roles; }