Backup course in Moodle v1.9 and restore in Moodle v3.4

Backup course in Moodle v1.9 and restore in Moodle v3.4

by Konrad Lorinczi -
Number of replies: 6
I would like to make possible our teachers to migrate seamlessly their Moodle v1.9 courses to our new Moodle v3.4 site.
Both Moodle v1.9 and Moodle v3.4 sites are on the same server.

So where should I backup a Moodle v1.9 course, so a Moodle v3.4 teacher to be able to pick up and restore?


I'm looking for the easiest solution, but I don't mind to do some custom changes in the code, if needed.


Thanks,

Konrad

Average of ratings: -
In reply to Konrad Lorinczi

Re: Backup course in Moodle v1.9 and restore in Moodle v3.4

by Ken Task -
Picture of Particularly helpful Moodlers

If you are expecting the 1.9.x backups with users to come in cleanly to your 3.4.x, not sure that's possible. 

Every 1.9.x course restored will not include users.  

The files in the restored 3.4 course will be under 'Legacy' and not the 'typical' file system and once in Legacy it will be in Legacy for ever. 

Plus, if there were any addons (mods/blocks) in the 1.9 courses that do NOT have a compatible version for 3.4, those also won't restore ... matter of fact, those might actually stop a restore dead cold in it's tracks.

OR are you asking how to program it so teachers can restore their 1.9.x course backups into the 3.4.x site? without  such issues as above?

Getting 1.9.x backups to an area that 3.4 site see isn't a problem ...

in the 3.4.x moodle, setup a file system repository.   Then, In the data directory for 3.4.x, cd moodle34data/repository ... at this point you have options ...

you could create a symlink per teacher's 1.9.x backup directory from the 3.4.x  repository

or just one for all teachers to navigate. 

OR you could copy all the moodle19data/##/backup/backup.zip files (where ## is the course ID for the teachers courses) to the 3.4's moodle34data/repository/19courses/ directory.

Use one course in the 3.4 called restores ... all teachers have access to it.  New Categories have to exist in the 3.4 already, but teachers could  use the 'restores' course, restore, navigate to their 1.9 backup zip, and attempt to restore to their category a new course.

Just remember, after doing all that (which ever method chosen), you, the admin, will have to deal with things like broken links etc. and all the issues such a project would bring over/across, etc. from that time forward.

You might want to contact the user at this posting:

https://moodle.org/mod/forum/discuss.php?d=375598#p1514360

and ask how it's going with Moodle Legacy files in a site that was migrated from a 1.9 many many years ago ... course backups and restores have issues now related to Legacy files.

To be honest ... think it best to start with a fresh 3.5.x and have teachers rebuild courses ... they will have to learn the new anyway.

2 cent opinion from one who has migrated 1.9 sites, used 1.9 backups to restore to 2.x's, and tried other things .... like a 'command line poof' to rid 2.x/3.x sites from just Legacy files.

'spirit of sharing', Ken


Average of ratings: Useful (1)
In reply to Ken Task

Re: Backup course in Moodle v1.9 and restore in Moodle v3.4

by Konrad Lorinczi -

Thank you for your ideas!


> "If you are expecting the 1.9.x backups with users to come in cleanly to your 3.4.x, not sure that's possible. "
I just want to import Moodle v1.9 course content, without users.


> "The files in the restored 3.4 course will be under 'Legacy' and not the 'typical' file system and once in Legacy it will be in Legacy for ever. "
That's bad news. However I can not force teachers to recreate their courses.


>"Plus, if there were any addons (mods/blocks) in the 1.9 courses that do NOT have a compatible version for 3.4, those also won't restore ... matter of fact, those might actually stop a restore dead cold in it's tracks."
I'm PHP developer, I will solve incompatibility problems, I hope smile


> "Getting 1.9.x backups to an area that 3.4 site see isn't a problem ..."
This is good news smile


> "in the 3.4.x moodle, setup a file system repository.   Then, In the data directory for 3.4.x, cd moodle34data/repository ... at this point you have options ... you could create a symlink per teacher's 1.9.x backup directory from the 3.4.x  repository or just one for all teachers to navigate. OR you could copy all the moodle19data/##/backup/backup.zip files (where ## is the course ID for the teachers courses) to the 3.4's moodle34data/repository/19courses/ directory."
Well, per teacher solution is not good. I'd rather copy or symlink a Moodle v1.9 backup file of a course to a backup area of Moodle v3.4, so any teacher of the course could see and import it.


