MDL-15748 get_user_access_sitewide() - reduce looking for perms in any context below category level.
Dramatic speed-up in sites with zillions of contexts and overrides. Credit goes to Samuli Karevaara.
This commit is contained in:
+2
-2
@@ -1252,9 +1252,9 @@ function get_user_access_sitewide($userid) {
|
||||
JOIN {$CFG->prefix}role_capabilities rco
|
||||
ON (rco.roleid=ra.roleid AND rco.contextid=sctx.id)
|
||||
WHERE ra.userid = $userid
|
||||
AND sctx.contextlevel <= ".CONTEXT_COURSE."
|
||||
AND ctx.contextlevel <= ".CONTEXT_COURSECAT."
|
||||
AND sctx.contextlevel <= ".CONTEXT_COURSE."
|
||||
ORDER BY sctx.depth, sctx.path, ra.roleid";
|
||||
|
||||
$rs = get_recordset_sql($sql);
|
||||
if ($rs) {
|
||||
while ($rd = rs_fetch_next_record($rs)) {
|
||||
|
||||
Reference in New Issue
Block a user