How to build the missing "FORMATDATA" converter for course format additional data from Moodle 1.9 to 2.x

Tech track of exploration

by Valery Fremaux -
Number of replies: 1
Picture of Plugin developers

Seems being a quite weird thing after internal exploration : 

Moodle 2 standard format backup process stores format data information into the course/course.xml file. This is noticeable by a plugin_format_<formatname>_course subhierarchy in the course.xml flow.

this file is produced by the moodle1_course_header_handler class when scheduled by the Moodle XML Parser, but is closed when the last closing <HEADER> xml tag is found in original XML, that is : before format data come to be avaiable. 

so there seems being a structural impossibility to process and merge this information unless delaying the course.xml construction to a very late instant (f.e. : on COURSE closing tag at the end of the parsing). Fortunately I could watch that the course.xml content was made one shot from a $this->course hierarchical structure, built by the handler. Unfortunately did not found already where and how to plug code to :

- delay the actual production of the course.xml content file

- collect and parse at the most accurate moment the formatdata information

- be capable to append the collected data to the course structure/.

more news later.....

In reply to Valery Fremaux

Re: Tech track of exploration

by Valery Fremaux -
Picture of Plugin developers

News of the quest....

After long delay seeking for inspiration, and coming back upon the work, there is at the moment no way to get out without restructuring the Moodle1 converter implementation : 

the Moodle converter process is a simple SAX sequential progressive parsing of the moodle.xml original file, then progressively recomposing a moodle 2 storage backup architecture. 

but the core converter did not implement any after_parse() seek back function, so we have in moodle 2 restore plan to make late consolidation processing on restored data. Such a late post processing could solve the course format issue, by post-injecting the course format xml converted sequence into the course/course.xml file. 

I'm up to prototype such changes as experimentation, and will provide some results in Moodle Tracker if succeeds...