]> git.mjollnir.org Git - moodle.git/commitdiff
Applying new rs_xxx() functions everywhere. MDL-8134
authorstronk7 <stronk7>
Mon, 29 Jan 2007 11:24:18 +0000 (11:24 +0000)
committerstronk7 <stronk7>
Mon, 29 Jan 2007 11:24:18 +0000 (11:24 +0000)
Merged from MOODLE_17_STABLE

lib/accesslib.php

index 76721cdcc5bc1c4160595051ce9b05613a642be1..d737a1613fb97719e5f139074642830f5b56602b 100755 (executable)
@@ -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);
         }
     }