From 22835842a7d622abedb05a06cde09ce0912cbf2a Mon Sep 17 00:00:00 2001 From: Alex Pott Date: Wed, 6 Aug 2014 09:36:12 +0100 Subject: [PATCH] Issue #2312657 by olli: Remove _toolbar_clear_user_cache(). --- core/modules/toolbar/toolbar.module | 45 +---------------------------- 1 file changed, 1 insertion(+), 44 deletions(-) diff --git a/core/modules/toolbar/toolbar.module b/core/modules/toolbar/toolbar.module index d27a89e1c2c..e07e8f91823 100644 --- a/core/modules/toolbar/toolbar.module +++ b/core/modules/toolbar/toolbar.module @@ -525,39 +525,11 @@ function _toolbar_get_subtrees_hash($langcode) { // caches later, based on the user's ID regardless of language. // Clear the cache when the 'locale' tag is deleted. This ensures a fresh // subtrees rendering when string translations are made. - \Drupal::cache('toolbar')->set($cid, $hash, Cache::PERMANENT, array('user' => array($uid), 'locale' => TRUE, 'menu' => 'admin')); + \Drupal::cache('toolbar')->set($cid, $hash, Cache::PERMANENT, array('user' => array($uid), 'locale' => TRUE, 'menu' => 'admin', 'user_roles' => TRUE)); } return $hash; } -/** - * Implements hook_modules_installed(). - */ -function toolbar_modules_installed($modules) { - _toolbar_clear_user_cache(); -} - -/** - * Implements hook_modules_uninstalled(). - */ -function toolbar_modules_uninstalled($modules) { - _toolbar_clear_user_cache(); -} - -/** - * Implements hook_ENTITY_TYPE_update() for user entities. - */ -function toolbar_user_update(UserInterface $user) { - _toolbar_clear_user_cache($user->id()); -} - -/** - * Implements hook_ENTITY_TYPE_update() for user_role entities. - */ -function toolbar_user_role_update(RoleInterface $role) { - _toolbar_clear_user_cache(); -} - /** * Returns a cache ID from the user and language IDs. * @@ -573,18 +545,3 @@ function _toolbar_get_user_cid($uid, $langcode) { return 'toolbar_' . $uid . ':' . $langcode; } -/** - * Clears the Toolbar user cache. - * - * @param int $uid - * (optional) The user ID whose toolbar cache entry to clear. - */ -function _toolbar_clear_user_cache($uid = NULL) { - // Clear by the 'user' tag in order to delete all caches, in any language, - // associated with this user. - if (isset($uid)) { - Cache::deleteTags(array('user' => array($uid))); - } else { - \Drupal::cache('toolbar')->deleteAll(); - } -}