Moodle APIs  3.8
Moodle 3.8.6 (Build: 20201109)
Static Public Member Functions | Static Protected Member Functions | List of all members
convert_helper Class Reference

Provides various functionality via its static methods. More...

Static Public Member Functions

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...
 

Static Protected Member Functions

static choose_conversion_path ($format, array $descriptions)
 end of public API ////////////////////////////////////////////////////// More...
 

Detailed Description

Provides various functionality via its static methods.

Member Function Documentation

◆ 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
arrayof strings

◆ 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$formatthe source backup format, one of backup::FORMAT_xxx
array$descriptionslist of base_converter::description() indexed by the converter name
Return values
arrayordered 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$tempdirthe name of the backup directory
Return values
booleantrue if moodle2 format detected, false otherwise

◆ generate_id()

static convert_helper::generate_id (   $entropy)
static
Parameters
string$entropy
Return values
stringrandom identifier

◆ 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$tempdirThe directory to convert
string$formatThe current format, if already detected
base_logger|nullif the conversion should be logged, use this logger
Exceptions
convert_helper_exception
Return values
boolfalse if unable to find the conversion path, true otherwise

The documentation for this class was generated from the following file: