-
Bug
-
Resolution: Won't Fix
-
Trivial
-
None
-
1.9.17, 2.0.5, 2.1.2, 2.2, 2.2.5
-
MOODLE_19_STABLE, MOODLE_20_STABLE, MOODLE_21_STABLE, MOODLE_22_STABLE
-
MDL-32205-course-formats
MDL-22414 added the ability to convert courses from Moodle 1.9 to 2.x which is documented on 'http://docs.moodle.org/dev/Backup_1.9_conversion_for_developers'. It is possible to create Moodle 1.9 backup code that puts XML tags within the 'FORMATDATA' tag of the 'moodle.xml' file and in Moodle 2.x do the same by extending the 'backup_format_plugin' class.
However, the method 'get_handlers' within the file '/backup/converter/moodle1/handlerlib.php' does not have the line:
$handlers = array_merge($handlers, self::get_plugin_handlers('format', $converter));
|
to facilitate the inclusion of any 'lib.php' files in /course/format/format_name/backup/moodle1' which would then extend the 'moodle1_xml_handler' class and then facilitate the invocation of the 'get_paths()' method.
My Moodle 1.9 and 2.x backup code can be seen at 'https://github.com/gjb2048/moodle-format_topcoll/tree/MOODLE_22/backup' for reference. And when the above line of code is added and the 'lib.php' file is created in the 'moodle1' folder containing:
defined('MOODLE_INTERNAL') || die();
|
|
class moodle1_format_topcoll_handler extends moodle1_xml_handler {
|
|
/**
|
* Declare the paths in moodle.xml we are able to convert
|
*/
|
public function get_paths() {
|
return array(
|
new convert_path('layout', '/MOODLE_BACKUP/COURSE/FORMATDATA/LAYOUT')
|
);
|
}
|
|
/**
|
* This is executed every time we have one /MOODLE_BACKUP/COURSE/FORMATDATA/LAYOUT
|
* data available
|
*/
|
public function process_layout($data) {
|
print_object($data);
|
}
|
}
|
Then the function 'process_layout' is executed when restoring a Collapsed Topics course format course. I will attach a sample Moodle 1.9 file to use for reproducing.
- blocks
-
CONTRIB-3534 error in import course-elements
-
- Closed
-
-
CONTRIB-3552 No Moodle 1.9 to 2.x conversion code for Collapsed Topics
-
- Closed
-
- has a non-specific relationship to
-
MDL-22414 META: Restore 1.9 backups into Moodle 2.1 (phase 1)
-
- Closed
-
- is blocked by
-
MDL-37893 PHP error when parsing XML backup and the grouped element contains no final elements
-
- Closed
-