Moodle PHP Documentation 4.2
Moodle 4.2.8 (Build: 20240610) (2d41ac46f45)
imscc11_export_converter Class Reference
Inheritance diagram for imscc11_export_converter:
base_converter loggable

Public Member Functions

 convert ()
 Converts the backup directory.
 
 get_id ()
 Get instance identifier.
 
 get_name ()
 Get converter name.
 
 get_tempdir_path ()
 
 get_workdir_path ()
 
 log ($message, $level, $a=null, $depth=null, $display=false)
 This function will be responsible for handling the params, and to call to the corresponding logger->process() once all modifications in params have been performed.
 
 set_logger ($logger)
 Sets the logger to use during the conversion.
 

Static Public Member Functions

static description ()
 Returns the basic information about the converter.
 
static detect_format ($tempdir)
 Detects the format of the backup directory.
 
static get_deps ()
 
static is_available ()
 public static methods //////////////////////////////////////////////////
 

Protected Member Functions

 create_workdir ()
 Prepares a new empty working directory.
 
 destroy ()
 Cleans up stuff after the execution.
 
 execute ()
 Converts the contents of the tempdir into the target format in the workdir.
 
 init ()
 end of public API //////////////////////////////////////////////////////
 
 replace_tempdir ()
 Replaces the source backup directory with the converted version.
 

Protected Attributes

string $id
 unique identifier of this converter instance
 
null base_logger $logger = null
 logger to use during the conversion
 
string $tempdir
 the name of the directory containing the unpacked backup being converted
 
string $workdir
 the name of the directory where the backup is converted to
 

Member Function Documentation

◆ description()

static imscc11_export_converter::description ( )
static

Returns the basic information about the converter.

The returned array must contain the following keys: 'from' - the supported source format, eg. backup\FORMAT_MOODLE1 'to' - the supported target format, eg. backup\FORMAT_MOODLE 'cost' - the cost of the conversion, non-negative non-zero integer

Reimplemented from base_converter.

◆ destroy()

base_converter::destroy ( )
protectedinherited

Cleans up stuff after the execution.

Note that we do not know if the execution was successful or not. An exception might have been thrown.

◆ detect_format()

static base_converter::detect_format ( $tempdir)
staticinherited

Detects the format of the backup directory.

Moodle 2.x format is being detected by the core itself. The converters are therefore supposed to detect the source format. Eventually, if the target format os not backup::FORMAT_MOODLE then they should be able to detect both source and target formats.

Parameters
string$tempdirthe name of the backup directory
Return values
null|stringnull if not recognized, backup\FORMAT_xxx otherwise

Reimplemented in imscc11_converter, imscc1_converter, and moodle1_converter.

◆ execute()

imscc11_export_converter::execute ( )
protected

Converts the contents of the tempdir into the target format in the workdir.

Reimplemented from base_converter.

◆ get_id()

base_converter::get_id ( )
inherited

Get instance identifier.

Return values
stringthe unique identifier of this converter instance

◆ get_name()

base_converter::get_name ( )
inherited

Get converter name.

Return values
stringthe system name of the converter

◆ get_tempdir_path()

base_converter::get_tempdir_path ( )
inherited
Return values
stringthe full path to the directory with the source backup

◆ get_workdir_path()

base_converter::get_workdir_path ( )
inherited
Return values
stringthe full path to the working directory

◆ init()

base_converter::init ( )
protectedinherited

end of public API //////////////////////////////////////////////////////

Initialize the instance if needed, called by the constructor

Reimplemented in moodle1_converter.

◆ is_available()

static base_converter::is_available ( )
staticinherited

public static methods //////////////////////////////////////////////////

Makes sure that this converter is available at this site

This is intended for eventual PHP extensions check, environment check etc. All checks that do not depend on actual backup data should be done here.

Return values
booleantrue if this converter should be considered as available

Reimplemented in imscc1_export_converter, and moodle1_export_converter.

◆ log()

base_converter::log ( $message,
$level,
$a = null,
$depth = null,
$display = false )
inherited

This function will be responsible for handling the params, and to call to the corresponding logger->process() once all modifications in params have been performed.

Implements loggable.

Reimplemented in imscc11_converter, imscc1_converter, and moodle1_converter.

◆ replace_tempdir()

base_converter::replace_tempdir ( )
protectedinherited

Replaces the source backup directory with the converted version.

If $CFG->keeptempdirectoriesonbackup is defined, the original source source backup directory is kept for debugging purposes.

◆ set_logger()

base_converter::set_logger ( $logger)
inherited

Sets the logger to use during the conversion.

Parameters
null | base_logger$logger

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