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

Same site backup throws errors for some sections with images

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.6
    • Fix Version/s: 2.6
    • Component/s: Backup, Files API
    • Labels:
    • Testing Instructions:
      Hide
      • Edit a section on your source course
      • Add an image
      • Save
      • Re-edit section
      • Change the image some how
      • Save
      • Open a new course
      • Import the first course in
      • Confirm that there were no errors
      • Fiddle about and try this a few times.

      Note: You may want to add a debugging call to the patch to log when a file has been restored previously to ensure that you would have hit it.

      Show
      Edit a section on your source course Add an image Save Re-edit section Change the image some how Save Open a new course Import the first course in Confirm that there were no errors Fiddle about and try this a few times. Note: You may want to add a debugging call to the patch to log when a file has been restored previously to ensure that you would have hit it.
    • Affected Branches:
      MOODLE_26_STABLE
    • Fixed Branches:
      MOODLE_26_STABLE
    • Pull Master Branch:

      Description

      I'm struggling to work out how to replicate this, but I do have a fix.

      Basically, it seems that if the source course has a section with an image inline, then that image is sometimes included twice in the backup. As a result, it's inserted twice by restore_dbops.class.php and because of unique key constraints on the pathhash, an exception is thrown.

      It's easy to fix (check for the file first) but I'm struggling to write test instructions because I can't reliably replicate the issue. It seems to occur on a course if you've added a file to a section, and then later modified it.

        Attachments

        1. 40440.zip
          29 kB
        2. import.php
          1 kB

          Issue Links

            Activity

              People

              Assignee:
              dobedobedoh Andrew Nicols
              Reporter:
              dobedobedoh Andrew Nicols
              Peer reviewer:
              Jason Fowler
              Integrator:
              Damyon Wiese
              Tester:
              Adrian Greeve
              Participants:
              Component watchers:
              Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias, Matteo Scaramuccia, Andrew Nicols, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                18/Nov/13