Moodle APIs  3.8
Moodle 3.8.6 (Build: 20201109)
Public Member Functions | Protected Attributes | List of all members
base_plan Class Reference

Abstract class defining the basis for one execution (backup/restore) plan. More...

Inheritance diagram for base_plan:
checksumable executable backup_plan restore_plan

Public Member Functions

 __construct ($name)
 Constructor - instantiates one object of this class.
 
 add_result ($result)
 Add the passed info to the plan results. More...
 
 add_task ($task)
 
 build ()
 Function responsible for building the tasks of any plan with their corresponding settings (must set the $built property to true)
 
 calculate_checksum ()
 This function will return one unique and stable checksum for one instance of the class implementing it. More...
 
 destroy ()
 Destroy all circular references. More...
 
 execute ()
 Function responsible for executing the tasks of any plan.
 
 get_name ()
 
 get_progress ()
 Gets the progress reporter, which can be used to report progress within the backup or restore process. More...
 
 get_results ()
 Return the results collected via self::add_result() method. More...
 
 get_setting ($name)
 return one setting by name, useful to request root/course settings that are, by definition, unique by name. More...
 
 get_settings ()
 
 get_tasks ()
 
 is_checksum_correct ($checksum)
 Given one checksum, returns if matches object's checksum (true) or no (false)
 
 setting_exists ($name)
 Wrapper over @get_setting() that returns if the requested setting exists or no.
 

Protected Attributes

 $built
 
 $name
 
 $results
 
 $settings
 
 $tasks
 

Detailed Description

Abstract class defining the basis for one execution (backup/restore) plan.

TODO: Finish phpdocs

Member Function Documentation

◆ add_result()

base_plan::add_result (   $result)

Add the passed info to the plan results.

At the moment we expect an associative array structure to be merged into the current results. In the future, some sort of base_result class may be introduced.

Parameters
array$resultassociative array describing a result of a task/step

◆ calculate_checksum()

base_plan::calculate_checksum ( )

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.

◆ destroy()

base_plan::destroy ( )

Destroy all circular references.

It helps PHP 5.2 a lot!

Reimplemented in restore_plan, and backup_plan.

◆ get_progress()

base_plan::get_progress ( )
abstract

Gets the progress reporter, which can be used to report progress within the backup or restore process.

Return values
core

Reimplemented in restore_plan, and backup_plan.

◆ get_results()

base_plan::get_results ( )

Return the results collected via self::add_result() method.

Return values
array

◆ get_setting()

base_plan::get_setting (   $name)

return one setting by name, useful to request root/course settings that are, by definition, unique by name.

Parameters
string$namename of the setting
Return values
base_setting
Exceptions
base_plan_exceptionif setting name is not found.

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