WisdmLabs / moodle-format_remuiformat

GNU General Public License v3.0
10 stars 32 forks source link

Failure while duplicating a course #54

Open cli-ish opened 3 years ago

cli-ish commented 3 years ago

There is an error when duplicating courses which use the remui course format. The Remui course image does no longer exists after a duplication if the course setting page is open at the same time.

Steps to reproduce:

  1. Checkout master branch
  2. Install version (1.1.1)
  3. create course
  4. Set course format to remui
  5. Add image to the remui section and save
  6. Reopen course setting page and open a new tab
  7. duplicate the created course over /backup/copy.php?id={courseid} (in the new tab)
  8. Run cron job (terminal)
  9. See that the new created course does not have a remui course image.

image

image

Most likely its based on the filearea context or a fresh generated draftid when editing the course page. Because it works when none is editing the course. (must be explizit saved, a simple exit while editing the page does not work and will result also in an empty image)

The error exists somewhere in this function or below in the call chain. https://github.com/WisdmLabs/moodle-format_remuiformat/blob/master/lib.php#L639