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

Base abstract class for all the helper classes providing various operations. More...

Inheritance diagram for backup_helper:
backup_general_helper

Static Public Member Functions

static check_and_create_backup_dir ($backupid)
 Given one backupid, create all the needed dirs to have one backup temp dir available.
 
static clear_backup_dir ($backupid, core\progress\base $progress=null)
 Given one backupid, ensure its temp dir is completely empty.
 
static delete_backup_dir ($backupid, core\progress\base $progress=null)
 Given one backupid, delete completely its temp dir.
 
static delete_dir_contents ($dir, $excludeddir='', core\progress\base $progress=null)
 Given one fullpath to directory, delete its contents recursively Copied originally from somewhere in the net.
 
static delete_old_backup_dirs ($deletebefore, core\progress\base $progress=null)
 Delete all the temp dirs older than the time specified.
 
static get_inforef_itemnames ()
 This function returns one array of itemnames that are being handled by inforef.xml files.
 
static is_sqlparam ($value)
 This function simply marks one param to be considered as straight sql param, so it won't be searched in the structure tree nor converted at all.
 
static log ($message, $level, $a, $depth, $display, $logger)
 This function will be invoked by any log() method in backup/restore, acting as a simple forwarder to the standard loggers but also, if the $display parameter is true, supporting translation via get_string() and sending to standard output.
 
static print_coursereuse_selector (string $current)
 Print the course reuse dropdown.
 
static store_backup_file ($backupid, $filepath, core\progress\base $progress=null)
 Given one backupid and the (FS) final generated file, perform its final storage into Moodle file storage.
 

Detailed Description

Base abstract class for all the helper classes providing various operations.

TODO: Finish phpdocs

Member Function Documentation

◆ clear_backup_dir()

static backup_helper::clear_backup_dir ( $backupid,
core\progress\base $progress = null )
static

Given one backupid, ensure its temp dir is completely empty.

If supplied, progress object should be ready to receive indeterminate progress reports.

Parameters
string$backupidBackup id
core\progress\base$progressOptional progress reporting object

◆ delete_backup_dir()

static backup_helper::delete_backup_dir ( $backupid,
core\progress\base $progress = null )
static

Given one backupid, delete completely its temp dir.

If supplied, progress object should be ready to receive indeterminate progress reports.

Parameters
string$backupidBackup id
core\progress\base$progressOptional progress reporting object

◆ delete_dir_contents()

static backup_helper::delete_dir_contents ( $dir,
$excludeddir = '',
core\progress\base $progress = null )
static

Given one fullpath to directory, delete its contents recursively Copied originally from somewhere in the net.

TODO: Modernise this

If supplied, progress object should be ready to receive indeterminate progress reports.

Parameters
string$dirDirectory to delete
string$excludedirExclude this directory
core\progress\base$progressOptional progress reporting object

◆ delete_old_backup_dirs()

static backup_helper::delete_old_backup_dirs ( $deletebefore,
core\progress\base $progress = null )
static

Delete all the temp dirs older than the time specified.

If supplied, progress object should be ready to receive indeterminate progress reports.

Parameters
int$deletebeforeDelete files and directories older than this time
core\progress\base$progressOptional progress reporting object

◆ get_inforef_itemnames()

static backup_helper::get_inforef_itemnames ( )
static

This function returns one array of itemnames that are being handled by inforef.xml files.

Used both by backup and restore

◆ is_sqlparam()

static backup_helper::is_sqlparam ( $value)
static

This function simply marks one param to be considered as straight sql param, so it won't be searched in the structure tree nor converted at all.

Useful for better integration of definition of sources in structure and DB stuff

◆ print_coursereuse_selector()

static backup_helper::print_coursereuse_selector ( string $current)
static

Print the course reuse dropdown.

Parameters
string$currentThe current course reuse option where the header is modified

◆ store_backup_file()

static backup_helper::store_backup_file ( $backupid,
$filepath,
core\progress\base $progress = null )
static

Given one backupid and the (FS) final generated file, perform its final storage into Moodle file storage.

For stored files it returns the complete file_info object

Note: the $filepath is deleted if the backup file is created successfully

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
int$backupid
string$filepathzip file containing the backup
core\progress\base$progressOptional progress monitor
Return values
stored_fileif created, null otherwise
Exceptions
moodle_exceptionin case of any problems

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