Permalink
Browse files

Avoiding some itarations. MDL-7902. Thanks Samuli!

Merged from MOODLE_17_STABLE
  • Loading branch information...
1 parent 5c8b250 commit a5855a89bfb79392f55148c3977626f9092b6840 stronk7 committed Jan 14, 2007
Showing with 3 additions and 18 deletions.
  1. +3 −18 backup/backuplib.php
View
@@ -170,25 +170,10 @@ function backup_get_enrolled_users ($courseid) {
return get_users_by_capability(get_context_instance(CONTEXT_COURSE, $courseid), 'moodle/course:view');
}
- //Returns all users (every record in users table)
-
+ //Returns all users ids (every record in users table)
function backup_get_all_users() {
- global $CFG;
-
- $result = false;
-
- //Get users
- $users = get_records_sql("SELECT DISTINCT id,id
- FROM {$CFG->prefix}user");
- //Add users
- if ($users) {
- foreach ($users as $user) {
- $result[$user->id]->id = $user->id;
- }
- }
-
- return $result;
+ return get_records('user', '', '', '', 'id, id');
}
//Calculate the number of log entries to backup
@@ -2245,4 +2230,4 @@ function write_role_assignments_xml($bf, $context, $startlevel) {
}
fwrite ($bf, end_tag("ROLES_ASSIGNMENTS", $startlevel, true));
}
-?>
+?>

0 comments on commit a5855a8

Please sign in to comment.