diff options
author | ben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-10-06 10:21:53 +0000 |
---|---|---|
committer | ben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-10-06 10:21:53 +0000 |
commit | 8662654b40694c2e5e91414a8537beabdf4b470f (patch) | |
tree | 5ba1669d9e087635f00662f755d21e1921d7a5d9 /engine/lib/access.php | |
parent | ad2ff6b698d46694f5e07eb0bee1b1a4687ec528 (diff) | |
download | elgg-8662654b40694c2e5e91414a8537beabdf4b470f.tar.gz elgg-8662654b40694c2e5e91414a8537beabdf4b470f.tar.bz2 |
A massive speed increase for access permissions. :)
git-svn-id: https://code.elgg.org/elgg/trunk@2184 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib/access.php')
-rw-r--r-- | engine/lib/access.php | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/engine/lib/access.php b/engine/lib/access.php index f6fefe3bf..f52d839de 100644 --- a/engine/lib/access.php +++ b/engine/lib/access.php @@ -24,15 +24,18 @@ function get_access_list($user_id = 0, $site_id = 0, $flush = false) {
global $CONFIG, $init_finished;
+ static $access_list;
if (!isset($access_list) || !$init_finished)
$access_list = array();
-
+
if ($user_id == 0) $user_id = $_SESSION['id'];
if (($site_id == 0) && (isset($CONFIG->site_id))) $site_id = $CONFIG->site_id;
$user_id = (int) $user_id;
$site_id = (int) $site_id;
+ if (isset($access_list[$user_id])) return $access_list[$user_id];
+
$access_list[$user_id] = "(" . implode(",",get_access_array($user_id, $site_id, $flush)) . ")";
return $access_list[$user_id];
@@ -54,7 +57,7 @@ if (!isset($access_array) || !$init_finished)
$access_array = array();
-
+
if ($user_id == 0) $user_id = $_SESSION['guid'];
if (($site_id == 0) && (isset($CONFIG->site_guid))) $site_id = $CONFIG->site_guid;
|