Delete old courses

Delete old courses

Leandro De Mestico -
Колькасьць адказаў: 3

Hi,

I have a 170GB DB and need to delete all course without activity since 2 years ago. I can get a list from mysql, but I need a method to remove them safely from moodle (DB and mdata).

There is https://github.com/daparker26/moodle-cli-delete-courses/blob/master/delete_courses.php but is from 2015, and I have moodle 3.5, I prefer to listen to other suggestions.


Thanks!

Сярэдняе рэйтынгаў: -
У адказ на Leandro De Mestico

Re: Delete old courses

Daniel Thies -
Выява Core developers Выява Plugin developers Выява Testers

Look at moosh. It is currently maintained and includes that functionality.

У адказ на Leandro De Mestico

Re: Delete old courses

Séverin Terrier -
Выява Documentation writers Выява Particularly helpful Moodlers Выява Testers Выява Translators

Hi Leandro,

Just a note to let you know one thing, perhaps (very) important for you : when deleting a course in Moodle (not sure about moosh or other plugins), logs for this course are not deleted.

They are only deleted by the dedicated scheduled task, if you defined a retention time. If configured to keep indefinetly, you still have logs about old and deleted courses (and it can sometimes take a lot of place in DB).

You can also have old backups taking much disk place...

HTH,
Séverin