Moodle PHP Documentation 4.4
Moodle 4.4.1 (Build: 20240610) (db07c09afc5)
restore_ui Class Reference

This is the restore user interface class. More...

Inheritance diagram for restore_ui:
base_ui

Public Member Functions

 cancel_process ()
 Cancels the current restore and redirects the user back to the relevant place.
 
 cleanup ()
 Delete course which is created by restore process.
 
 destroy ()
 Destorys the backup controller and the loaded stage.
 
 display (core_backup_renderer $renderer)
 Displays this stage.
 
 enforce_changed_dependencies ()
 Returns true if enforce_dependencies changed any settings.
 
 execute ()
 Executes the restore plan.
 
 get_controller ()
 Returns the controller object.
 
 get_controller_id ()
 Gets the ID used in creating the controller.
 
 get_first_stage_id ()
 Gets the first stage for this UI.
 
 get_format ()
 Gets the format for the backup.
 
 get_name ()
 Gets the name of this UI.
 
 get_progress_bar ()
 Gets an array of progress bar items that can be displayed through the restore renderer.
 
 get_progress_reporter ()
 Gets the progress reporter object in use for this restore UI.
 
 get_restoreid ()
 Gets the restore id from the controller.
 
 get_setting ($name, $default=false)
 Gets the requested setting.
 
 get_setting_value ($name, $default=false)
 Gets the value for the requested setting.
 
 get_stage ()
 Gets the stage we are on.
 
 get_stage_name ()
 Gets the name of the stage we are on.
 
 get_tasks ()
 Gets all backup tasks from the controller.
 
 get_type ()
 Gets the type of the backup.
 
 get_uniqueid ()
 Gets the unique ID associated with this UI.
 
 is_independent ()
 Returns true if the stage is independent (not requiring a restore controller)
 
 process ()
 This processes the current stage of the restore.
 
 requires_substage ()
 Returns true if this stage has substages of which at least one needs to be displayed.
 
 save_controller ()
 Saves the backup controller.
 
 set_progress_reporter (\core\progress\base $progressreporter)
 Sets the progress reporter that will be returned by get_progress_reporter.
 

Static Public Member Functions

static engage_independent_stage ($stage, $contextid)
 Initialised the requested independent stage.
 
static load_controller ($restoreid=false)
 Loads the restore controller if we are tracking one.
 

Public Attributes

const PROGRESS_EXECUTED = 3
 The progress of this instance of the backup ui class It has been executed.
 
const PROGRESS_INTIAL = 0
 The progress of this instance of the backup ui class It is in the initial stage.
 
const PROGRESS_PROCESSED = 1
 The progress of this instance of the backup ui class It is processed.
 
const PROGRESS_SAVED = 2
 The progress of this instance of the backup ui class It is saved.
 
const STAGE_COMPLETE = 64
 The stages of the restore user interface.
 
const STAGE_CONFIRM = 1
 The stages of the restore user interface.
 
const STAGE_DESTINATION = 2
 The stages of the restore user interface.
 
const STAGE_PROCESS = 32
 The stages of the restore user interface.
 
const STAGE_REVIEW = 16
 The stages of the restore user interface.
 
const STAGE_SCHEMA = 8
 The stages of the restore user interface.
 
const STAGE_SETTINGS = 4
 The stages of the restore user interface.
 

Static Public Attributes

static array $stages
 String mappings to the above stages.
 

Protected Member Functions

 enforce_dependencies ()
 Enforces dependencies on all settings.
 
 initialise_stage ($stage=null, array $params=null)
 Intialises what ever stage is requested.
 
 is_temporary_course_created ($courseid)
 Checks if the course is not restored fully and current controller has created it.
 

Protected Attributes

backup_controller restore_controller $controller
 The controller.
 
int $dependencychanges = 0
 The number of changes made by dependency enforcement.
 
int $progress
 The current progress of the UI One of self\PROGRESS_*.
 
