From 66d0022594586cd0fe622963a3ffd89f06962ad3 Mon Sep 17 00:00:00 2001 From: Tim Gus Date: Mon, 10 Jun 2013 09:13:37 -0400 Subject: [PATCH] MDL-40259 - For SCORM reports limit fields returned from get_users_by_capability to user ID to decrease memory utilization --- mod/scorm/report/basic/report.php | 6 ++++-- mod/scorm/report/interactions/report.php | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/mod/scorm/report/basic/report.php b/mod/scorm/report/basic/report.php index b035216a8ad..3991a5dd98d 100644 --- a/mod/scorm/report/basic/report.php +++ b/mod/scorm/report/basic/report.php @@ -82,21 +82,23 @@ class scorm_basic_report extends scorm_default_report { if (empty($currentgroup)) { // all users who can attempt scoes - if (!$students = get_users_by_capability($contextmodule, 'mod/scorm:savetrack', '', '', '', '', '', '', false)) { + if (!$students = get_users_by_capability($contextmodule, 'mod/scorm:savetrack', 'u.id', '', '', '', '', '', false)) { echo $OUTPUT->notification(get_string('nostudentsyet')); $nostudents = true; $allowedlist = ''; } else { $allowedlist = array_keys($students); } + unset($students); } else { // all users who can attempt scoes and who are in the currently selected group - if (!$groupstudents = get_users_by_capability($contextmodule, 'mod/scorm:savetrack', '', '', '', '', $currentgroup, '', false)) { + if (!$groupstudents = get_users_by_capability($contextmodule, 'mod/scorm:savetrack', 'u.id', '', '', '', $currentgroup, '', false)) { echo $OUTPUT->notification(get_string('nostudentsingroup')); $nostudents = true; $groupstudents = array(); } $allowedlist = array_keys($groupstudents); + unset($groupstudents); } if ( !$nostudents ) { diff --git a/mod/scorm/report/interactions/report.php b/mod/scorm/report/interactions/report.php index f219074c23d..0b5a00eee9b 100644 --- a/mod/scorm/report/interactions/report.php +++ b/mod/scorm/report/interactions/report.php @@ -96,21 +96,23 @@ class scorm_interactions_report extends scorm_default_report { if (empty($currentgroup)) { // all users who can attempt scoes - if (!$students = get_users_by_capability($contextmodule, 'mod/scorm:savetrack', '', '', '', '', '', '', false)) { + if (!$students = get_users_by_capability($contextmodule, 'mod/scorm:savetrack', 'u.id', '', '', '', '', '', false)) { echo $OUTPUT->notification(get_string('nostudentsyet')); $nostudents = true; $allowedlist = ''; } else { $allowedlist = array_keys($students); } + unset($students); } else { // all users who can attempt scoes and who are in the currently selected group - if (!$groupstudents = get_users_by_capability($contextmodule, 'mod/scorm:savetrack', '', '', '', '', $currentgroup, '', false)) { + if (!$groupstudents = get_users_by_capability($contextmodule, 'mod/scorm:savetrack', 'u.id', '', '', '', $currentgroup, '', false)) { echo $OUTPUT->notification(get_string('nostudentsingroup')); $nostudents = true; $groupstudents = array(); } $allowedlist = array_keys($groupstudents); + unset($groupstudents); } if ( !$nostudents ) { // Now check if asked download of data -- 2.43.0