As part of the incremental Backup work for the OU, I did some work on a new method for restoring courses.
Currently, when restoring a course backup, we can "Restore to a new Course", "Restore to an existing course, Adding data to it" or "Restore to an existing Course, deleting all data first"
For the Incremental Backups, we needed an option that Restores to an existing course, updating the data.
To do this, it uses a new table called "backup_guids" and each row in a module table gets assigned a sha1 – for example, a forum course module gets a GUID/Sha1 based on the site identifier, the module type(forum), the id from the course modules table, and the instance of the module(which will generate a unique identifier for the record), forums also get GUIDS for Discussions and Posts so they can all be updated. - this "GUID" is also stored in the backup file like this:
<MOD>
<GUID>fd6d7a3001806017859a7b4268117fca72c0f0b1</GUID>
<ID>20</ID>
<TYPE>forum</TYPE>
or:
<DISCUSSION>
<GUID>b287d1bc19d819285130d7ca5032d78f1bb0b40a</GUID>
<ID>7</ID>
<NAME>test news 1</NAME>
or:
<POST>
<GUID>7fe51117317b46d92263264c537e144443437e0e</GUID>
<ID>10</ID><POST>
so when this is restored - it checks the GUID in the restore file against the GUIDS in the backup_guids table for this course, and if they're the same - it updates the existing object without duplicating data.
This could have some interesting use-case's such as the ability to update a course previously downloaded from a learning repository - for example someone could have a modified version of the demo course from demo.moodle.org with some extra stuff added. They could update their local course and get the new stuff from the demo course, without deleting any of their own additions or duplicating data.
I'd quite like to get this into Moodle 2.0 - any feedback?
Thanks!
:-)
Dan
In reply to Dan Marsden
Re: Proposed new Restore type - Update existing course
Christopher Phillips གིས-
Dan-
I was excited to see this post as I am in need of this exact solution for a project I am working on. Can you provide any more details on how this was implemented?
I was excited to see this post as I am in need of this exact solution for a project I am working on. Can you provide any more details on how this was implemented?
In reply to Christopher Phillips
Re: Proposed new Restore type - Update existing course
Dan Marsden གིས-
Hi Christopher - you can get the full code out of our git repo here: http://git.catalyst.net.nz/gw?p=moodle-r2.git;a=shortlog;h=refs/heads/mdl19-incrementalbackup
but it also includes some other stuff for offline Moodle.
but it also includes some other stuff for offline Moodle.
Thanks for starting this post Dan. We'll soon have this option available in our VLE at the OU and already we're finding uses for it. for example we're involved in pilot work on some courses and we're considering creating a duplicate course and keeping it to date using this feature. This enables us to separate the pilot from the live version while using the live VLE features.
It also has the potential to massively reduce the space required for backups when you need to be able to restore to a specified date for any reason.
We're also working with other institutions that are unable to provide direct access to our VLE. This solution makes it much easier to provide our courses on their in house moodle and keep them updated as courses progress.
A little work has also been done to improve the reliability of the backup process and make it easier to track down bugs when they occur.
So I'd really like to see this feature get added to core as soon as possible. Not only to make backup that bit more reliable but to support additional functionality not currently available.
It also has the potential to massively reduce the space required for backups when you need to be able to restore to a specified date for any reason.
We're also working with other institutions that are unable to provide direct access to our VLE. This solution makes it much easier to provide our courses on their in house moodle and keep them updated as courses progress.
A little work has also been done to improve the reliability of the backup process and make it easier to track down bugs when they occur.
So I'd really like to see this feature get added to core as soon as possible. Not only to make backup that bit more reliable but to support additional functionality not currently available.