core progress base $progressreporter = null
 Progress indicator (where there is no controller)
 
restore_ui_stage $stage = null
 The current UI stage.
 

Detailed Description

This is the restore user interface class.

The restore user interface class manages the user interface and restore for Moodle.

License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

Member Function Documentation

◆ cancel_process()

restore_ui::cancel_process ( )

Cancels the current restore and redirects the user back to the relevant place.

Reimplemented from base_ui.

◆ display()

restore_ui::display ( core_backup_renderer $renderer)

Displays this stage.

Exceptions
base_ui_exceptionif the progress is wrong.
Parameters
core_backup_renderer$renderer
Return values
stringHTML code to echo

Reimplemented from base_ui.

◆ enforce_changed_dependencies()

restore_ui::enforce_changed_dependencies ( )

Returns true if enforce_dependencies changed any settings.

Return values
bool

Reimplemented from base_ui.

◆ enforce_dependencies()

base_ui::enforce_dependencies ( )
protectedinherited

Enforces dependencies on all settings.

Call before save

Return values
boolTrue if dependencies were enforced and changes were made

◆ engage_independent_stage()

static restore_ui::engage_independent_stage ( $stage,
$contextid )
staticfinal

Initialised the requested independent stage.

Exceptions
restore_ui_exception
Parameters
int$stageOne of self\STAGE_*
int$contextid
Return values
restore_ui_stage_confirm|restore_ui_stage_destination

◆ execute()

restore_ui::execute ( )

Executes the restore plan.

Exceptions
restore_ui_exceptionif the progress or stage is wrong.
Return values
bool

Reimplemented from base_ui.

◆ get_controller()

base_ui::get_controller ( )
inherited

Returns the controller object.

Return values
backup_controller|restore_controller

◆ get_controller_id()

base_ui::get_controller_id ( )
inherited

Gets the ID used in creating the controller.

Relates to course/section/cm

Return values
int

◆ get_first_stage_id()

restore_ui::get_first_stage_id ( )

Gets the first stage for this UI.

Return values
intSTAGE_CONFIRM

Reimplemented from base_ui.

◆ get_format()

base_ui::get_format ( )
inherited

Gets the format for the backup.

Return values
int

◆ get_name()

restore_ui::get_name ( )

Gets the name of this UI.

Return values
string

Reimplemented from base_ui.

◆ get_progress_bar()

restore_ui::get_progress_bar ( )

Gets an array of progress bar items that can be displayed through the restore renderer.

Return values
arrayArray of items for the progress bar

Reimplemented from base_ui.

◆ get_progress_reporter()

restore_ui::get_progress_reporter ( )

Gets the progress reporter object in use for this restore UI.

IMPORTANT: This progress reporter is used only for UI progress that is outside the restore controller. The restore controller has its own progress reporter which is used for progress during the main restore. Use the restore controller's progress reporter to report progress during a restore operation, not this one.

This extra reporter is necessary because on some restore UI screens, there are long-running tasks even though there is no restore controller in use.

Return values
core\progress\none

◆ get_restoreid()

restore_ui::get_restoreid ( )

Gets the restore id from the controller.

Return values
string

◆ get_setting()

base_ui::get_setting ( $name,
$default = false )
inherited

Gets the requested setting.

Parameters
string$name
bool$default
Return values
base_setting

◆ get_setting_value()

base_ui::get_setting_value ( $name,
$default = false )
inherited

Gets the value for the requested setting.

Parameters
string$name
bool$default
Return values
mixed

◆ get_stage()

base_ui::get_stage ( )
inherited

Gets the stage we are on.

Return values
int

◆ get_stage_name()

base_ui::get_stage_name ( )
inherited

Gets the name of the stage we are on.

Return values
string

◆ get_tasks()

base_ui::get_tasks ( )
inherited

Gets all backup tasks from the controller.

Return values
arrayArray of backup_task

◆ get_type()

base_ui::get_type ( )
inherited

Gets the type of the backup.

Return values
int

