Syxton / moodle-block_massaction

THE OFFICIAL Mass Actions block for Moodle 3.9 and beyond
9 stars 14 forks source link

Prevent duplicate_task from crashing if course has been deleted in th… #124

Closed PhMemmel closed 1 week ago

PhMemmel commented 2 months ago

In rare cases when there's a delay in processing adhoc tasks on an instance for example it's possible that a course has already been deleted once the duplicate_task starts to run. In this case the task fails.

This PR introduces a check if the source and target course exists, before actually doing the duplication of activities.

Syxton commented 1 week ago

@PhMemmel can you rebase this and resubmit. After the checks run I'll evaluate it.

PhMemmel commented 1 week ago

@Syxton Sure, looks pretty green overall :)

Syxton commented 1 week ago

@PhMemmel probably not a common problem, but it is a good sanity check to see if the course exists before trying to duplicate from/to. Looks good. merging

PhMemmel commented 1 week ago

Well, as you might think this PR does not come out of nowhere... I saw the job fail on our instance... :) It probably will become more important once https://tracker.moodle.org/browse/MDL-77760 lands.