Issue Details (XML | Word | Printable)

Key: MDL-7980
Type: Bug Bug
Status: Resolved Resolved
Resolution: Duplicate
Priority: Major Major
Assignee: Tim Hunt
Reporter: Tomasz Rybicki
Votes: 1
Watchers: 4
Operations

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

Backup: not restoring question sessions?

Created: 19/Dec/06 05:31 PM   Updated: 01/Nov/07 01:12 AM
Return to search
Component/s: Backup, Questions
Affects Version/s: 1.6.3
Fix Version/s: None

Environment:
Moodle 1.6.3+
MySql
Issue Links:
Duplicate
 

Database: MySQL
Participants: Eloy Lafuente (stronk7), Gareth Morgan, Tim Hunt and Tomasz Rybicki
Security Level: None
Resolved date: 01/Nov/07
Affected Branches: MOODLE_16_STABLE


 Description  « Hide
While restoring a course an error occurs (it is written into error log):

[Tue Dec 19 09:19:41 2006] [error] [client *****] SQL Unknown column 'positionkey' in 'where clause' in /var/moodle/lib/datalib.php on line 579. STATEMENT: SELECT * FROM mdl_question_multianswer WHERE question = '376' AND positionkey = '' LIMIT 1

It appears that the columnt positionkey has been removed from the DB as obsolete:

In /mod/quiz/db/mysql.php there is an upgrade to DB [ if ($success && $oldversion < 2005051401) ] which (among others) states (line 738):

            $success = $success && modify_database('', 'ALTER TABLE `prefix_quiz_multianswers` DROP `positionkey`');

At the same time, file /question/type/multianswer/questiontype.php states (line 504) references the column

$db_multianswer = get_record ("question_multianswer","question",$new_question_id,
                                                      "positionkey",$multianswer->positionkey);

This obviously leads to an error in SQL. Don't know whether it affects question sessions.

It happens with backing up courses with or without user data.

 All   Comments   Change History   Version Control      Sort Order: Ascending order - Click to sort in descending order
Eloy Lafuente (stronk7) added a comment - 19/Dec/06 08:36 PM
re-assigning....to Tim

Gareth Morgan added a comment - 20/Sep/07 10:07 PM
I have been getting a related error when attempting to restore quizzes backed up using the normal backup form, that have Multianswer type questions in them, as per the following output.
  • backup file has been limited to just contain the quiz (no course resource or user data)
  • using an existing unit
  • having selected the option to add data to it (not deleting)

The output from the restore was as follows:

Creating topics and questions
Category "Default"
. . . . .
Notice: Undefined index: ANSWERS in /var/www/html/gcm77/moodle5/question/type/multianswer/questiontype.php on line 511

Notice: Undefined index: POSITIONKEY in /var/www/html/gcm77/moodle5/question/type/multianswer/questiontype.php on line 512

Notice: Undefined index: ANSWERTYPE in /var/www/html/gcm77/moodle5/question/type/multianswer/questiontype.php on line 513

Notice: Undefined index: NORM in /var/www/html/gcm77/moodle5/question/type/multianswer/questiontype.php on line 514

ERROR: column "positionkey" does not exist

SELECT * FROM mdl5_question_multianswer WHERE question = '796' AND positionkey = ''
line 779 of lib/dmllib.php: call to debugging()
line 576 of lib/dmllib.php: call to get_recordset_sql()
line 516 of lib/dmllib.php: call to get_record_sql()
line 523 of question/type/multianswer/questiontype.php: call to get_record()
line 290 of question/restorelib.php: call to embedded_cloze_qtype->restore_map()
line 149 of question/restorelib.php: call to restore_questions()
line 2038 of backup/restorelib.php: call to restore_question_categories()
line 6066 of backup/restorelib.php: call to restore_create_questions()
line 49 of backup/restore_execute.html: call to restore_execute()
line 162 of backup/restore.php: call to include_once()

.
ERROR: current transaction is aborted, commands ignored until end of transaction block

SELECT * FROM mdl5_question_answers WHERE question = '797' AND answer = 'Il y a énormément de monde aux terrasses des cafés.'
line 779 of lib/dmllib.php: call to debugging()
line 576 of lib/dmllib.php: call to get_recordset_sql()
line 516 of lib/dmllib.php: call to get_record_sql()
line 407 of question/restorelib.php: call to get_record()
line 287 of question/restorelib.php: call to question_restore_map_answers()
line 149 of question/restorelib.php: call to restore_questions()
line 2038 of backup/restorelib.php: call to restore_question_categories()
line 6066 of backup/restorelib.php: call to restore_create_questions()
line 49 of backup/restore_execute.html: call to restore_execute()
line 162 of backup/restore.php: call to include_once()


Tim Hunt added a comment - 20/Sep/07 11:49 PM
Gareth sent me a sample backup file that reproduced the problem, and I tried it on HEAD and it worked, so perhaps this has been fixed. Can anyone reproduce this on HEAD?

Gareth, lets wait until we have merged Moodle 1.9 into OU Moodle, and see if it is still reproducible then.