◆ get_uniqueid()

restore_ui::get_uniqueid ( )

Gets the unique ID associated with this UI.

Return values
string

Reimplemented from base_ui.

◆ initialise_stage()

restore_ui::initialise_stage ( $stage = null,
array $params = null )
protected

Intialises what ever stage is requested.

If none are requested we check params for 'stage' and default to initial

Exceptions
restore_ui_exceptionfor an invalid stage
Parameters
int | null$stageThe desired stage to intialise or null for the default
array$params
Return values
restore_ui_stage_initial|restore_ui_stage_schema|restore_ui_stage_confirmation|restore_ui_stage_final

Reimplemented from base_ui.

◆ is_independent()

restore_ui::is_independent ( )

Returns true if the stage is independent (not requiring a restore controller)

Return values
bool

◆ is_temporary_course_created()

restore_ui::is_temporary_course_created ( $courseid)
protected

Checks if the course is not restored fully and current controller has created it.

Parameters
int$courseidid of the course which needs to be checked
Return values
bool

◆ load_controller()

static restore_ui::load_controller ( $restoreid = false)
staticfinal

Loads the restore controller if we are tracking one.

Parameters
string | bool$restoreid
Return values
string

Reimplemented from base_ui.

◆ process()

restore_ui::process ( )

This processes the current stage of the restore.

Exceptions
restore_ui_exceptionif the progress is wrong.
Return values
bool

Reimplemented from base_ui.

◆ requires_substage()

restore_ui::requires_substage ( )

Returns true if this stage has substages of which at least one needs to be displayed.

Return values
bool

◆ save_controller()

base_ui::save_controller ( )
inherited

Saves the backup controller.

Once this has been called nothing else can be changed in the controller.

Exceptions
base_ui_exception
Return values
bool

◆ set_progress_reporter()

restore_ui::set_progress_reporter ( \core\progress\base $progressreporter)

Sets the progress reporter that will be returned by get_progress_reporter.

Parameters
core\progress\base$progressreporterProgress reporter

Member Data Documentation

◆ $stages

array restore_ui::$stages
static
Initial value:
= array(
)
const STAGE_SETTINGS
The stages of the restore user interface.
Definition restore_ui.class.php:52
const STAGE_COMPLETE
The stages of the restore user interface.
Definition restore_ui.class.php:76
const STAGE_CONFIRM
The stages of the restore user interface.
Definition restore_ui.class.php:40
const STAGE_SCHEMA
The stages of the restore user interface.
Definition restore_ui.class.php:58
const STAGE_PROCESS
The stages of the restore user interface.
Definition restore_ui.class.php:70
const STAGE_REVIEW
The stages of the restore user interface.
Definition restore_ui.class.php:64
const STAGE_DESTINATION
The stages of the restore user interface.
Definition restore_ui.class.php:46

String mappings to the above stages.

◆ STAGE_COMPLETE

const restore_ui::STAGE_COMPLETE = 64

The stages of the restore user interface.

The process is complete.

◆ STAGE_CONFIRM

const restore_ui::STAGE_CONFIRM = 1

The stages of the restore user interface.

Confirm the backup you are going to restore.

◆ STAGE_DESTINATION

const restore_ui::STAGE_DESTINATION = 2

The stages of the restore user interface.

Select the destination for the restore.

◆ STAGE_PROCESS

const restore_ui::STAGE_PROCESS = 32

The stages of the restore user interface.

The restore is in process right now.

◆ STAGE_REVIEW

const restore_ui::STAGE_REVIEW = 16

The stages of the restore user interface.

The final review before the restore is run.

◆ STAGE_SCHEMA

const restore_ui::STAGE_SCHEMA = 8

The stages of the restore user interface.

Alter and review the schema that you are going to restore.

◆ STAGE_SETTINGS

const restore_ui::STAGE_SETTINGS = 4

The stages of the restore user interface.

Alter the setting for the restore.


The documentation for this class was generated from the following file: