|
| __construct ($type, $id, $format, $interactive, $mode, $userid) |
| Constructor for the backup controller class. More...
|
|
| add_logger (base_logger $logger) |
| Inserts a new logger at end of logging chain. More...
|
|
| calculate_checksum () |
| This function will return one unique and stable checksum for one instance of the class implementing it. More...
|
|
| destroy () |
| Clean structures used by the backup_controller. More...
|
|
| execute_plan () |
| Executes the backup. More...
|
|
| finish_ui () |
|
| get_backupid () |
|
| get_courseid () |
|
| get_execution () |
|
| get_executiontime () |
|
| get_format () |
|
| get_id () |
|
| get_include_files () |
| Returns the current value of the include_files setting. More...
|
|
| get_interactive () |
|
| get_logger () |
| Gets first logger in logging chain. More...
|
|
| get_mode () |
|
| get_operation () |
|
| get_plan () |
|
| get_progress () |
| Gets the progress reporter, which can be used to report progress within the backup or restore process. More...
|
|
| get_results () |
|
| get_status () |
|
| get_type () |
|
| get_userid () |
|
| is_checksum_correct ($checksum) |
| Given one checksum, returns if matches object's checksum (true) or no (false)
|
|
| log ($message, $level, $a=null, $depth=null, $display=false) |
| Logs data to the logger chain. More...
|
|
| process_ui_event () |
|
| save_controller ($includeobj=true, $cleanobj=false) |
| Save controller information. More...
|
|
| set_execution ($execution, $executiontime=0) |
|
| set_progress (\core\progress\base $progress) |
| Sets the progress reporter. More...
|
|
| set_status ($status) |
|
|
const | CIPHER = 'aes-256-cbc' |
| Cipher to be used in backup and restore operations.
|
|
const | CIPHERKEYLEN = 32 |
| Bytes enforced for key, using the cypher above. More...
|
|
const | ENROL_ALWAYS = 2 |
|
const | ENROL_NEVER = 0 |
|
const | ENROL_WITHUSERS = 1 |
|
const | EXECUTION_DELAYED = 2 |
|
const | EXECUTION_INMEDIATE = 1 |
|
const | FORMAT_IMSCC1 = 'imscc1' |
|
const | FORMAT_IMSCC11 = 'imscc11' |
|
const | FORMAT_MOODLE = 'moodle2' |
|
const | FORMAT_MOODLE1 = 'moodle1' |
|
const | FORMAT_UNKNOWN = 'unknown' |
|
const | INTERACTIVE_NO = false |
|
const | INTERACTIVE_YES = true |
|
const | LOG_DEBUG = 50 |
|
const | LOG_ERROR = 20 |
|
const | LOG_INFO = 40 |
|
const | LOG_NONE = 10 |
|
const | LOG_WARNING = 30 |
|
const | MODE_ASYNC = 70 |
| This mode is for asynchronous backups. More...
|
|
const | MODE_AUTOMATED = 50 |
|
const | MODE_CONVERTED = 60 |
|
const | MODE_GENERAL = 10 |
|
const | MODE_HUB = 30 |
|
const | MODE_IMPORT = 20 |
| This is used for importing courses, and for duplicating activities. More...
|
|
const | MODE_SAMESITE = 40 |
| This mode is intended for duplicating courses and cases where the backup target is within the same site. More...
|
|
const | OPERATION_BACKUP ='backup' |
|
const | OPERATION_RESTORE ='restore' |
|
const | RELEASE = '3.8' |
| Usually same than major release zero version, mainly for informative/historic purposes.
|
|
const | STATUS_AWAITING = 700 |
|
const | STATUS_CONFIGURED = 400 |
|
const | STATUS_CREATED = 100 |
|
const | STATUS_EXECUTING = 800 |
|
const | STATUS_FINISHED_ERR = 900 |
|
const | STATUS_FINISHED_OK =1000 |
|
const | STATUS_NEED_PRECHECK =600 |
|
const | STATUS_PLANNED = 300 |
|
const | STATUS_REQUIRE_CONV = 200 |
|
const | STATUS_SETTING_UI = 500 |
|
const | TARGET_CURRENT_ADDING = 1 |
|
const | TARGET_CURRENT_DELETING = 0 |
|
const | TARGET_EXISTING_ADDING = 4 |
|
const | TARGET_EXISTING_DELETING = 3 |
|
const | TARGET_NEW_COURSE = 2 |
|
const | TYPE_1ACTIVITY = 'activity' |
|
const | TYPE_1COURSE = 'course' |
|
const | TYPE_1SECTION = 'section' |
|
const | VAR_ACTIVITYID = -21 |
|
const | VAR_BACKUPID = -1001 |
|
const | VAR_BASEPATH = -1011 |
|
const | VAR_BLOCKID = -51 |
|
const | VAR_BLOCKNAME = -61 |
|
const | VAR_CONTEXTID = -71 |
|
const | VAR_COURSEID = -1 |
|
const | VAR_MODID = -31 |
|
const | VAR_MODNAME = -41 |
|
const | VAR_PARENTID = -81 |
|
const | VAR_SECTIONID = -11 |
|
const | VERSION = 2019111800 |
| Usually same than major release version, this is used to mark important point is backup when some behavior/approach channged, in order to allow conditional coding based on it.
|
|
Class implementing the controller of any backup process.
This final class is in charge of controlling all the backup architecture, for any type of backup. Based in type, format, interactivity and target, it stores the whole execution plan and settings that will be used later by the @backup_worker, applies all the defaults, performs all the security contraints and is in charge of handling the ui if necessary. Also logging strategy is defined here.
Note the class is 100% neutral and usable for any backup. It just stores/requests all the needed information from other backup classes in order to have everything well structured in order to allow the @backup_worker classes to do their job.
In other words, a mammoth class, but don't worry, practically everything is delegated/ aggregated!)
TODO: Finish phpdocs
backup_controller::destroy |
( |
| ) |
|
Clean structures used by the backup_controller.
This method clean various structures used by the backup_controller, destroying them in an ordered way, so their memory will be gc properly by PHP (mainly circular references).
Note that, while it's not mandatory to execute this method, it's highly recommended to do so, specially in scripts performing multiple operations (like the automated backups) or the system will run out of memory after a few dozens of backups)