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

Same site backup throws errors for some sections with images

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.6
    • 2.6
    • Backup, Files API
    • MOODLE_26_STABLE
    • MOODLE_26_STABLE
    • 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.

    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

              dobedobedoh Andrew Lyons
              dobedobedoh Andrew Lyons
              Jason Fowler Jason Fowler
              Damyon Wiese Damyon Wiese
              Adrian Greeve Adrian Greeve
              Adrian Greeve, David Woloszyn, Huong Nguyen, Jake Dallimore, Meirza, Michael Hawkins, Raquel Ortega, Safat Shahin, Stevani Andolo, Matteo Scaramuccia, David Woloszyn, Huong Nguyen, Jake Dallimore, Meirza, Michael Hawkins, Raquel Ortega, Safat Shahin, Stevani Andolo
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                18/Nov/13