moosh icon indicating copy to clipboard operation
moosh copied to clipboard

Feature request: backup only when course hasn't changed

Open Richardvi opened this issue 1 year ago • 8 comments

Feature request for Moosh :)

We are using Moosh to backup our courses in Moodle. However, we need to do a full backup of all courses every night. It would be so useful if we could set this like in Moodle, to only create backups if the course has changed since last backup (or: since X days)

Hope this will be possible in a future version!

Thanks for your excellent work,

Richard.

Richardvi avatar Feb 09 '24 15:02 Richardvi

Very interesting idea. It could be implemented as a separate command so it could be used in other context. Something like: moosh course-changed 7 --since=1d

Practically it will be difficult to do it reliably - as each plugin may cause some change in the course. We could try to do it less-reliably, ie by reviewing course logs (was there any change there). I'm not sure if that would capture everything - it may be worth testing.

If you can come up with a list of checks that such a command should do, then I could perhaps implement it.

tmuras avatar Feb 18 '24 13:02 tmuras

I was also thinking about the logs of that course, but I can tell you now that our logs are HUGE.

I don't know if there's another way to check if a course has been altered. If we do a full backup, we also need to check the uploads in assignments of students for example.

Probably the only reliable way is to check the 'participants last visited course'. If no one has visited the course the last 24 hours, a daily backup is not needed.

Richardvi avatar Feb 19 '24 16:02 Richardvi

So maybe moosh last-visited 7 where 7 is a course ID. That would return the number of hours since the course was last visited. Would you then be able to script around it and get what you need?

tmuras avatar Mar 18 '24 16:03 tmuras

Absolutely, that would be awesome. We are now running a full backup of all 18k courses, which takes 96 hours. If we could filter the courses that are not changed, we could speed up the process and in case of emergency have a more recent backup available.

Thanks!

Richardvi avatar Mar 18 '24 17:03 Richardvi

Hi !

How about a deal? I will write the new command and you'll let us all know how do you use it. Ie you will create a (written) section for the website: https://moosh-online.com/tutorials (source: https://github.com/tmuras/moosh/blob/master/www/tutorials/index.md ) about how can those commands be used for course backup.

Have a nice day :)

tmuras avatar Mar 22 '24 06:03 tmuras

YES, deal accepted!

Our server admin can report on how he no longer uses Moodle's autobackup feature, but how Moosh will be used, what the beneftis are, etc. I can even ask him to share some of the scripts he uses to autobackup our entire Moodle site nightly (which has around 18.000 courses I think)

We have a fabulous use-case I think which can support many others.

Richardvi avatar Mar 22 '24 08:03 Richardvi

All right so! Could you please install new version 1.19 and check this one: https://moosh-online.com/commands/#course-last-visited

tmuras avatar Mar 23 '24 11:03 tmuras

I have not forgotten you, just got sick. I will still pick this up, thanks!

Richardvi avatar Apr 10 '24 09:04 Richardvi