Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mahara
mahara
Commits
4423c1e9
Commit
4423c1e9
authored
Aug 21, 2008
by
Nigel McNie
Browse files
Implement result caching in group_user_access.
parent
9c95720a
Changes
1
Hide whitespace changes
Inline
Side-by-side
htdocs/lib/group.php
View file @
4423c1e9
...
...
@@ -40,7 +40,7 @@ defined('INTERNAL') || die();
* have no role in the group
*/
function
group_user_access
(
$groupid
,
$userid
=
null
)
{
// TODO: caching
static
$result
;
$groupid
=
(
int
)
$groupid
;
...
...
@@ -60,7 +60,11 @@ function group_user_access($groupid, $userid=null) {
throw
new
InvalidArgumentException
(
"group_user_access: user argument should be an integer"
);
}
return
get_field
(
'group_member'
,
'role'
,
'group'
,
$groupid
,
'member'
,
$userid
);
if
(
isset
(
$result
[
$groupid
][
$userid
]))
{
return
$result
[
$groupid
][
$userid
];
}
return
$result
[
$groupid
][
$userid
]
=
get_field
(
'group_member'
,
'role'
,
'group'
,
$groupid
,
'member'
,
$userid
);
}
/**
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment