Provides various functionality via its static methods.
More...
|
static | available_converters ($restore=true) |
| Returns the list of all available converters and loads their classes. More...
|
|
static | detect_moodle2_format ($tempdir) |
| Detects if the given folder contains an unpacked moodle2 backup. More...
|
|
static | export_converter_dependencies ($converter, $dependency) |
|
static | generate_id ($entropy) |
|
static | get_inforef ($contextid) |
|
static | set_inforef ($contextid) |
| Inserts an inforef into the conversion temp table.
|
|
static | to_moodle2_format ($tempdir, $format=null, $logger=null) |
| Converts the given directory with the backup into moodle2 format. More...
|
|
Provides various functionality via its static methods.
◆ available_converters()
static convert_helper::available_converters |
( |
|
$restore = true | ) |
|
|
static |
Returns the list of all available converters and loads their classes.
Converter must be installed as a directory in backup/converter/ and its method is_available() must return true to get to the list.
- See also
- base_converter::is_available()
- Return values
-
◆ choose_conversion_path()
static convert_helper::choose_conversion_path |
( |
|
$format, |
|
|
array |
$descriptions |
|
) |
| |
|
staticprotected |
end of public API //////////////////////////////////////////////////////
Choose the best conversion path for the given format
Given the source format and the list of available converters and their properties, this methods picks the most effective way how to convert the source format into the target moodle2 format. The method returns a list of converters that should be called, in order.
This implementation uses Dijkstra's algorithm to find the shortest way through the oriented graph.
- See also
- http://en.wikipedia.org/wiki/Dijkstra's_algorithm
- Author
- David Mudrak david.nosp@m.@moo.nosp@m.dle.c.nosp@m.om
- Parameters
-
string | $format | the source backup format, one of backup::FORMAT_xxx |
array | $descriptions | list of base_converter::description() indexed by the converter name |
- Return values
-
array | ordered list of converter names to call (may be empty if not reachable) |
◆ detect_moodle2_format()
static convert_helper::detect_moodle2_format |
( |
|
$tempdir | ) |
|
|
static |
Detects if the given folder contains an unpacked moodle2 backup.
- Parameters
-
string | $tempdir | the name of the backup directory |
- Return values
-
boolean | true if moodle2 format detected, false otherwise |
◆ generate_id()
static convert_helper::generate_id |
( |
|
$entropy | ) |
|
|
static |
◆ to_moodle2_format()
static convert_helper::to_moodle2_format |
( |
|
$tempdir, |
|
|
|
$format = null , |
|
|
|
$logger = null |
|
) |
| |
|
static |
Converts the given directory with the backup into moodle2 format.
- Parameters
-
string | $tempdir | The directory to convert |
string | $format | The current format, if already detected |
| base_logger|null | if the conversion should be logged, use this logger |
- Exceptions
-
- Return values
-
bool | false if unable to find the conversion path, true otherwise |
The documentation for this class was generated from the following file: