Commit 2fad47da authored by webchick's avatar webchick
Browse files

#619666 follow-up by effulgentsia: Fixed hunk in user_access().

parent 8d07e3b2
......@@ -679,10 +679,6 @@ function user_role_permissions($roles = array()) {
*/
function user_access($string, $account = NULL) {
global $user;
// Use the advanced drupal_static() pattern, since this is called very often.
static $drupal_static = array();
isset($drupal_static[__FUNCTION__]) || ($drupal_static[__FUNCTION__] = &drupal_static(__FUNCTION__));
$perm = &$drupal_static[__FUNCTION__];
if (!isset($account)) {
$account = $user;
......@@ -695,6 +691,10 @@ function user_access($string, $account = NULL) {
// To reduce the number of SQL queries, we cache the user's permissions
// in a static variable.
// Use the advanced drupal_static() pattern, since this is called very often.
static $drupal_static = array();
isset($drupal_static[__FUNCTION__]) || ($drupal_static[__FUNCTION__] = &drupal_static(__FUNCTION__));
$perm = &$drupal_static[__FUNCTION__];
if (!isset($perm[$account->uid])) {
$role_permissions = user_role_permissions($account->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