Moodle

Backup: not restoring question sessions?

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Duplicate
  • Affects Version/s: 1.6.3
  • Fix Version/s: None
  • Component/s: Backup, Questions
  • Labels:
    None
  • Environment:
    Moodle 1.6.3+
    MySql
  • Database:
    MySQL
  • Affected Branches:
    MOODLE_16_STABLE

Description

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.

Issue Links

Activity

Hide
Eloy Lafuente (stronk7) added a comment -

re-assigning....to Tim

Show
Eloy Lafuente (stronk7) added a comment - re-assigning....to Tim
Hide
Gareth Morgan added a comment -

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()

Show
Gareth Morgan added a comment - 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()
Hide
Tim Hunt added a comment -

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.

Show
Tim Hunt added a comment - 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.

People

Vote (1)
Watch (4)

Dates

  • Created:
    Updated:
    Resolved: