Commit e54454a3 authored by catch's avatar catch

Issue #2572667 by claudiu.cristea: Deleting a role doesn't invalidate user_roles() static cache

parent a436fe46
......@@ -1051,17 +1051,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]);
......@@ -1073,10 +1062,6 @@ function user_roles($membersonly = FALSE, $permission = NULL) {
});
}
if (empty($permission)) {
$user_roles[$cid] = $roles;
}
return $roles;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment