Dear all:
Just want to say that we found an issue in the function "user_check_backup()" in /backup/backuplib.php. Currently it looks like this:
//Calculate the number of users to backup and put their ids in backup_ids
//Return an array of info (name,value)
function user_check_backup($course,$backup_unique_code,$backup_users,$backup_messages) {
//$backup_users=0-->all
// 1-->course (needed + enrolled)
// 2-->none
global $CFG;
global $db;
$context = get_context_instance(CONTEXT_COURSE, $course);
$count_users = 0;
//If we've selected none, simply return 0
if ($backup_users == 0 or $backup_users == 1) {
//Calculate needed users (calling every xxxx_get_participants function + scales users)
$needed_users = backup_get_needed_users($course, $backup_messages);
//Calculate enrolled users (students + teachers)
$enrolled_users = backup_get_enrolled_users($course);
//Calculate all users (every record in users table)
$all_users = backup_get_all_users();
//Calculate course users (needed + enrolled)
//First, needed
$course_users = $needed_users;
........
As you could see either $backup_users == 0 or $backup_users == 1 would have to go through that $all_users = backup_get_all_users(); This is not efficient, especially when you have a lot of users (like 60,000+) and it could fail the backup process (simply because it could easily exceed the 64MB default memory_limit). You could of course bump up the memory_limit to 128MB or even 256MB but this is like putting bandages and not really solving the problem. We have proposed a patch in MDL-12562 and would appreciate it very much that people could comment on the patch. Thanks!
Backup and restore
function "user_check_backup()" problem in backuplib.php
This discussion has been locked so you can no longer reply to it.