if (in_array($CFG->prefix.'user_admins', $dbtables)) {
if ($rs = get_recordset_sql('SELECT * from '.$CFG->prefix.'user_admins ORDER BY ID ASC')) {
- while (! $rs->EOF) {
- $admin = $rs->FetchObj();
+ while ($admin = rs_fetch_next_record($rs)) {
role_assign($adminrole, $admin->userid, 0, $systemcontext->id);
$progresscount++;
print_progress($progresscount, $totalcount, 5, 1, 'Processing role assignments');
- $rs->MoveNext();
}
+ rs_close($rs);
}
} else {
// This is a fresh install.
/// Upgrade course creators.
if (in_array($CFG->prefix.'user_coursecreators', $dbtables)) {
if ($rs = get_recordset('user_coursecreators')) {
- while (! $rs->EOF) {
- $coursecreator = $rs->FetchObj();
+ while ($coursecreator = rs_fetch_next_record($rs)) {
role_assign($coursecreatorrole, $coursecreator->userid, 0, $systemcontext->id);
$progresscount++;
print_progress($progresscount, $totalcount, 5, 1, 'Processing role assignments');
- $rs->MoveNext();
}
+ rs_close($rs);
}
}
/// Upgrade editting teachers and non-editting teachers.
if (in_array($CFG->prefix.'user_teachers', $dbtables)) {
if ($rs = get_recordset('user_teachers')) {
- while (! $rs->EOF) {
- $teacher = $rs->FetchObj();
+ while ($teacher = rs_fetch_next_record($rs)) {
// removed code here to ignore site level assignments
// since the contexts are separated now
}
$progresscount++;
print_progress($progresscount, $totalcount, 5, 1, 'Processing role assignments');
-
- $rs->MoveNext();
}
+ rs_close($rs);
}
}
/// Upgrade students.
if (in_array($CFG->prefix.'user_students', $dbtables)) {
if ($rs = get_recordset('user_students')) {
- while (! $rs->EOF) {
- $student = $rs->FetchObj();
+ while ($student = rs_fetch_next_record($rs)) {
// populate the user_lastaccess table
$access = new object;
role_assign($studentrole, $student->userid, 0, $coursecontext->id);
$progresscount++;
print_progress($progresscount, $totalcount, 5, 1, 'Processing role assignments');
-
- $rs->MoveNext();
}
+ rs_close($rs);
}
}