Skip to content
Permalink
Browse files

MDL-38596 coursecatlib performance

Version bump for cache definitions and added user delete check to sql
  • Loading branch information...
damyon committed May 7, 2013
1 parent fc07589 commit ef4d3233b675c47868ab3c8495ea448e28559bac
Showing with 4 additions and 3 deletions.
  1. +3 −2 lib/coursecatlib.php
  2. +1 −1 version.php
@@ -711,16 +711,17 @@ public static function preload_course_contacts(&$courses) {
list($sql1, $params1) = $DB->get_in_or_equal(array_keys($allcontexts), SQL_PARAMS_NAMED, 'ctxid');
list($sql2, $params2) = $DB->get_in_or_equal($managerroles, SQL_PARAMS_NAMED, 'rid');
list($sort, $sortparams) = users_order_by_sql('u');
$notdeleted = array('notdeleted'=>0);
$sql = "SELECT ra.contextid, ra.id AS raid,
r.id AS roleid, r.name AS rolename, r.shortname AS roleshortname,
rn.name AS rolecoursealias, u.id, u.username, u.firstname, u.lastname
FROM {role_assignments} ra
JOIN {user} u ON ra.userid = u.id
JOIN {role} r ON ra.roleid = r.id
LEFT JOIN {role_names} rn ON (rn.contextid = ra.contextid AND rn.roleid = r.id)
WHERE ra.contextid ". $sql1." AND ra.roleid ". $sql2."
WHERE ra.contextid ". $sql1." AND ra.roleid ". $sql2." AND u.deleted = :notdeleted
ORDER BY r.sortorder, $sort";
$rs = $DB->get_recordset_sql($sql, $params1 + $params2 + $sortparams);
$rs = $DB->get_recordset_sql($sql, $params1 + $params2 + $notdeleted + $sortparams);
$checkenrolments = array();
foreach($rs as $ra) {
foreach ($allcontexts[$ra->contextid] as $id) {
@@ -29,7 +29,7 @@
defined('MOODLE_INTERNAL') || die();
$version = 2013050600.01; // YYYYMMDD = weekly release date of this DEV branch
$version = 2013050700.00; // YYYYMMDD = weekly release date of this DEV branch
// RR = release increments - 00 in DEV branches
// .XX = incremental changes

0 comments on commit ef4d323

Please sign in to comment.
You can’t perform that action at this time.