Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

Provides support for the conversion of moodle1 backup to the moodle2 format

Copyright: 2011 Andrew Davis <andrew@moodle.com>
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 306 lines (13 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

moodle1_mod_resource_handler:: (4 methods):
  get_paths()
  process_resource()
  on_resource_end()
  get_successor()


Class: moodle1_mod_resource_handler  - X-Ref

Resource conversion handler

get_paths()   X-Ref
Declare the paths in moodle.xml we are able to convert

The method returns list of {@link convert_path} instances.
For each path returned, the corresponding conversion method must be
defined.

Note that the paths /MOODLE_BACKUP/COURSE/MODULES/MOD/RESOURCE do not
actually exist in the file. The last element with the module name was
appended by the moodle1_converter class.

return: array of {@link convert_path} instances

process_resource(array $data, array $raw)   X-Ref
Converts /MOODLE_BACKUP/COURSE/MODULES/MOD/RESOURCE data

This methods detects the resource type and eventually re-dispatches it to the
corresponding resource successor (url, forum, page, imscp).

on_resource_end(array $data)   X-Ref
Give succesors a chance to finish their job


get_successor($type, $reference)   X-Ref
Returns the handler of the new 2.0 mod type according the given type of the legacy 1.9 resource

param: string $type the value of the 'type' field in 1.9 resource
param: string $reference a file path. Necessary to differentiate files from web URLs
return: null|moodle1_mod_handler the instance of the handler, or null if the type does not have a successor