Anyway I'm shocked, that if a data is available in Moodle v1.9 backup file, can not restored, imported, processed in Moodle v3.x correctly, without data loss. Backward compatibility should be a basic thing, which is not kept in this case of Moodle. IMO, this is just a lack of feature, which was not implemented into the import/restore process, as it should...


Thanks for the ideas, I will test how can I solve it the in the most practical way.

In reply to Konrad Lorinczi

Re: Backup course in Moodle v1.9 and restore in Moodle v3.4

by Ken Task -
Picture of Particularly helpful Moodlers

'backward compatibility' is and has always had limited life/usefulness going forward - in any technology ... step back a minute and think about that ... not an M$ person, but .... is Edge the same as IE?  Is Windows XP the same as Windows X?   How many smartphones have you had in the last 5 years?   If you were unfortunate enough to decide on a Windows Smart Phone, can you get updates?  Same thing ... did you buy a Zune?

Anyone have 5 1/4 floppies any more?   How about 3.5's?

Just sayin'! smile

'spirit of sharing', Ken




In reply to Ken Task

Re: Backup course in Moodle v1.9 and restore in Moodle v3.4

by Konrad Lorinczi -

I would like to avoid the teachers seeing the backup of others. Keep security in mind.

1) Teacher Joe logged in Moodle v1.9 makes backup of "Course AAA".

2) Teacher Joe login to Moodle v3.4 (or v3.5), goes to course "Course AAA", then should be able to open a local repository (backup directory of Course AAA in Moodle v1.9 ) select the source backup file and start restoring to Moodle v3.4.


Basically I should develop a repository, which:

- finds the "Course AAA" directory of Moodle v1.9 (reading from Moodle v1.9 config.php)
- copies backup_Course_AAA.zip to repository of "Course AAA" in Moodle v3.4
- shows a link to Start restoring the backup into Moodle v3.4


Other development solution would be to use web services:

- from Moodle v3.4 initiate a remote backup execution using web services
   (https://docs.moodle.org/19/en/Web_Services:OK_Tech_Web_Services,
   https://www.moodlenews.com/2018/restore-courses-from-remote-moodles-with-this-plugin/)
- create remote function remote_backup() to initiate the backup process in Moodle v1.9
- create remote function remote_copy_backup2common() to copy new backup file to a common place with common name in Moodle v1.9
- create remote function remote_move_common2repo() to move backup file to a Moodle v3.4 repository
- then remote execute 
   - function remote_backup($course_id),
   - function remote_copy_backup2common($course_id, 'common.zip'), 
   - function remote_move_common2repo('common.zip').
- display backup file in Moodle v3.4 repo so teacher can restore.


Opinion?


In reply to Konrad Lorinczi

Re: Backup course in Moodle v1.9 and restore in Moodle v3.4

by Ken Task -
Picture of Particularly helpful Moodlers

The link to the OKTech plugin for 1.9 web services ended with this:

"This will be done at the pace of an old man, two years away from retirement and extremely busy with his two grand-children wink"

and that was how long ago?

What's your timeline for accomplishing this?

And ... hyper-jumping a 1.9.x backup to a 3.4.x (which is one version behind latest and greatest), me thinks will be interesting ... depending upon what mods/blocks/addons were used in ***each*** course as I think you'll have to address 'stuff' **one course at a time**

Think I'd do some testing prior to any programming ...

First, find the largest backup file in the 1.9.   There's NO Moodle GUI tool for that I don't think ...  you'll have to resort to command line guru stuff like ls -l moodledata/?????/backup/backup*.zip ... the ????? is the course ID number ... each course having a directory of it's own.

Once that is found ... xfer it or position it in a file system repo of the 3.4 where a teacher could see and use it.

Try that restore.

Second, find the course that has the largest number of Quizzes in it.   For that you might have to use moosh or some guru MySQL query.    Why Quiz?   It's the heaviest when it comes to processing.

Try that restore.

Not trying to discourage, just know that what you are proposing would be a something that even Moodle Partners might not take on.

There ya have my 2 cent opinion .... how about any Moodle Partner here in community la-la-land?   What say you?

'spirit of sharing', Ken



In reply to Ken Task

Re: Backup course in Moodle v1.9 and restore in Moodle v3.4

by Konrad Lorinczi -

I was able to connect my Moodle v3.4 to Moodle v1.9 using the OKTech web services.
First test was to retrieve the courses of my Moodle v1.9 user.

SUCCESS!

I think, this way I can communicate between the two systems, so I can 
- in Moodle v3.4 I can initiate backup process remotely in Moodle v1.9
- check if the backup process was finished?  (not sure yet, how I will check this...)
- check if the resulted backup filename exists
- move resulted backup file to Moodle v3.4 filesystem repository

I hope I will get it work.