diff options
author | Angie Byron <webchick@24967.no-reply.drupal.org> | 2009-11-20 06:12:45 +0000 |
---|---|---|
committer | Angie Byron <webchick@24967.no-reply.drupal.org> | 2009-11-20 06:12:45 +0000 |
commit | b14349889e9e51fb44934694030e95306918e3bd (patch) | |
tree | 68836bca71b2ebb1c5d17b0b20dee9b0aba113ab /modules/user/user.module | |
parent | 56e35716bca7569ec796ca5829f7921319abdc51 (diff) | |
download | brdo-b14349889e9e51fb44934694030e95306918e3bd.tar.gz brdo-b14349889e9e51fb44934694030e95306918e3bd.tar.bz2 |
#619666 by effulgentsia, casey, and catch: Changed Introduce new pattern for drupal_static() in performance-critical functions.
Diffstat (limited to 'modules/user/user.module')
-rw-r--r-- | modules/user/user.module | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/modules/user/user.module b/modules/user/user.module index 2772b5ffb..a244ea887 100644 --- a/modules/user/user.module +++ b/modules/user/user.module @@ -679,7 +679,10 @@ function user_role_permissions($roles = array()) { */ function user_access($string, $account = NULL) { global $user; - $perm = &drupal_static(__FUNCTION__, array()); + // 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; |