diff options
Diffstat (limited to 'includes')
-rw-r--r-- | includes/bootstrap.inc | 2 | ||||
-rw-r--r-- | includes/common.inc | 12 |
2 files changed, 11 insertions, 3 deletions
diff --git a/includes/bootstrap.inc b/includes/bootstrap.inc index b572cde92..5eaa05e5f 100644 --- a/includes/bootstrap.inc +++ b/includes/bootstrap.inc @@ -8,7 +8,7 @@ /** * The current system version. */ -define('VERSION', '7.37'); +define('VERSION', '7.38'); /** * Core API compatibility. diff --git a/includes/common.inc b/includes/common.inc index cd3014553..ceac115a5 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -6329,13 +6329,21 @@ function drupal_render_cid_parts($granularity = NULL) { } if (!empty($granularity)) { + $cache_per_role = $granularity & DRUPAL_CACHE_PER_ROLE; + $cache_per_user = $granularity & DRUPAL_CACHE_PER_USER; + // User 1 has special permissions outside of the role system, so when + // caching per role is requested, it should cache per user instead. + if ($user->uid == 1 && $cache_per_role) { + $cache_per_user = TRUE; + $cache_per_role = FALSE; + } // 'PER_ROLE' and 'PER_USER' are mutually exclusive. 'PER_USER' can be a // resource drag for sites with many users, so when a module is being // equivocal, we favor the less expensive 'PER_ROLE' pattern. - if ($granularity & DRUPAL_CACHE_PER_ROLE) { + if ($cache_per_role) { $cid_parts[] = 'r.' . implode(',', array_keys($user->roles)); } - elseif ($granularity & DRUPAL_CACHE_PER_USER) { + elseif ($cache_per_user) { $cid_parts[] = "u.$user->uid"; } |