Moodle PHP Documentation 5.1
Moodle 5.1dev (Build: 20250711) (9addea9f0ac)
backup_controller_dbops Class Reference

Non instantiable helper class providing DB support to the @backup_controller. More...

Inheritance diagram for backup_controller_dbops:
backup_dbops

Static Public Member Functions

static apply_config_defaults (backup_controller $controller)
 Sets the default values for the settings in a backup operation.
 
static apply_version_and_release ()
 Update CFG->backup_version and CFG->backup_release if change in version is detected.
 
static backup_get_original_course_info ($courseid)
 Given the courseid, return some course related information we want to transport.
 
static backup_includes_file_references ($backupid)
 Given the backupid, detect if the backup contains references to external contents.
 
static backup_includes_files ($backupid)
 Given the backupid, determine whether this backup should include files from the moodle file storage system.
 
static backup_includes_mnet_remote_users ($backupid)
 Given the backupid, detect if the backup includes "mnet" remote users or no.
 
static create_backup_files_temp_table ($backupid)
 
static create_backup_ids_temp_table ($backupid)
 
static create_question_category_temp_tables ()
 Create temporary tables to store a partial copies of question category data from the backup_ids_temp table.
 
static decode_backup_temp_info ($info)
 Decode the info field from backup_ids_temp or backup_files_temp.
 
static drop_backup_ids_temp_table ($backupid)
 
static drop_question_category_temp_tables ()
 Dispose of the additional temporary tables.
 
static encode_backup_temp_info ($info)
 Encode the info field for backup_ids_temp or backup_files_temp.
 
static get_courseid_from_type_id ($type, $id)
 Given one type and id from controller, return the corresponding courseid.
 
static get_moodle_backup_information ($backupid, ?\core\progress\base $progress=null)
 Get details information for main moodle_backup.xml file, extracting it from the specified controller.
 
static get_progress ($backupid)
 Get the progress details of a backup operation.
 
static load_controller ($backupid)
 
static save_controller ($controller, $checksum, $includeobj=true, $cleanobj=false)
 Send one backup controller to DB.
 

Static Protected Attributes

static int $includesfilescache
 Cached backup_includes_files result.
 
static string $includesfilescachebackupid
 Backup id for cached backup_includes_files result.
 

Detailed Description

Non instantiable helper class providing DB support to the @backup_controller.

This class contains various static methods available for all the DB operations performed by the backup_controller class

TODO: Finish phpdocs

Member Function Documentation

◆ apply_config_defaults()

static backup_controller_dbops::apply_config_defaults ( backup_controller $controller)
static

Sets the default values for the settings in a backup operation.

Based on the mode of the backup it will load proper defaults using apply_admin_config_defaults.

Parameters
backup_controller$controller

◆ backup_get_original_course_info()

static backup_controller_dbops::backup_get_original_course_info ( $courseid)
static

Given the courseid, return some course related information we want to transport.

Parameters
int$coursethe id of the course this backup belongs to

◆ backup_includes_file_references()

static backup_controller_dbops::backup_includes_file_references ( $backupid)
static

Given the backupid, detect if the backup contains references to external contents.

Return values
int

◆ backup_includes_files()

static backup_controller_dbops::backup_includes_files ( $backupid)
static

Given the backupid, determine whether this backup should include files from the moodle file storage system.

Parameters
string$backupidThe ID of the backup.
Return values
intIndicates whether files should be included in backups.

◆ create_question_category_temp_tables()

static backup_controller_dbops::create_question_category_temp_tables ( )
static

Create temporary tables to store a partial copies of question category data from the backup_ids_temp table.

This is to work around MySQL's restruction on joining the same temporary table multiple times in the same query. It isn't necessary on PostgreSQL (which can join temporary tables multiple times) or MSSQL (which doesn't really use temporary tables) but doing it this way keeps things database-agnostic.

◆ decode_backup_temp_info()

static backup_controller_dbops::decode_backup_temp_info ( $info)
static

Decode the info field from backup_ids_temp or backup_files_temp.

Parameters
mixed$infoThe info field data to decode, may be an object or a simple integer.
Return values
mixedThe decoded information. For simple types it returns, for complex ones we decode.

◆ encode_backup_temp_info()

static backup_controller_dbops::encode_backup_temp_info ( $info)
static

Encode the info field for backup_ids_temp or backup_files_temp.

Parameters
mixed$infostring The info field data to encode.
Return values
stringAn encoded string of data or null if the input is null.

◆ get_moodle_backup_information()

static backup_controller_dbops::get_moodle_backup_information ( $backupid,
?\core\progress\base $progress = null )
static

Get details information for main moodle_backup.xml file, extracting it from the specified controller.

If you specify the progress monitor, this will start a new progress section to track progress in processing (in case this task takes a long time).

Parameters
string$backupidBackup ID
core\progress\base$progressOptional progress monitor

◆ get_progress()

static backup_controller_dbops::get_progress ( $backupid)
static

Get the progress details of a backup operation.

Get backup records directly from database, if the backup has successfully completed there will be no controller object to load.

Parameters
string$backupidThe backup id to query.
Return values
array#$progressThe backup progress details.

◆ save_controller()

static backup_controller_dbops::save_controller ( $controller,
$checksum,
$includeobj = true,
$cleanobj = false )
static

Send one backup controller to DB.

Parameters
backup_controller$controllercontroller to send to DB
string$checksumhash of the controller to be checked
bool$includeobjto decide if the object itself must be updated (true) or no (false)
bool$cleanobjto decide if the object itself must be cleaned (true) or no (false)
Return values
intid of the controller record in the DB
Exceptions
backup_controller_exception|backup_dbops_exception

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