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

Backup of custom fields for courses should include images

XMLWordPrintable

    • MOODLE_401_STABLE
    • MOODLE_404_STABLE
    • mdl-79151-master
    • Hide

      Setup:

      1. Navigate to Site Administration > Courses > Course custom fields
      2. Click Add a new custom field > Text area
      3. Name the field and click Save changes
        • Note: For more thorough testing, add more fields
      4. Create a new course
        • Give it a name
        • Scroll down to the new text area custom field (under Other fields by default)
        • Enter some text and attach a file such as an image
      5. Click Save and display

      Testing:

      1. From the course page, click on More > Course reuse
      2. Select Backup
      3. Click Jump to final step > Continue
      4. Click Restore for the backup that was just created
      5. Click Restore as a new course > Continue > Next
      6. Update the course name to make it unique
      7. Click Next > Perform restore > Continue
      8. Go to the restored course
      9. Verify in the course settings that the restored course shows the embedded files
      Show
      Setup: Navigate to Site Administration > Courses > Course custom fields Click Add a new custom field > Text area Name the field and click Save changes Note: For more thorough testing, add more fields Create a new course Give it a name Scroll down to the new text area custom field (under Other fields by default) Enter some text and attach a file such as an image Click Save and display Testing: From the course page, click on More > Course reuse Select Backup Click Jump to final step > Continue Click Restore for the backup that was just created Click Restore as a new course > Continue > Next Update the course name to make it unique Click Next > Perform restore > Continue Go to the restored course Verify in the course settings that the restored course shows the embedded files

      To reproduce

      • Define a textarea custom field for use with courses.
      • Create a course.
      • Fill in some text for the custom field, along with an uploaded image.
      • Backup the course
      • Delete the course entirely.
      • Restore the course.
      • Check the custom field, notice the missing image.

      An examination of the backup files should also reveal no files were saved.

      I found a deeper problem with custom fields in that they do not handle backup/restore properly.

      Because developers are able to create and add new custom fields, each custom field is a black box. We do not know the nature of the data within. It could contain files. We would have no way of knowing the metadata about those files. It could contain more exotic data that can not be anticipated.

      Because of this, the custom field infrastructure (i.e. the data controller classes) needs methods to handle backup and restore.

            avdb Alexander Van der Bellen
            jasondendulk Jason den Dulk
            cameron1729 cameron1729
            Sara Arjona (@sarjona) Sara Arjona (@sarjona)
            Kim Jared Lucas Kim Jared Lucas
            Votes:
            3 Vote for this issue
            Watchers:
            25 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 3 hours, 51 minutes
                3h 51m

                  Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.