General developer forum

Resetting courses (doesn't) delete logs

 
C'est moi :-)
Resetting courses (doesn't) delete logs
Documentation writersParticularly helpful MoodlersTestersTranslators

Hi,

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.

After digging, i see it's indicated in the course reset documentation, and it's the case since Moodle 2.7.1 (via MDL-43274).

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?
Séverin

 
Average of ratings: -
Picture of Patrick Lemaire
Re: Resetting courses (doesn't) delete logs
Particularly helpful Moodlers

Great idea this new capability!

Indeed, the logs are useful for us to trace past actions especially for the eyes of the law. But we also have a duty not to reveal sensitive traces! And there are plenty of good arguments that you point out here.

Patrick

 
Average of ratings: -
Picture of Darko Miletić
Re: Resetting courses (doesn't) delete logs
Core developersParticularly helpful Moodlers

I was inspired today and here goes a plugin that does what you want.

https://github.com/kiklop74/moodle-local_courselog

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.



 
Average of ratings: Useful (3)
Picture of Patrick Lemaire
Re: Resetting courses (doesn't) delete logs
Particularly helpful Moodlers

Sounds like you are amazing, Darko Yes

 
Average of ratings: Useful (1)
C'est moi :-)
Re: Resetting courses (doesn't) delete logs
Documentation writersParticularly helpful MoodlersTestersTranslators

Hi Darko,

Sorry for the late answer, and thanks a lot for your little plugin, it makes the job smile

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 see a risk : the Admin always having all capabilities, admin making course reset will always delete logs (if setting enable). The ability existing before Moodle 2.7.1 was better i think, always letting choice, when reseting a course, to choose if logs should be reset (or not).

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)?

Séverin
 
Average of ratings: Useful (1)
Picture of Darko Miletić
Re: Resetting courses (doesn't) delete logs
Core developersParticularly helpful Moodlers

Thanks for the input. The issue with leftovers in the log table is result of using the course deleted event. Unfortunately things happen after that event is issued. I could add some ad-hoc task but it complicates the issue...

 
Average of ratings: -
C'est moi :-)
Re: Resetting courses (doesn't) delete logs
Documentation writersParticularly helpful MoodlersTestersTranslators

Hi Darko,

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.

Séverin

 
Average of ratings: -
C'est moi :-)
Re: Resetting courses (doesn't) delete logs
Documentation writersParticularly helpful MoodlersTestersTranslators
Hi,

I've created MDL-63557 about that.

Don't hesitate to vote/comment.

Séverin
 
Average of ratings: -