|
Moodle
2.2.1
http://www.collinsharper.com
|


Public Member Functions | |
| __construct ($tempdir, $logger=null) | |
| set_logger ($logger) | |
| log ($message, $level, $a=null, $depth=null, $display=false) | |
| get_id () | |
| get_name () | |
| convert () | |
| get_workdir_path () | |
| get_tempdir_path () | |
Static Public Member Functions | |
| static | is_available () |
| public static methods ////////////////////////////////////////////////// | |
| static | detect_format ($tempdir) |
| static | description () |
Protected Member Functions | |
| init () | |
| end of public API ////////////////////////////////////////////////////// | |
| execute () | |
| create_workdir () | |
| replace_tempdir () | |
| destroy () | |
Protected Attributes | |
| $id | |
| $tempdir | |
| $workdir | |
| $logger = null | |
Base converter class
All Moodle backup converters are supposed to extend this base class.
| convert_exception |
Definition at line 38 of file convertlib.php.
| __construct | ( | $ | tempdir, |
| $ | logger = null |
||
| ) |
Constructor
| string | $tempdir | the relative path to the directory containing the unpacked backup to convert |
| null|base_logger | logger to use during the conversion |
Definition at line 58 of file convertlib.php.

| convert | ( | ) |
Converts the backup directory
Definition at line 121 of file convertlib.php.

| create_workdir | ( | ) | [protected] |
Prepares a new empty working directory
Definition at line 224 of file convertlib.php.


| static 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 in moodle1_converter, imscc11_converter, imscc1_converter, and imscc11_export_converter.
Definition at line 199 of file convertlib.php.
| destroy | ( | ) | [protected] |
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.
Definition at line 260 of file convertlib.php.


| static detect_format | ( | $ | tempdir | ) | [static] |
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.
| string | $tempdir | the name of the backup directory |
Reimplemented in moodle1_converter, imscc11_converter, and imscc1_converter.
Definition at line 187 of file convertlib.php.
| execute | ( | ) | [abstract, protected] |
Converts the contents of the tempdir into the target format in the workdir
Reimplemented in moodle1_converter, imscc11_converter, imscc1_converter, imscc11_export_converter, imscc1_export_converter, and moodle1_export_converter.

| get_id | ( | ) |
Get instance identifier
Definition at line 105 of file convertlib.php.

| get_name | ( | ) |
Get converter name
Definition at line 114 of file convertlib.php.

| get_tempdir_path | ( | ) |
Definition at line 156 of file convertlib.php.

| get_workdir_path | ( | ) |
Definition at line 147 of file convertlib.php.

| init | ( | ) | [protected] |
end of public API //////////////////////////////////////////////////////
Initialize the instance if needed, called by the constructor
Reimplemented in moodle1_converter.
Definition at line 213 of file convertlib.php.

| static is_available | ( | ) | [static] |
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.
Reimplemented in imscc1_export_converter, and moodle1_export_converter.
Definition at line 172 of file convertlib.php.
| 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
Implements loggable.
Reimplemented in moodle1_converter, imscc11_converter, and imscc1_converter.
Definition at line 94 of file convertlib.php.

| replace_tempdir | ( | ) | [protected] |
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.
Definition at line 238 of file convertlib.php.


| set_logger | ( | $ | logger | ) |
Sets the logger to use during the conversion
| null | base_logger | $logger |
Definition at line 75 of file convertlib.php.

$id [protected] |
Definition at line 41 of file convertlib.php.
$logger = null [protected] |
Definition at line 50 of file convertlib.php.
$tempdir [protected] |
Definition at line 44 of file convertlib.php.
$workdir [protected] |
Definition at line 47 of file convertlib.php.