Issue Details (XML | Word | Printable)

Key: MDL-9475
Type: Bug Bug
Status: Reopened Reopened
Priority: Major Major
Assignee: Tim Hunt
Reporter: Don Hinkelman
Votes: 13
Watchers: 11
Operations

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

Import of Quiz breaks links to image and audio files

Created: 21/Apr/07 04:15 AM   Updated: 15/Sep/09 02:03 AM
Component/s: Backup
Affects Version/s: 1.7.2
Fix Version/s: None

File Attachments: 1. Zip Archive backup-qrt-20080201-0811.zip (76 kB)
2. XML File moodle.xml (1.92 MB)

Issue Links:
Duplicate
 

Database: MySQL
Participants: Amy Groshek, Andrew Yong, Don Hinkelman, Eloy Lafuente (stronk7), Joseph Perret, Kam Vento, Nicholas McJetters, Roger Kenner and Tim Hunt
Security Level: None
Resolved date: 22/Sep/07
Affected Branches: MOODLE_17_STABLE


 Description  « Hide
When importing a quiz from one course into another on the same site, the links to image files and audio files are broken. The image files and and audio files are properly copied and moved to the new course, but the links to the files are not updated.

This is not a problem for the teacher or admin, because they have site-wide permissions to view files. However, students do not have permissions to view files outside of their own courses. Therefore students cannot hear the recordings and cannot see the images in the questions.

Workaround: Manually update the HTML code for each quiz question and each link.

  • identify the course ID numbers of the source course and the destination course
  • open up the imported quiz, open up each quiz question item with an audio, video or image file link
  • delete the old course number in the link, and replace it with the new course number in the same place
  • then students are able to view and play the files in the quiz question


 All   Comments   Change History   Version Control      Sort Order: Ascending order - Click to sort in descending order
Eloy Lafuente (stronk7) added a comment - 21/Apr/07 04:27 PM
This goes to Tim...

Tim Hunt added a comment - 23/Apr/07 09:18 PM
Please could you attach a backup file showing the problem. That will help me determine whether the problem is at the backup or restore end. Thanks.

Tim Hunt added a comment - 22/Sep/07 12:25 AM
I'm pretty sure the bug I linked as a duplicate is the same issue as this, and I fixed it some time ago.

Nicholas McJetters added a comment - 01/Feb/08 10:18 PM
This course includes a quiz that has an audio file/mp3 attached to a quiz question. When this course is restored, the MP3 file will not play even while the file is included in the course files. It will not play because when restored the MP3 is hard-linked back to the original course ID (14) from which the question was created from. You can verify this from view source when you render the quiz page in your browser.

Nicholas McJetters added a comment - 08/Feb/08 04:12 AM
It's my new working theory the reason why this problem occurs is that even when a course backup includes quiz questions and audio/mp3/images, if you are restoring to a Moodle that already has these questions saved in the question bank, the restore of quiz questions is automatically skipped during restore.

Because the restore process is not creating new questions, but recycling questions pre-existing in the database for the newly restored course, the links never get republished, and the original course ID keeps manifesting itself into new courses. Since it is unlikely for the future student to have access to course files from the original course ID, the files will not play. I'm not sure if this issue can be reopened or addressed. Thanks.


Tim Hunt added a comment - 08/Feb/08 07:16 AM
Than sounds plausible.

Joseph Perret added a comment - 04/Jun/08 04:46 AM
This is a serious issue for me. A typical chapter question set will have 20 or so questions with figures. And I have 18 or so chapters. This takes forever to update.

Please work on this one soon!


