From 91d39e7392302d677fe02092ecca4efc903edf42 Mon Sep 17 00:00:00 2001 From: martinlanghoff Date: Wed, 19 Sep 2007 07:55:15 +0000 Subject: [PATCH] user/index: switch to recordsets to use less memory 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 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/user/index.php b/user/index.php index dedea88e0b..81ef0d9b6a 100644 --- a/user/index.php +++ b/user/index.php @@ -393,7 +393,7 @@ $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 @@ -515,7 +515,7 @@ } if ($matchcount > 0) { - foreach ($userlist as $user) { + while ($user = rs_fetch_next_record($userlist)) { $user = make_context_subobj($user); print_user($user, $course, $bulkoperations); } @@ -530,8 +530,8 @@ $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 -- 2.39.5