After resetting lot of courses for this new academic year, i saw that logs where not deleted, before the new course start date (or the moment i made the reset). Really, a teacher said it to me, and asked that i delete these old logs.
But it seems that the decision to keep logs (not delete them) when resetting a course was taken without much more discussion about that.
Let me try to explain why i think it's not always a good solution :
- As someone explained in MDL-43274 comments, it could allow some new teacher in a course to see what was done before he's in (for a new semester/year)
- It takes lot of place in Moodle's internal DB
- it then generate bigger backup files (when including logs)
- if your server miss disk place (because of logs, in DB/backups), the recommandation is generally to lower the time before deleting logs (globally) by the dedicated scheduled task. But the problem is that it then implies to delete all logs for all courses.
- if you know that a semester (or year) ended, and you made good backups (with logs) corresponding at this ended period of time (or course by course, or the whole plateform), you can delete corresponding logs in live platform for these courses
- that would allow to keep only current logs for current semester courses, and also to keep indefinitly (or 1000 days) logs for other specials courses you don't want to lose logs (or have them spliced in several backups).
What i think should be done :
- create a new capability (something like moodle/course:resetlogs ?) allowing to delete logs when reseting a course
- the risk (that was the base to open MDL-43274) would be a teacher deleting logs, with impossibility to understand what happened before
- so this capability should be unset for teachers, but would allow administrator (and managers ?) to deletes logs when resetting courses.
That would allow Administrator to delete these (old) logs (with benefits it can make), and keep security about teachers actions (with benefits it can have).
What others think about that?
I was inspired today and here goes a plugin that does what you want.
Supports Moodle 3.3+
After install go to the plugin global settings page and enable deletion. New capability is added that handles who can or can not delete logs.
Any input is welcome.
Sorry for the late answer, and thanks a lot for your little plugin, it makes the job
A detail : according to general wording of capabilities, i'd rather replace "Gives abillity to the user to delete course logs during reset." by "Delete course logs during course reset"
Precision for other people reading : the new capability allowing deletion of logs (when resetting courses) is enabled to Manager (only) by default. And you have to enable deletion in plugin settings for the deletion of logs to be made.
I also think that logs should be deleted at the last moment, letting (only) "Course reset ended" (or nothing) in logs. Perhaps as a second option (delete reset logs)?
In fact, when i opened this discussion, i hoped to have several people discussing what should be done.
I didn't expect a direct solution ; but i'm glad you provided one so quicky!
I still wonder if i shouldn't open a tracker issue to discuss that, and find the better (long term) way to handle this, in core.
Having an ad-hoc task could be a good solution, allowing to perform course reset quickly, and handle log removing (a little) later.