Issue Details (XML | Word | Printable)

Key: MDL-20570
Type: Bug Bug
Status: Open Open
Priority: Minor Minor
Assignee: Tim Hunt
Reporter: David Mudrak
Votes: 0
Watchers: 1
Operations

Add/Edit UI Mockup to this issue
If you were logged in you would be able to see more operations.
Moodle

Shared questions not backed up, leading to DB data corruption and SQL errors

Created: 15/Oct/09 06:44 PM   Updated: 16/Oct/09 12:03 AM
Return to search
Component/s: Backup, Questions
Affects Version/s: 1.9.5
Fix Version/s: None

Environment: observed at MySQL servers
Issue Links:
Relates
 

Participants: David Mudrak and Tim Hunt
Security Level: None
Affected Branches: MOODLE_19_STABLE


 Description  « Hide
Symptoms
========
- unable to add questions to a quiz
- after debugging turned on, an SQL error complains. Invalid arguments passed to IN() operator like in "questionid IN (,,,,,,,,189,188,187)"
- the field "questions" in mdl_quiz table contains data like ,,,,,189,188,187 (it est missing integers)

Reasons
=======
The data of the field "questions" got corrupted during a restore procedure. A course backup with a quiz was restored. However, questions used by the quiz were not included in the backup. During the restore, the id of not included question casts to empty string '' which leads to corrupted data in mdl_quiz.questions field.

The reason why the questions were not included in the backup is that all the questions were shared at the course category context. However, at the end of the term, the course were moved out of the category to an archive so it was not descendant of the category containing the questions any more. The quiz itself continued working so the teacher did not notice anything weird. During the backup procedure, the number of questions being backed-up was reported as 0. But it itself is not alarming too much if the backup is done by administrator, for example, who does not know the course so much.

How to reproduce
==============
1. Create a top level category CAT1
2. Create course COURSE under CAT1
3. Create a QUIZ in COURSE containing three or so questions. Save the questions in the context of CAT1
4. Create another top level category CAT2
5. Move the COURSE into CAT2
6. Check the QUIZ still works
7. Backup the COURSE
8. Restore the COURSE into CLONE
9. Try to add a question to the QUIZ in CLONE (with debugging on, of course)

 All   Comments   Change History   Version Control      Sort Order: Ascending order - Click to sort in descending order
David Mudrak added a comment - 15/Oct/09 06:51 PM
Added How to reproduce to the issue Description

Tim Hunt added a comment - 16/Oct/09 12:03 AM
Well done for diagnosing that. It means that it is really a consequence of MDL-14802, but not really a duplicate.