Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.10.x will end 8 November 2021 (12 months).
  • Bug fixes for security issues in 3.10.x will end 9 May 2022 (18 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are supported too.

(no description)

Copyright: 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 338 lines (14 kb)
Included or required:0 times
Referenced: 3 times
Includes or requires: 0 files

Defines 1 class


Class: backup_general_helper  - X-Ref

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
array_checksum_recursive($arr)   X-Ref
Calculate one checksum for any array/object. Works recursively


get_blocks_from_path($path)   X-Ref
Load all the blocks information needed for a given path within moodle2 backup

This function, given one full path (course, activities/xxxx) will look for all the
blocks existing in the backup file, returning one array used to build the
proper restore plan by the @restore_plan_builder

get_backup_information($tempdir)   X-Ref
Load and format all the needed information from moodle_backup.xml

This function loads and process all the moodle_backup.xml
information, composing a big information structure that will
be the used by the plan builder in order to generate the
appropiate tasks / steps / settings

get_backup_information_from_mbz($filepath, file_progress $progress = null)   X-Ref
Load and format all the needed information from a backup file.

This will only extract the moodle_backup.xml file from an MBZ
file and then call {@link self::get_backup_information()}.

This can be a long-running (multi-minute) operation for large backups.
Pass a $progress value to receive progress updates.

param: string $filepath absolute path to the MBZ file.
param: file_progress $progress Progress updates
return: stdClass containing information.

backup_is_samesite($info)   X-Ref
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.

detect_backup_format($tempdir)   X-Ref
Detects the format of the given unpacked backup directory

param: string $tempdir the name of the backup directory
return: string one of backup::FORMAT_xxx constants