MDL-74967 core: deprecate groupmember hack from USER object

This commit is contained in:
Simey Lameze 2022-06-14 11:47:30 +08:00
parent ceb41588d2
commit c85b88c1b6
3 changed files with 2 additions and 22 deletions

View File

@ -287,11 +287,6 @@ class course_modinfo {
*/
private function get_groups_all() {
if (is_null($this->groups)) {
// NOTE: Performance could be improved here. The system caches user groups
// in $USER->groupmember[$courseid] => array of groupid=>groupid. Unfortunately this
// structure does not include grouping information. It probably could be changed to
// do so, without a significant performance hit on login, thus saving this one query
// each request.
$this->groups = groups_get_user_groups($this->course->id, $this->userid);
}
return $this->groups;

View File

@ -4883,23 +4883,6 @@ function get_complete_user_data($field, $value, $mnethostid = null, $throwexcept
}
}
$sql = "SELECT g.id, g.courseid
FROM {groups} g, {groups_members} gm
WHERE gm.groupid=g.id AND gm.userid=?";
// This is a special hack to speedup calendar display.
$user->groupmember = array();
if (!isguestuser($user)) {
if ($groups = $DB->get_records_sql($sql, array($user->id))) {
foreach ($groups as $group) {
if (!array_key_exists($group->courseid, $user->groupmember)) {
$user->groupmember[$group->courseid] = array();
}
$user->groupmember[$group->courseid][$group->id] = $group->id;
}
}
}
// Add cohort theme.
if (!empty($CFG->allowcohortthemes)) {
require_once($CFG->dirroot . '/cohort/lib.php');

View File

@ -3,6 +3,8 @@ information provided here is intended especially for developers.
=== 4.1 ===
* The $USER->groupmember hack that fills the user object with the groups that the user belongs to has been removed.
Please use the Groups API function groups_get_user_groups() to fetch the cached list of groups the user is a member of.
* The method ensure_adhoc_task_qos() in lib/classes/task/manager.php has been deprecated, please use get_next_adhoc_task()
instead.
* New setting $CFG->enrolments_sync_interval controls the minimum time in seconds between re-synchronization of enrollment via enrol_check_plugins.