Quantcast
Channel: Backup and restore
Viewing all articles
Browse latest Browse all 6815

MBZ specification details

$
0
0
by Michael Simpson.  

Hello!

I've been trying to build a tool that turns a simple JSON structure into a valid MBZ that can be restored, thus building a skeleton course in moodle.

I've essentially been reverse engineering the mbz of a course I've backed up with just a couple of sections first, then later with a single lesson and some pages. From this I've established basics such as the moodle_backup.xml contains <sections> details pointing at a section id, title, and directory (sections/section_<id>). Within the sections/section_<id> folder we have inforef.xml (can basically be empty in my case) and section.xml which contains the section id again a section number starting from 0 (for first section) title, summary format, and sequence (which is a list of activity id's found within activities directory with subdirectory of <activitytype>_<activity id>)

Putting aside the activity for now, the mbz I've been able to generate is recognised as an mbz and correctly lists the sections and activities when using course restore in moodle. However upon restoration attempts (as a new course) I'm receiving the error : Duplicate entry '67-0' for key 'mdl_coursect_cousec_uix'. From what I understand, when restoring a course it does first create section 0 as a general section, but as this is being restored as a new course it should still restore my own section number 0 into the new created (restored) course.

I've been digging through the moodle_backup.xml settings details etc and for the life of me cannot figure out why it's failing. I have previously had it working before I started adding activities generation to the tool - so I'm not sure if it's something related to these or their supporting xml structures. But certainly if I use my template json with just sections, the course is generated correctly and restored correctly with those sections listed in my json.

There are a lot of moving parts to the mbz structure - but I've not been able to find any documentation on what parts are 100% required, what are only included based on settings within moodle_backup.xml etc..

Any ideas or help would be appreciated!

Thanks


Viewing all articles
Browse latest Browse all 6815

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>