The basic wrapper for question categories conversion

The QUESTION_CATEGORIES tag is optional in moodle.xml but the file
questions.xml is required by the moodle2 restore process. So here we
make sure that at least an empty file is created.
This commit is contained in:
David Mudrak
2011-05-18 14:33:05 +02:00
parent ba66847b71
commit c171d28ebc
+26
View File
@@ -50,6 +50,7 @@ abstract class moodle1_handlers_factory {
new moodle1_course_header_handler($converter),
new moodle1_course_outline_handler($converter),
new moodle1_roles_definition_handler($converter),
new moodle1_question_categories_handler($converter),
);
$handlers = array_merge($handlers, self::get_plugin_handlers('mod', $converter));
@@ -406,6 +407,14 @@ class moodle1_root_handler extends moodle1_xml_handler {
$this->xmlwriter->end_tag('moodle_backup');
$this->close_xml_writer();
// make sure that questions.xml has been generated as it is required
// by the restore process
if (!file_exists($this->converter->get_workdir_path().'/'.'questions.xml')) {
$this->open_xml_writer('questions.xml');
$this->write_xml('question_categories', array());
$this->close_xml_writer();
}
}
}
@@ -750,6 +759,23 @@ class moodle1_roles_definition_handler extends moodle1_xml_handler {
}
/**
* Handles the conversion of the defined roles
*/
class moodle1_question_categories_handler extends moodle1_xml_handler {
/**
* Where the roles are defined in the source moodle.xml
*/
public function get_paths() {
return array(new convert_path('question_categories', '/MOODLE_BACKUP/QUESTION_CATEGORIES'));
}
public function process_question_categories() {
}
}
/**
* Shared base class for activity modules and blocks handlers
*/