From 0f5dafffe965123955824a71072dc176dd9a3940 Mon Sep 17 00:00:00 2001 From: stronk7 Date: Mon, 29 Jan 2007 11:24:18 +0000 Subject: [PATCH] Applying new rs_xxx() functions everywhere. MDL-8134 Merged from MOODLE_17_STABLE --- lib/accesslib.php | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/lib/accesslib.php b/lib/accesslib.php index 76721cdcc5..d737a1613f 100755 --- a/lib/accesslib.php +++ b/lib/accesslib.php @@ -1372,13 +1372,12 @@ function moodle_install_roles() { 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. @@ -1388,13 +1387,12 @@ function moodle_install_roles() { /// 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); } } @@ -1402,8 +1400,7 @@ function moodle_install_roles() { /// 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 @@ -1424,9 +1421,8 @@ function moodle_install_roles() { } $progresscount++; print_progress($progresscount, $totalcount, 5, 1, 'Processing role assignments'); - - $rs->MoveNext(); } + rs_close($rs); } } @@ -1434,8 +1430,7 @@ function moodle_install_roles() { /// 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; @@ -1449,9 +1444,8 @@ function moodle_install_roles() { role_assign($studentrole, $student->userid, 0, $coursecontext->id); $progresscount++; print_progress($progresscount, $totalcount, 5, 1, 'Processing role assignments'); - - $rs->MoveNext(); } + rs_close($rs); } } -- 2.39.5