Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-40499

Edit question breaks file links from 1.9 course import if file refs in subfolder

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.4.4, 2.5
    • Fix Version/s: 2.4.6, 2.5.2
    • Component/s: Quiz
    • Labels:
    • Testing Instructions:
      Hide
      1. On a Moodle 1.9 website prepare some questions including images from subfolders of the course folder (warning: this is the key point of this issue !).
      2. Add a quiz activity containing these questions.
      3. Backup the course, including the quiz.
      4. Restore this backup in Moodle master (as the fix is exactly the same on all branches and the way images in questions are restored is also the same in MOODLE_24_STABLE, MOODLE_25_STABLE and master branches, I think it is enough to test in master but I leave it up to the tester )
      5. Verify that images are successfully restored and correctly displayed both in the quiz and in question preview.
      6. Edit a question (you don't need to really make a change just opening it in the editor and saving was enough to trigger the bug) and save it.
      7. Verify that images are still correctly displayed in the quiz, in the preview and if you try to edit the same question again.

      To simplify tester life, I will prepare a Moodle 1.9 backup that could be used to test this issue and attach it here .

      Show
      On a Moodle 1.9 website prepare some questions including images from subfolders of the course folder (warning: this is the key point of this issue !). Add a quiz activity containing these questions. Backup the course, including the quiz. Restore this backup in Moodle master (as the fix is exactly the same on all branches and the way images in questions are restored is also the same in MOODLE_24_STABLE, MOODLE_25_STABLE and master branches, I think it is enough to test in master but I leave it up to the tester ) Verify that images are successfully restored and correctly displayed both in the quiz and in question preview. Edit a question (you don't need to really make a change just opening it in the editor and saving was enough to trigger the bug) and save it. Verify that images are still correctly displayed in the quiz, in the preview and if you try to edit the same question again. To simplify tester life, I will prepare a Moodle 1.9 backup that could be used to test this issue and attach it here .
    • Affected Branches:
      MOODLE_24_STABLE, MOODLE_25_STABLE
    • Fixed Branches:
      MOODLE_24_STABLE, MOODLE_25_STABLE
    • Pull Master Branch:

      Description

      Reported by Steve Miley (see https://moodle.org/mod/forum/discuss.php?d=231937 )
      If you restore a Moodle 1.9 backup with question containing embedded images that were in a sub-folder of the course folder (as https://gauchospace.ucsb.edu/courses/file.php/4644/Quizzes/Wk1.png) on the Moodle 1.9 website were the backup was created, everything is fine until you try to edit the question and save the result (you don't need to make any change just opening the question and saving it is enough to exhibit the problem). Then all images are broken in the question.
      The forum thread contains useful details about the problem.
      In short this is because of the difference about the value of the subdirs setting in the editing form class and in the save code of the question_type class.
      As Tim says:
      And, setting subdirs to false/0 now breaks things.
      Therefore, we should set it to true/1 everywhere.

        Gliffy Diagrams

          Activity

          Hide
          jmvedrine Jean-Michel Vedrine added a comment -

          Hello tim,
          Putting this in peer review.

          Show
          jmvedrine Jean-Michel Vedrine added a comment - Hello tim, Putting this in peer review.
          Hide
          timhunt Tim Hunt added a comment -

          Thanks for fixing this Jean-Michel. +1 from me. Submitting for integration.

          Show
          timhunt Tim Hunt added a comment - Thanks for fixing this Jean-Michel. +1 from me. Submitting for integration.
          Hide
          damyon Damyon Wiese added a comment -

          Jean-Michel, it would be great if you could add the testing file here for the testers tomorrow.

          Show
          damyon Damyon Wiese added a comment - Jean-Michel, it would be great if you could add the testing file here for the testers tomorrow.
          Hide
          damyon Damyon Wiese added a comment -

          Thanks Jean-Michel,

          From the forum it sounds like this will make some people very happy!

          Integrated to 24, 25 and master.

          Show
          damyon Damyon Wiese added a comment - Thanks Jean-Michel, From the forum it sounds like this will make some people very happy! Integrated to 24, 25 and master.
          Hide
          abgreeve Adrian Greeve added a comment -

          Tested on the 2.4, 2.5, and master integration branches.
          All images displayed properly when previewing, editing, taking the quiz.
          Test passed.

          Show
          abgreeve Adrian Greeve added a comment - Tested on the 2.4, 2.5, and master integration branches. All images displayed properly when previewing, editing, taking the quiz. Test passed.
          Hide
          damyon Damyon Wiese added a comment -

          a single bug fix
          a drop in a waterfall
          hear the mighty roar

          Thanks for your contribution!

          Show
          damyon Damyon Wiese added a comment - a single bug fix a drop in a waterfall hear the mighty roar Thanks for your contribution!

            People

            • Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                9/Sep/13