Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-32205

Missing format conversion support from Moodle 1.9 to Moodle 2.x

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: Trivial Trivial
    • None
    • 1.9.17, 2.0.5, 2.1.2, 2.2, 2.2.5
    • Backup

      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.

            Unassigned Unassigned
            gb2048 Gareth J Barnard
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.