Moodle  2.2.1
http://www.collinsharper.com
restore_controller Class Reference
Inheritance diagram for restore_controller:
Collaboration diagram for restore_controller:

Public Member Functions

 __construct ($tempdir, $courseid, $interactive, $mode, $userid, $target)
 destroy ()
 finish_ui ()
 process_ui_event ()
 set_status ($status)
 set_execution ($execution, $executiontime=0)
 calculate_checksum ()
 is_checksum_correct ($checksum)
 get_tempdir ()
 get_restoreid ()
 get_type ()
 get_operation ()
 get_courseid ()
 get_format ()
 get_interactive ()
 get_mode ()
 get_userid ()
 get_target ()
 is_samesite ()
 get_status ()
 get_execution ()
 get_executiontime ()
 get_plan ()
 get_info ()
 get_logger ()
 execute_plan ()
 execute_precheck ($droptemptablesafter=false)
 get_results ()
 precheck_executed ()
 get_precheck_results ()
 log ($message, $level, $a=null, $depth=null, $display=false)
 save_controller ()
 convert ()

Static Public Member Functions

static load_controller ($restoreid)
static get_tempdir_name ($courseid=0, $userid=0)

Protected Member Functions

 calculate_restoreid ()
 load_plan ()

Protected Attributes

 $tempdir
 $restoreid
 $courseid
 $type
 $format
 $interactive
 $mode
 $userid
 $operation
 $target
 $samesite
 $status
 $precheck
 $info
 $plan
 $execution
 $executiontime
 $logger
 $checksum

Detailed Description

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.


Constructor & Destructor Documentation

__construct ( tempdir,
courseid,
interactive,
mode,
userid,
target 
)
Parameters:
string$tempdirDirectory under tempdir/backup awaiting restore
int$courseidCourse id where restore is going to happen
bool$interactivebackup::INTERACTIVE_YES[true] or backup::INTERACTIVE_NO[false]
int$modebackup::MODE_[ GENERAL | HUB | IMPORT | SAMESITE ]
int$userid
int$targetbackup::TARGET_[ NEW_COURSE | CURRENT_ADDING | CURRENT_DELETING | EXISTING_ADDING | EXISTING_DELETING ]

Definition at line 71 of file restore_controller.class.php.

Here is the call graph for this function:


Member Function Documentation

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.

Here is the call graph for this function:

Here is the caller graph for this function:

calculate_restoreid ( ) [protected]

Definition at line 434 of file restore_controller.class.php.

Here is the call graph for this function:

Here is the caller graph for this function:

convert ( )

Converts from current format to backup::MOODLE format

Definition at line 393 of file restore_controller.class.php.

Here is the call graph for this function:

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.

Definition at line 298 of file restore_controller.class.php.

Here is the call graph for this function:

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.

Here is the call graph for this function:

finish_ui ( )

Definition at line 155 of file restore_controller.class.php.

Here is the call graph for this function:

Definition at line 242 of file restore_controller.class.php.

Definition at line 274 of file restore_controller.class.php.

Definition at line 278 of file restore_controller.class.php.

Definition at line 246 of file restore_controller.class.php.

get_info ( )

Definition at line 290 of file restore_controller.class.php.

Here is the call graph for this function:

Definition at line 250 of file restore_controller.class.php.

Definition at line 294 of file restore_controller.class.php.

Here is the caller graph for this function:

get_mode ( )

Definition at line 254 of file restore_controller.class.php.

Definition at line 238 of file restore_controller.class.php.

get_plan ( )

Returns the restore plan

Returns:
restore_plan

Definition at line 286 of file restore_controller.class.php.

Definition at line 355 of file restore_controller.class.php.

Definition at line 230 of file restore_controller.class.php.

Definition at line 343 of file restore_controller.class.php.

Definition at line 270 of file restore_controller.class.php.

Definition at line 262 of file restore_controller.class.php.

Definition at line 226 of file restore_controller.class.php.

Here is the caller graph for this function:

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.

Here is the call graph for this function:

Here is the caller graph for this function:

get_type ( )

Definition at line 234 of file restore_controller.class.php.

Here is the caller graph for this function:

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.

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.

Here is the caller graph for this function:

load_plan ( ) [protected]

Definition at line 441 of file restore_controller.class.php.

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Here is the caller graph for this function:

Returns true if the prechecks have been executed

Returns:
bool

Definition at line 351 of file restore_controller.class.php.

Definition at line 162 of file restore_controller.class.php.

Here is the call graph for this function:

Definition at line 366 of file restore_controller.class.php.

Here is the call graph for this function:

Here is the caller graph for this function:

set_execution ( execution,
executiontime = 0 
)

Definition at line 183 of file restore_controller.class.php.

Here is the call graph for this function:

set_status ( status)

Definition at line 168 of file restore_controller.class.php.

Here is the call graph for this function:

Here is the caller graph for this function:


Field Documentation

$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.


The documentation for this class was generated from the following file:
 All Data Structures Namespaces Files Functions Variables Enumerations