See Release Notes
Long Term Support Release
Provides base converter classes
Copyright: | 2011 Mark Nielsen <mark@moodlerooms.com> |
License: | http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
File Size: | 289 lines (9 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
base_converter:: (15 methods):
__construct()
set_logger()
log()
get_id()
get_name()
convert()
get_workdir_path()
get_tempdir_path()
is_available()
detect_format()
description()
init()
create_workdir()
replace_tempdir()
destroy()
convert_exception:: (1 method):
__construct()
Class: base_converter - X-Ref
Base converter class__construct($tempdir, $logger = null) X-Ref |
Constructor param: string $tempdir the relative path to the directory containing the unpacked backup to convert param: null|base_logger logger to use during the conversion |
set_logger($logger) X-Ref |
Sets the logger to use during the conversion param: null|base_logger $logger |
log($message, $level, $a = null, $depth = null, $display = false) X-Ref |
If the logger was set for the converter, log the message If the $display is enabled, the spaces in the $message text are removed and the text is used as a string identifier in the core_backup language file. param: string $message message text param: int $level message level {@example backup::LOG_WARNING} param: null|mixed $a additional information param: null|int $depth the message depth param: bool $display whether the message should be sent to the output, too |
get_id() X-Ref |
Get instance identifier return: string the unique identifier of this converter instance |
get_name() X-Ref |
Get converter name return: string the system name of the converter |
convert() X-Ref |
Converts the backup directory |
get_workdir_path() X-Ref |
return: string the full path to the working directory |
get_tempdir_path() X-Ref |
return: string the full path to the directory with the source backup |
is_available() X-Ref |
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: boolean true if this converter should be considered as available |
detect_format($tempdir) X-Ref |
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 {@link backup::FORMAT_MOODLE} then they should be able to detect both source and target formats. param: string $tempdir the name of the backup directory return: null|string null if not recognized, backup::FORMAT_xxx otherwise |
description() X-Ref |
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 |
init() X-Ref |
Initialize the instance if needed, called by the constructor |
create_workdir() X-Ref |
Prepares a new empty working directory |
replace_tempdir() X-Ref |
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. |
destroy() X-Ref |
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. |
Class: convert_exception - X-Ref
General convert-related exception__construct($errorcode, $a = null, $debuginfo = null) X-Ref |
Constructor param: string $errorcode key for the corresponding error string param: object $a extra words and phrases that might be required in the error string param: string $debuginfo optional debugging information |