Skip to content
Browse files

MDL-29803 report/logs - don't retrieve all users uncessarily

Also remove uncessary retrieval of idnumber

Helps display the main logs page on large sites without running out of
memory

Conflicts:

	course/report/log/lib.php
  • Loading branch information...
1 parent ce8e567 commit 2eb04f8ad3d33dbc8e7061e5694842c0b5221a8b @danpoltawski danpoltawski committed with stronk7 Nov 1, 2011
Showing with 6 additions and 1 deletion.
  1. +6 −1 course/report/log/lib.php
View
7 course/report/log/lib.php
@@ -350,7 +350,12 @@ function print_log_selector_form($course, $selecteduser=0, $selecteddate='today'
// Get all the possible users
$users = array();
- $courseusers = get_enrolled_users($context, '', $selectedgroup, 'u.id, u.firstname, u.lastname, u.idnumber', 'lastname ASC, firstname ASC');
+ // Define limitfrom and limitnum for queries below
+ // If $showusers is enabled... don't apply limitfrom and limitnum
+ $limitfrom = empty($showusers) ? 0 : '';
+ $limitnum = empty($showusers) ? COURSE_MAX_USERS_PER_DROPDOWN + 1 : '';
+
+ $courseusers = get_enrolled_users($context, '', $selectedgroup, 'u.id, u.firstname, u.lastname', 'lastname ASC, firstname ASC', $limitfrom, $limitnum);
if (count($courseusers) < COURSE_MAX_USERS_PER_DROPDOWN && !$showusers) {
$showusers = 1;

0 comments on commit 2eb04f8

Please sign in to comment.
Something went wrong with that request. Please try again.