Moodle PHP Documentation 4.5
Moodle 4.5dev (Build: 20240606) (d3ae1391abe)
backup Class Reference

Abstract class defining common stuff to be used by the backup stuff. More...

Inheritance diagram for backup:
checksumable base_controller backup_controller restore_controller

Public Member Functions

 calculate_checksum ()
 This function will return one unique and stable checksum for one instance of the class implementing it.
 
 is_checksum_correct ($checksum)
 Given one checksum, returns if matches object's checksum (true) or no (false)
 

Public Attributes

const CIPHER = 'aes-256-cbc'
 Cipher to be used in backup and restore operations.
 
const CIPHERKEYLEN = 32
 Bytes enforced for key, using the cypher above.
 
const ENROL_ALWAYS = 2
 
const ENROL_NEVER = 0
 
const ENROL_WITHUSERS = 1
 
const EXECUTION_DELAYED = 2
 
const EXECUTION_INMEDIATE = 1
 
const FORMAT_IMSCC1 = 'imscc1'
 
const FORMAT_IMSCC11 = 'imscc11'
 
const FORMAT_MOODLE = 'moodle2'
 
const FORMAT_MOODLE1 = 'moodle1'
 
const FORMAT_UNKNOWN = 'unknown'
 
const INTERACTIVE_NO = false
 
const INTERACTIVE_YES = true
 
const LOG_DEBUG = 50
 
const LOG_ERROR = 20
 
const LOG_INFO = 40
 
const LOG_NONE = 10
 
const LOG_WARNING = 30
 
const MODE_ASYNC = 70
 This mode is for asynchronous backups.
 
const MODE_AUTOMATED = 50
 
const MODE_CONVERTED = 60
 
const MODE_COPY = 80
 This mode is for course copies.
 
const MODE_GENERAL = 10
 
const MODE_HUB = 30
 
const MODE_IMPORT = 20
 This is used for importing courses, and for duplicating activities.
 
const MODE_SAMESITE = 40
 This mode is intended for duplicating courses and cases where the backup target is within the same site.
 
const OPERATION_BACKUP ='backup'
 
const OPERATION_RESTORE ='restore'
 
const RELEASE = '4.5'
 Usually same than major release zero version, mainly for informative/historic purposes.
 
const RELEASESESSION_NO = false
 Don't release the session during backup/restore.
 
const RELEASESESSION_YES = true
 Release the session during backup/restore.
 
const STATUS_AWAITING = 700
 
const STATUS_CONFIGURED = 400
 
const STATUS_CREATED = 100
 
const STATUS_EXECUTING = 800
 
const STATUS_FINISHED_ERR = 900
 
const STATUS_FINISHED_OK =1000
 
const STATUS_NEED_PRECHECK =600
 
const STATUS_PLANNED = 300
 
const STATUS_REQUIRE_CONV = 200
 
const STATUS_SETTING_UI = 500
 
const TARGET_CURRENT_ADDING = 1
 
const TARGET_CURRENT_DELETING = 0
 
const TARGET_EXISTING_ADDING = 4
 
const TARGET_EXISTING_DELETING = 3
 
const TARGET_NEW_COURSE = 2
 
const TYPE_1ACTIVITY = 'activity'
 
const TYPE_1COURSE = 'course'
 
const TYPE_1SECTION = 'section'
 
const VAR_ACTIVITYID = -21
 
const VAR_BACKUPID = -1001
 
const VAR_BASEPATH = -1011
 
const VAR_BLOCKID = -51
 
const VAR_BLOCKNAME = -61
 
const VAR_CONTEXTID = -71
 
const VAR_COURSEID = -1
 
const VAR_MODID = -31
 
const VAR_MODNAME = -41
 
const VAR_PARENTID = -81
 
const VAR_SECTIONID = -11
 
const VERSION = 2024042200
 Usually same than major release version, this is used to mark important point is backup when some behavior/approach channged, in order to allow conditional coding based on it.
 

Detailed Description

Abstract class defining common stuff to be used by the backup stuff.

This class defines various constants and methods that will be used by different classes, all related with the backup process. Just provides the top hierarchy of the backup controller/worker stuff.

TODO: Finish phpdocs

Member Function Documentation

◆ calculate_checksum()

checksumable::calculate_checksum ( )
inherited

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

Implemented in backup_controller, backup_setting, base_logger, base_plan, base_task, and restore_controller.

◆ is_checksum_correct()

checksumable::is_checksum_correct ( $checksum)
inherited

Given one checksum, returns if matches object's checksum (true) or no (false)

Implemented in backup_controller, backup_setting, base_logger, base_plan, base_task, and restore_controller.

Member Data Documentation

◆ CIPHERKEYLEN

const backup::CIPHERKEYLEN = 32

Bytes enforced for key, using the cypher above.

Restrictive? Yes, but better than unsafe lengths

◆ MODE_ASYNC

const backup::MODE_ASYNC = 70

This mode is for asynchronous backups.

These backups will run via adhoc scheduled tasks.

◆ MODE_COPY

const backup::MODE_COPY = 80

This mode is for course copies.

It is similar to async, but identifies back up and restore tasks as course copies.

These copies will run via adhoc scheduled tasks.

◆ MODE_IMPORT

const backup::MODE_IMPORT = 20

This is used for importing courses, and for duplicating activities.

This mode will ensure that files are not included in the backup generation, and during a restore they are copied from the existing file record.

◆ MODE_SAMESITE

const backup::MODE_SAMESITE = 40

This mode is intended for duplicating courses and cases where the backup target is within the same site.

This mode will ensure that files are not included in the backup generation, and during a restore they are copied from the existing file record.

For creating a backup for archival purposes or greater longevity, use MODE_GENERAL.


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