Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-16385

group member data in Backups is repeated endlessly

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • 1.8.7, 1.9.3
    • 1.8.6, 1.9.2
    • Backup
    • None
    • All os's and hardware
    • MOODLE_18_STABLE, MOODLE_19_STABLE
    • MOODLE_18_STABLE, MOODLE_19_STABLE

      All backups will include group info. the group members info included is repeated too many times making the moodle.xml file too large to restore in extreme cases. The number repeats seems to depend on the number of students enrolled on the course and the number of groups on the course.

      This problem is present at the OU, I tracked it down to a line of sql in in backuplib.php in the method backup_groups_members_info() that reads

      The sql reads as :
      SELECT gm.* FROM pssr1_mdl_groups_members gm, pssr1_mdl_backup_ids bi WHERE gm.groupid = 44 AND bi.backup_code = 1220629007 AND bi.table_name = 'user'

      The problem is serious because I have a course with a large number of students enrolled and asmany as 314 groups that cannot be restored. Even generating a backup with just labels and nothing else, no user data or anything generates a 35mb zip which contains a 374mb moodle.xml file. 95% of this file is made up of repeating group member data.

      I made a test course with only a couple of students and groups and found that the sql listed above determined the results set from the db which determined the xml output.

      I found a simple fix was to added the line

      AND bi.old_id = gm.userid

      to the end of the sql to restrict the id's correctly. I checked moodle core and this bug appears in there too so I wanted to check if a) this is the correct fix since an even simpler solution could be to remove the references to the 'mdl_backup_ids' table and make cleaner sql. I also wanted to know if others can replicate the problem.

      I'm also wondering why a join wasn't used? Is it because the data access layer can't support it?

            stronk7 Eloy Lafuente (stronk7)
            colchambers Colin Chambers
            Nicolas Connault Nicolas Connault
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.