Tim Hunt added a comment - 09/Jun/08 11:47 PM
I have just been reading the code of question/restorelib.php, and I think the situation is this: (Admittedly, I am sitting in a bar in a San Francisco hotel drinking beer and seeing if anyone else is going to turn up before the MoodleMoot, but I think I am still sober enough to know what I am taking about

OK, so in Moodle 1.9+ the situation is fine. Jamie Pratt thought about this situation when he was re-working the question bank.

In 1.8, Nicholas's analysis is right, but only if the category being backed up is 'published'. (If your questions use images or other media files, then publishing them is a bad idea, because they will not work in other courses. That was one fo the fundamental flaws that lead to Jamie re-writing the question bank.)

So, it should be the case that if you ensure that all your question categories are not published, then do the backup, then do the restore, then you should get a copy of the questions, and the copies should have the links to the course files rewritten correctly.

It would be great if someone could test this and confirm it. Thanks.


Roger Kenner added a comment - 14/Nov/08 12:54 AM
This problem still exists in 1.9. The workaround is not realistic for an instructor who might have hundreds of such links in their question bank. It ALSO affects internal links to files in Assignment descriptions.

Tim Hunt added a comment - 14/Nov/08 09:22 AM
When you say 'this problem still exists in 1.9' what exact steps are you performing? and how does the actual outcome differ from the outcome you expect.

Don Hinkelman added a comment - 14/Nov/08 09:08 PM
After seeing Roger's report, we retested the the import of a single quiz from one course to another course in Moodle 1.9.2+ (October 1). We found the links were not broken. The sound and image media files were moved to the new course and the links were updated to the new courseID number. The question bank category was set at Course Default for all questions. So for our setup, my conclusion is that this bug has been fixed. Thanks!

For Roger, I suggest you list step-by-step what caused your bug, the exact version/date of Moodle you are working with, the location of your media files, and the question bank categories that the questions are set to.


Andrew Yong added a comment - 30/Jul/09 01:35 PM
I believe the problem was fixed previously but has come back to haunt us as it was reported last year and we subsequently patched it up to the stable version on 4-Aug-2008. That fixed our issue but it looks as though the problem has returned.

We are running Moodle 1.9.4+ (Build: 20090405) and did not experience the problem last semester but we are now experiencing it.

We backup from the course from a previous semester - which then creates a zip file
We then restore it (with the create new course option) for the new semester.

The image link within the quizzes are not updated and still points to the previous year's course which the current students do not have access to.

We have hundreds of courses that will need to be fixed and withing each course, there are up to 12 quizes. So it is impractical for us to go through all quizes, in all courses, within all faculties. We really do need a utility to run the fix against existing courses and to have the restorelib.php fixed for future restores.


Kam Vento added a comment - 18/Aug/09 02:26 AM
When creating a new class based on an old class. Moodle ver: 1.92 20080711

Quizzes and image folder with images embedded in questions are imported. However, the image has the filename only in the question.
kv


Kam Vento added a comment - 18/Aug/09 02:39 AM
Aha (A good clue for the bug) Moodle 1.92 20080711

The problem is: The image link embedded in the question retains the location from the source class instead of applying the new folder numbered location. In my case the number after the Source:....File.php was 43 the old class, when I update the link it changes to 56.

kv


Tim Hunt added a comment - 18/Aug/09 04:03 PM
I still need more information to be able to reproduce and fix this bug.

Exactly what steps are you performing?

That is what question types are there in the quiz? What options do you choose when you do the backup? After the restore, which bit of text has the wrong link? Please can you copy and paste the HTML from the old course, and the new course after the restore.


Amy Groshek added a comment - 10/Sep/09 11:33 PM
Hi, I have this issue for every <img> tag in backed up courses, regardless of module. My absolute URLs end up like this: src="http://campus.extension.org/file.php/227$@SLASH@$image$@SLASH@$couple.png"

Can supply backup files if needed. But they are large.


Amy Groshek added a comment - 10/Sep/09 11:39 PM
Attaching moodle.xml. Note how forward slashes are not correct in the backup file. src="http://campus.extension.org/file.php/227$@SLASH@$image$@SLASH@$couple.png"

These image URLs are not broken when I restore locally, but are broken when I restore on another site.

Also see the last post in this forum: http://moodle.org/mod/forum/discuss.php?d=123571#p541640

Running LAMP, Moodle 1.9.5+


Tim Hunt added a comment - 15/Sep/09 02:03 AM - edited
Please tell me which bit of text in which question type is getting messed up. (For example, a choice or a feedback in a multiple choice question, or whatever.)