Course/file transfer between Moodle sites?

Course/file transfer between Moodle sites?

by Howard Miller -
Number of replies: 16
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Has anybody encountered anything that transfers files between Moodle sites in some way? I actually want to transfer whole courses but I'm happy to settle for backup files. 

As the files are potentially larger than the file upload limit there's clearly a challenge with the underlying mechanism. 

Anyway, before writing something I thought I'd ask if anybody had accomplished anything like this. 
Average of ratings: -
In reply to Howard Miller

Re: Course/file transfer between Moodle sites?

by Ken Task -
Picture of Particularly helpful Moodlers
Well, am shocked!   Uhhh ... shouldn't this question be asked in developers?

The entire site or just some courses?

A 'po man's [non-programmer]' way might be (factors depending):

entire site ... if one has cli, rsync moodledata/filedir to moodle to migrate to's moodledata/filedir/

On server you are migrating from:  got cli? could you setup a mount point that is really in moodle to migrate to's file system repo called xfer?   Then run autobackp - full backup or no user backups to that mount point.

Either of those would by pass upload limits on server to migrate to if one has the space.

Sooo .... maybe one of above? smile

'SoS', Ken


In reply to Ken Task

Re: Course/file transfer between Moodle sites?

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
I probably wasn't clear. This is an end-user thing . It's not about migrating.

"Send my course to 'some other Moodle site'"
In reply to Howard Miller

Re: Course/file transfer between Moodle sites?

by Ken Task -
Picture of Particularly helpful Moodlers
Was looking for something else in Moodle plugins and found the following:

Course Archiver
https://moodle.org/plugins/tool_coursearchiver
Release 4.0.1 (Build: 2016090200)
Moodle 2.8, 2.9, 3.0, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9, 3.10, 3.11, 4.0

List course files
https://moodle.org/plugins/local_listcoursefiles
This extension allows teachers to view a list of all files in a course and to change the license for each file. It is also possible to download the files in a ZIP archive.
Moodle 3.9, 3.10, 3.11, 4.0

Maybe one of the above fits what you seek - or could be modified to suit.

'SoS', Ken

In reply to Ken Task

Re: Course/file transfer between Moodle sites?

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Yeh - it's not a big deal to create a backup and download the file, obviously.

However, if the file is big then you're in trouble. It's going to be slow to upload again (especially from a "home" network) and it may be exceed the upload limit. So, I need something that cuts out that step.

I don't mind writing it, but there was no point if someone already had a solution.
In reply to Howard Miller

Re: Course/file transfer between Moodle sites?

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
Hi Howard

I know, you've looked at this low-tech solution. Still documenting here for the benefit of the random visitor.

The Moodle https://docs.moodle.org/en/File_system_repository offers a possible simple solution:
- Set up the source Moodle to auto backup courses to a specified directory (Site administration Courses Backups Automated backup setup | Automated backup storage: Specified directory for automated backups).

- Sync this directory to a file system repository in the target Moodle. A slow scripted sync with something like rsync will do. Now those who want to restore these courses have direct access to the mbz files in the file picker. Even this step could be scripted if there is a pattern.
In reply to Visvanath Ratnaweera

Re: Course/file transfer between Moodle sites?

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
The only problem I can see with that is that it wouldn't work for individual backups. My site has approx 35,000 courses so I'm not keen to run automated backup.
In reply to Howard Miller

Re: Course/file transfer between Moodle sites?

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
Ha, ha, ha! The "only" problem. I didn't know that this is for your monster site. But I remember you have dedicated a node for the cron job. That one might be able to handle the automated backups too - or not. Anyway, I don't have to tell you about the hiccups automated backups get. I have automated backups running _daily_ on a site with 2,500 courses. But on the average only about 200 change daily. Exactly those are the ones which swell weekly. That on a all-in-one box, but admittedly a huge one. The process complains about unfinished backups a couple of days and then finishes. That doesn't worry us, these are really backups, not needed unless there is an incident. How "current" your backups need to be?

About the end-users: This one is. Because teachers have the full autonomy on their courses. So, they select the mbz in the file-picker and restore. The problem is, apart from a grinding server, they will see all the backups. How selective your handover should be?

In reply to Howard Miller

Re: Course/file transfer between Moodle sites?

by Ken Task -
Picture of Particularly helpful Moodlers
Man, was I 'off' ... that's a lot of courses!!!

So concept is server -> server - not down then up again.   Boy do I agree with that!  

In that case, rsync as well as wget using a getlist of url's for the backup files.   In either case, the backup .mbz files have to exist.  And for 30000 one might need to run wget command in a nohup wrapper if you want them all with one shot!

However, from what has been shared about other, above would be 'plan b's' if the other is doable. smile

'SoS', Ken

In reply to Ken Task

Re: Course/file transfer between Moodle sites?

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Yeh - it's a matter of scale. The idea is actually that I want to be allow teachers to test their courses on the next version of Moodle. It'll be, at most, a few hundred that are interested. So I don't need or want to make all those courses available. I just want them to select their own courses as an "opt in".

I then have the technical issue of getting the course over onto a completely different Moodle on a different server.
In reply to Howard Miller

Re: Course/file transfer between Moodle sites?

by Justin Hunt -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers
I use a piggy back off the Moodle NET feature to tell the target Moodle to pull from a backup file located on S3. I am a bit scared to mention it here in case somebody locks the feature down.
You can try it here. Visit the page, and click on the "Send to Poodll NET" button (it actually works with any Moodle site). Then enter your Moodle site url and it should start restoring the course there.
https://russell.poodll.com/course/view.php?id=14

It uses a Generico (or Poodll) widget to make the button from some S3 links. If you think you can use it I will post it here
In reply to Justin Hunt

Re: Course/file transfer between Moodle sites?

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
Hi Justin

I use https://docs.moodle.org/en/MNet to login to many Moodle sites with the credentials of one (id provider) site. Taking a whole course to the target with me is magic! Would love to know the trick.

Well, only if it can be done in the conventional (VPS, dedicated) server world. I won't enter the Amazon just for that.
;)
In reply to Justin Hunt

Re: Course/file transfer between Moodle sites?

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
I'd heard "moodle.net" mentioned but hadn't (I must confess) the slightest idea what it was or what it did.

I am now tempted so set up a local instance to see if it does anything useful. Unless I've missed something, the documentation is vague.
In reply to Howard Miller

Re: Course/file transfer between Moodle sites?

by Justin Hunt -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers
I thought Moodle.net was the bomb !?

All the widget does is make a special POST request to the target server's Moodle.net client. Instead of fetching and restoring the file from Moodle.net it fetches it from whatever you added when you put the widget on the page. It could be any URL, not necessarily on S3.
In reply to Justin Hunt

Re: Course/file transfer between Moodle sites?

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
No idea - I'm struggling to find anything terribly useful about it.
In reply to Howard Miller

Re: Course/file transfer between Moodle sites?

by Lexy Walker -
If I worked with you, I'd probably volunteer to take that off your plate and write a horrible Bash script that took a CSV of course IDs, used moosh to generate .mbz files for each of them, used rsync or scp to copy them to a different server, then use another Bash script with a for filename in *.mbz loop to restore them.

But that's because I'm a maniac who uses Bash and/or Node to do terrible things.