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


Public Member Functions | |
| __construct ($type, $id, $format, $interactive, $mode, $userid) | |
| destroy () | |
| finish_ui () | |
| process_ui_event () | |
| set_status ($status) | |
| set_execution ($execution, $executiontime=0) | |
| calculate_checksum () | |
| is_checksum_correct ($checksum) | |
| get_backupid () | |
| get_type () | |
| get_operation () | |
| get_id () | |
| get_courseid () | |
| get_format () | |
| get_interactive () | |
| get_mode () | |
| get_userid () | |
| get_status () | |
| get_execution () | |
| get_executiontime () | |
| get_plan () | |
| get_logger () | |
| execute_plan () | |
| get_results () | |
| log ($message, $level, $a=null, $depth=null, $display=false) | |
| save_controller () | |
Static Public Member Functions | |
| static | load_controller ($backupid) |
Protected Member Functions | |
| calculate_backupid () | |
| load_plan () | |
| apply_defaults () | |
Protected Attributes | |
| $backupid | |
| $type | |
| $id | |
| $courseid | |
| $format | |
| $interactive | |
| $mode | |
| $userid | |
| $operation | |
| $status | |
| $plan | |
| $execution | |
| $executiontime | |
| $destination | |
| $logger | |
| $checksum | |
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 , 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 classes to do their job.
In other words, a mammoth class, but don't worry, practically everything is delegated/ aggregated!)
TODO: Finish phpdocs
Definition at line 43 of file backup_controller.class.php.
| __construct | ( | $ | type, |
| $ | id, | ||
| $ | format, | ||
| $ | interactive, | ||
| $ | mode, | ||
| $ | userid | ||
| ) |
Constructor for the backup controller class.
| int | $type | Type of the backup; One of backup::TYPE_1COURSE, TYPE_1SECTION, TYPE_1ACTIVITY |
| int | $id | The ID of the item to backup; e.g the course id |
| int | $format | The backup format to use; Most likely backup::FORMAT_MOODLE |
| bool | $interactive | Whether this backup will require user interaction; backup::INTERACTIVE_YES or INTERACTIVE_NO |
| int | $mode | One of backup::MODE_GENERAL, MODE_IMPORT, MODE_SAMESITE, MODE_HUB, MODE_AUTOMATED |
| int | $userid | The id of the user making the backup |
Definition at line 78 of file backup_controller.class.php.

| apply_defaults | ( | ) | [protected] |
Definition at line 348 of file backup_controller.class.php.


| calculate_backupid | ( | ) | [protected] |
Definition at line 333 of file backup_controller.class.php.


This function will return one unique and stable checksum for one instance of the class implementing it. It's each implementation responsibility to do it recursively if needed and use optional store (caching) of the checksum if necessary/possible
Implements checksumable.
Reimplemented in mock_backup_controller4dbops.
Definition at line 204 of file backup_controller.class.php.


| 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)
Definition at line 154 of file backup_controller.class.php.
| execute_plan | ( | ) |
Executes the backup
Definition at line 292 of file backup_controller.class.php.

| finish_ui | ( | ) |
Definition at line 159 of file backup_controller.class.php.

| get_backupid | ( | ) |
Definition at line 229 of file backup_controller.class.php.
| get_courseid | ( | ) |
Definition at line 245 of file backup_controller.class.php.
| get_execution | ( | ) |
Definition at line 269 of file backup_controller.class.php.
Definition at line 273 of file backup_controller.class.php.
| get_format | ( | ) |
Definition at line 249 of file backup_controller.class.php.
| get_id | ( | ) |
Definition at line 241 of file backup_controller.class.php.
| get_interactive | ( | ) |
Definition at line 253 of file backup_controller.class.php.
| get_logger | ( | ) |
Definition at line 284 of file backup_controller.class.php.
| get_mode | ( | ) |
Definition at line 257 of file backup_controller.class.php.

| get_operation | ( | ) |
Definition at line 237 of file backup_controller.class.php.
| get_plan | ( | ) |
Definition at line 280 of file backup_controller.class.php.
| get_results | ( | ) |
Definition at line 307 of file backup_controller.class.php.
| get_status | ( | ) |
Definition at line 265 of file backup_controller.class.php.
| get_type | ( | ) |
Definition at line 233 of file backup_controller.class.php.

| get_userid | ( | ) |
Definition at line 261 of file backup_controller.class.php.
| is_checksum_correct | ( | $ | checksum | ) |
Given one checksum, returns if matches object's checksum (true) or no (false)
Implements checksumable.
Definition at line 225 of file backup_controller.class.php.
| static load_controller | ( | $ | backupid | ) | [static] |
Definition at line 323 of file backup_controller.class.php.

| load_plan | ( | ) | [protected] |
Definition at line 341 of file backup_controller.class.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.
Definition at line 311 of file backup_controller.class.php.

| process_ui_event | ( | ) |
Definition at line 166 of file backup_controller.class.php.

| save_controller | ( | ) |
Reimplemented in mock_backup_controller.
Definition at line 315 of file backup_controller.class.php.


| set_execution | ( | $ | execution, |
| $ | executiontime = 0 |
||
| ) |
Definition at line 187 of file backup_controller.class.php.

| set_status | ( | $ | status | ) |
Definition at line 172 of file backup_controller.class.php.


$backupid [protected] |
Definition at line 45 of file backup_controller.class.php.
$checksum [protected] |
Definition at line 66 of file backup_controller.class.php.
$courseid [protected] |
Definition at line 49 of file backup_controller.class.php.
$destination [protected] |
Definition at line 63 of file backup_controller.class.php.
$execution [protected] |
Definition at line 60 of file backup_controller.class.php.
$executiontime [protected] |
Definition at line 61 of file backup_controller.class.php.
$format [protected] |
Definition at line 50 of file backup_controller.class.php.
$id [protected] |
Definition at line 48 of file backup_controller.class.php.
$interactive [protected] |
Definition at line 51 of file backup_controller.class.php.
$logger [protected] |
Definition at line 64 of file backup_controller.class.php.
$mode [protected] |
Definition at line 52 of file backup_controller.class.php.
$operation [protected] |
Definition at line 54 of file backup_controller.class.php.
$plan [protected] |
Definition at line 58 of file backup_controller.class.php.
$status [protected] |
Definition at line 56 of file backup_controller.class.php.
$type [protected] |
Definition at line 47 of file backup_controller.class.php.
$userid [protected] |
Definition at line 53 of file backup_controller.class.php.