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


Class implementing the controller of any restore process
This final class is in charge of controlling all the restore architecture, for any type of backup.
TODO: Finish phpdocs
Definition at line 33 of file restore_controller.class.php.
| __construct | ( | $ | tempdir, |
| $ | courseid, | ||
| $ | interactive, | ||
| $ | mode, | ||
| $ | userid, | ||
| $ | target | ||
| ) |
| string | $tempdir | Directory under tempdir/backup awaiting restore |
| int | $courseid | Course id where restore is going to happen |
| bool | $interactive | backup::INTERACTIVE_YES[true] or backup::INTERACTIVE_NO[false] |
| int | $mode | backup::MODE_[ GENERAL | HUB | IMPORT | SAMESITE ] |
| int | $userid | |
| int | $target | backup::TARGET_[ NEW_COURSE | CURRENT_ADDING | CURRENT_DELETING | EXISTING_ADDING | EXISTING_DELETING ] |
Definition at line 71 of file restore_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.
Definition at line 197 of file restore_controller.class.php.


| calculate_restoreid | ( | ) | [protected] |
Definition at line 434 of file restore_controller.class.php.


| convert | ( | ) |
Converts from current format to backup::MOODLE format
Definition at line 393 of file restore_controller.class.php.

| destroy | ( | ) |
Clean structures used by the restore_controller
This method clean various structures used by the restore_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 150 of file restore_controller.class.php.
| execute_plan | ( | ) |
Definition at line 298 of file restore_controller.class.php.

| execute_precheck | ( | $ | droptemptablesafter = false | ) |
Execute the restore prechecks to detect any problem before proceed with restore
This function checks various parts of the restore (versions, users, roles...) returning true if everything was ok or false if any warning/error was detected. Any warning/error is returned by the get_precheck_results() method. Note: if any problem is found it will, automatically, drop all the restore temp tables as far as the next step is to inform about the warning/errors. If no problem is found, then default behaviour is to keep the temp tables so, in the same request restore will be executed, saving a lot of checks to be executed again. Note: If for any reason (UI to show after prechecks...) you want to force temp tables to be dropped always, you can pass true to the $droptemptablesafter parameter
Definition at line 326 of file restore_controller.class.php.

| finish_ui | ( | ) |
Definition at line 155 of file restore_controller.class.php.

| get_courseid | ( | ) |
Definition at line 242 of file restore_controller.class.php.
| get_execution | ( | ) |
Definition at line 274 of file restore_controller.class.php.
Definition at line 278 of file restore_controller.class.php.
| get_format | ( | ) |
Definition at line 246 of file restore_controller.class.php.
| get_info | ( | ) |
Definition at line 290 of file restore_controller.class.php.

| get_interactive | ( | ) |
Definition at line 250 of file restore_controller.class.php.
| get_logger | ( | ) |
Definition at line 294 of file restore_controller.class.php.

| get_mode | ( | ) |
Definition at line 254 of file restore_controller.class.php.
| get_operation | ( | ) |
Definition at line 238 of file restore_controller.class.php.
| get_plan | ( | ) |
Returns the restore plan
Definition at line 286 of file restore_controller.class.php.
Definition at line 355 of file restore_controller.class.php.
| get_restoreid | ( | ) |
Definition at line 230 of file restore_controller.class.php.
| get_results | ( | ) |
Definition at line 343 of file restore_controller.class.php.
| get_status | ( | ) |
Definition at line 270 of file restore_controller.class.php.
| get_target | ( | ) |
Definition at line 262 of file restore_controller.class.php.
| get_tempdir | ( | ) |
Definition at line 226 of file restore_controller.class.php.

| static get_tempdir_name | ( | $ | courseid = 0, |
| $ | userid = 0 |
||
| ) | [static] |
class method to provide pseudo random unique "correct" tempdir names
Definition at line 385 of file restore_controller.class.php.


| get_type | ( | ) |
Definition at line 234 of file restore_controller.class.php.

| get_userid | ( | ) |
Definition at line 258 of file restore_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 222 of file restore_controller.class.php.
| is_samesite | ( | ) |
Definition at line 266 of file restore_controller.class.php.
| static load_controller | ( | $ | restoreid | ) | [static] |
Definition at line 374 of file restore_controller.class.php.

| load_plan | ( | ) | [protected] |
Definition at line 441 of file restore_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 362 of file restore_controller.class.php.

Returns true if the prechecks have been executed
Definition at line 351 of file restore_controller.class.php.
| process_ui_event | ( | ) |
Definition at line 162 of file restore_controller.class.php.

| save_controller | ( | ) |
Definition at line 366 of file restore_controller.class.php.


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

| set_status | ( | $ | status | ) |
Definition at line 168 of file restore_controller.class.php.


$checksum [protected] |
Definition at line 60 of file restore_controller.class.php.
$courseid [protected] |
Definition at line 38 of file restore_controller.class.php.
$execution [protected] |
Definition at line 55 of file restore_controller.class.php.
$executiontime [protected] |
Definition at line 56 of file restore_controller.class.php.
$format [protected] |
Definition at line 41 of file restore_controller.class.php.
$info [protected] |
Definition at line 52 of file restore_controller.class.php.
$interactive [protected] |
Definition at line 42 of file restore_controller.class.php.
$logger [protected] |
Definition at line 58 of file restore_controller.class.php.
$mode [protected] |
Definition at line 43 of file restore_controller.class.php.
$operation [protected] |
Definition at line 45 of file restore_controller.class.php.
$plan [protected] |
Definition at line 53 of file restore_controller.class.php.
$precheck [protected] |
Definition at line 50 of file restore_controller.class.php.
$restoreid [protected] |
Definition at line 36 of file restore_controller.class.php.
$samesite [protected] |
Definition at line 47 of file restore_controller.class.php.
$status [protected] |
Definition at line 49 of file restore_controller.class.php.
$target [protected] |
Definition at line 46 of file restore_controller.class.php.
$tempdir [protected] |
Definition at line 35 of file restore_controller.class.php.
$type [protected] |
Definition at line 40 of file restore_controller.class.php.
$userid [protected] |
Definition at line 44 of file restore_controller.class.php.