Quiz Image in Answers but not in Question.

Quiz Image in Answers but not in Question.

by Jon Fila -
Number of replies: 4

Moodle 2.4.3+ (Build: 20130425)

See image below. Since the recent update I am now able to restore 1.9 courses that had images embedded in questions but when a backup is made in 2.4 and then imported/restored to another course I am losing images in the questions (not the answers). Everything in the questions embed & HTML is the same.

Is this a bug or am I missing something?

Just to check, I enabled the legacy course files area and restored all of the images that the quiz uses and they still do not appear (this was the way I fixed the issue in previous versions).

image of question

 

Any ideas of what I can try next?

Average of ratings: -
In reply to Jon Fila

Re: Quiz Image in Answers but not in Question.

by Jean-Michel Védrine -

hello,

As you give your exact Moodle version, I am quite sure that when you restore the 1.9 backup, all images should no more be legacy images (this is one of the things that was fixed in Moodle 2.4.3 for the March 14th 2013 weekly release, but in older Moodle versions, images were restored as legacy images and that could lead to all sort of problems in future backups/restores)

So can you try to restore one of your 1.9 backup and right click on images both in question text and in answer and verify that they all have "pluginfile.php" and not "file.php" in the adress.

If you agree and if there is no confidentiality problem, to understand what is the problem, it would help if you could send me one of your 1.9 backup and a backup of the same course made in Moodle 2.4 and that has broken image sin question text. send me a private message if you can't find my adress or if your files are too big to send by mail.

Maybe you have found a bug, and as I have worked hard to solve this problem, I am really interested in understanding what is happening.

 

In reply to Jean-Michel Védrine

Re: Quiz Image in Answers but not in Question.

by Jon Fila -

The broken image does use the pluginfile.php for the image URL

Upon further investigation, it looks like these will restore fine into a new course but when being restored/imported into an existing course with it is causing the issue. Could this have to do with the fact that the backup includes hundreds of categories/questions that are not needed for the restored elements? It would appear that in the process of restoring all of this that quite a bit of unnecessary data is coming along with it and somehow interfering with the process.

I would like to back up particular units within a course but not have every question/category come along with it. I believe that would solve my problem.

If I hack a 1.9 backup to remove all of the quiz questions and files that are not necessary then things work as expected. If I try to do the same with an MBZ backup and rezip, I'm not as successful. Unfortunately, with hundreds of questions/categories, this can take quite a bit of time.

 

In reply to Jon Fila

Re: Quiz Image in Answers but not in Question.

by Jean-Michel Védrine -

The fact that all questions are included in the backup is expected, this is how it works.

The structure of mbz archive is a lot more complex than old zip backups created by Moodle 1.9 and I don't think that what you attempt to do is possible. You can't unzip, suppress elements, and rezip like that.

Maybe your problem is just because memory is exhausted during course restore ?

Try to enable debugging to see if any error message is printed during restore.

In reply to Jean-Michel Védrine

Re: Quiz Image in Answers but not in Question.

by Jon Fila -

Unzipping, editing then re-zipping, restoring did end up working, but it took me quite a bit of time to complete one of 18 units that are pretty large backup files. There are only two courses like this so once I can resolve these then making copies of them should be easy enough.

This could all be solved it seems to me if users were allowed to removed quiz questions/categories from backups/restores. I would think that this would be an appropriate thing to do especially if the quizzes that use those questions aren't even part of the course any longer. When dealing with hundreds of questions and categories that aren't necessary it really throws a wrench into what should be a simple backup/restore.