Permalink
Browse files

Changed get_records (every field) in user_check_backup to

get_records (only id). Possible memory shortage when a lot
of users (3999) are retrieved.
  • Loading branch information...
1 parent d7b97e4 commit 54b7cd7c605e34143a79ee08b15d99a338144970 stronk7 committed Jun 10, 2003
Showing with 4 additions and 7 deletions.
  1. +4 −7 backup/backuplib.php
View
@@ -38,18 +38,16 @@ function user_check_backup($course,$backup_unique_code,$backup_users) {
global $CFG;
global $db;
-$db->debug=true;
-
$count_users = 0;
- //Select all users from user
- $users = get_records ("user");
+ //Select all users from user (only id)
+ //If there are a lot of users and we retrieve all the info->memory shortage !!
+ $users = get_records ("user","","","","id,id");
//If we have users
if ($users) {
//Iterate over users putting their roles
foreach ($users as $user) {
-echo $user->id."<br>";
- $user->info = "";
+ $user->info = "";
//Is Admin in tables (not is_admin()) !!
if (record_exists("user_admins","userid",$user->id)) {
$user->info .= "admin";
@@ -97,7 +95,6 @@ function user_check_backup($course,$backup_unique_code,$backup_users) {
$info[0][0] = get_string("users");
$info[0][1] = $count_users;
-$db->debug=false;
return $info;
}

0 comments on commit 54b7cd7

Please sign in to comment.