]> git.mjollnir.org Git - moodle.git/commitdiff
user/index: switch to recordsets to use less memory
authormartinlanghoff <martinlanghoff>
Wed, 19 Sep 2007 07:55:15 +0000 (07:55 +0000)
committermartinlanghoff <martinlanghoff>
Wed, 19 Sep 2007 07:55:15 +0000 (07:55 +0000)
Memory usage was still high for long userlists. Use recordsets
to manage memory growth.

Note that we are still collecting a long long HTML table in memory
before we print it, so the footprint of the html itself is bit of an
issue.

user/index.php

index dedea88e0b985f320f04f7a3ccd47e86330167b6..81ef0d9b6add09a0c832733ecff4e599b60d2f4d 100644 (file)
     $table->initialbars($totalcount > $perpage);
     $table->pagesize($perpage, $matchcount);
 
-    $userlist = get_records_sql($select.$from.$where.$wheresearch.$sort,
+    $userlist = get_recordset_sql($select.$from.$where.$wheresearch.$sort,
             $table->get_page_start(),  $table->get_page_size());
 
     /// If there are multiple Roles in the course, then show a drop down menu for switching
             }
 
             if ($matchcount > 0) {
-                foreach ($userlist as $user) {
+                while ($user = rs_fetch_next_record($userlist)) {
                     $user = make_context_subobj($user);
                     print_user($user, $course, $bulkoperations);
                 }
         $timeformat = get_string('strftimedate');
 
 
-        if (!empty($userlist))  {
-            foreach ($userlist as $user) {
+        if ($userlist->RecordCount() > 0)  {
+            while ($user = rs_fetch_next_record($userlist)) {
                 $user = make_context_subobj($user);
                 if ($user->hidden) {
                 // if the assignment is hidden, display icon