Non instantiable helper class providing general helper methods for backup/restore.
More...
|
static | array_checksum_recursive ($arr) |
| Calculate one checksum for any array/object.
|
|
static | backup_is_samesite ($info) |
| Given the information fetched from moodle_backup.xml file decide if we are restoring in the same site the backup was generated or no.
|
|
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 | detect_backup_format ($tempdir) |
| Detects the format of the given unpacked backup directory.
|
|
static | get_backup_information ($tempdir) |
| Load and format all the needed information from moodle_backup.xml.
|
|
static | get_backup_information_from_mbz ($filepath, file_progress $progress=null) |
| Load and format all the needed information from a backup file.
|
|
static | get_blocks_from_path ($path) |
| Load all the blocks information needed for a given path within moodle2 backup.
|
|
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 | 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.
|
|
Non instantiable helper class providing general helper methods for backup/restore.
This class contains various general helper static methods available for backup/restore
TODO: Finish phpdocs
static backup_general_helper::backup_is_samesite |
( |
| $info | ) |
|
|
static |
Given the information fetched from moodle_backup.xml file decide if we are restoring in the same site the backup was generated or no.
Behavior of various parts of restore are dependent of this.
Backups created natively in 2.0 and later declare the hashed site identifier. Backups created by conversion from a 1.9 backup do not declare such identifier, so there is a fallback to wwwroot comparison. See MDL-16614.
static backup_helper::store_backup_file |
( |
| $backupid, |
|
|
| $filepath, |
|
|
core\progress\base | $progress = null ) |
|
staticinherited |
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 | $filepath | zip file containing the backup |
core\progress\base | $progress | Optional progress monitor |
- Return values
-
- Exceptions
-