Details
Description
On our production site our staff programmer Cliff found this issue, when we added the winter/spring 2008 students to the DB, then course level manual backup will not complete. We did some debugging and found that the function user_check_backup in /backup/backuplib.php were not implemented efficiently and would generate big memory footprint:
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;
$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;
//Now, enrolled
if ($enrolled_users) {
foreach ($enrolled_users as $enrolled_user)
}
//Now, depending of parameters, create $backupable_users
if ($backup_users == 0)
else
{ $backupable_users = $course_users; }We rewrote it a little bit and are still testing the patch (patch is not included here in this ticket right now), but would like to create a bug ticket here so that people who are running large sites would aware of this issue. Thanks!