From: stronk7 Date: Fri, 20 Mar 2009 12:10:47 +0000 (+0000) Subject: MDL-15748 get_user_access_sitewide() - reduce looking for perms in any context below... X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=004865e20dd155fb5352e2f07f32e54bb759de3a;p=moodle.git 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. Merged from 19_STABLE --- diff --git a/lib/accesslib.php b/lib/accesslib.php index 121811b007..6e5ccc7bd2 100755 --- a/lib/accesslib.php +++ b/lib/accesslib.php @@ -1314,7 +1314,8 @@ function get_user_access_sitewide($userid) { JOIN {role_capabilities} rco ON (rco.roleid=ra.roleid AND rco.contextid=sctx.id) WHERE ra.userid = ? - AND sctx.contextlevel <= ".CONTEXT_COURSE." + AND ctx.contextlevel <= ".CONTEXT_COURSECAT." + AND sctx.contextlevel <= ".CONTEXT_COURSE." ORDER BY sctx.depth, sctx.path, ra.roleid"; $params = array($userid); $rs = $DB->get_recordset_sql($sql, $params);