From cc18654ce9ac7fc20b7d2d997a837bfc787bc846 Mon Sep 17 00:00:00 2001 From: stronk7 Date: Fri, 20 Mar 2009 12:01:38 +0000 Subject: [PATCH] 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. --- lib/accesslib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/accesslib.php b/lib/accesslib.php index 525e79e16ce..18d0faa3c4b 100755 --- a/lib/accesslib.php +++ b/lib/accesslib.php @@ -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)) {