Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 3.9.x will end* 10 May 2021 (12 months).
  • Bug fixes for security issues in 3.9.x will end* 8 May 2023 (36 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.

Differences Between: [Versions 39 and 310] [Versions 39 and 311] [Versions 39 and 400] [Versions 39 and 401] [Versions 39 and 402] [Versions 39 and 403]

(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: 709 lines (32 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: backup_controller_dbops  - X-Ref

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
save_controller($controller, $checksum, $includeobj = true, $cleanobj = false)   X-Ref
Send one backup controller to DB

param: backup_controller $controller controller to send to DB
param: string $checksum hash of the controller to be checked
param: bool $includeobj to decide if the object itself must be updated (true) or no (false)
param: bool $cleanobj to decide if the object itself must be cleaned (true) or no (false)
return: int id of the controller record in the DB

load_controller($backupid)   X-Ref
No description

create_backup_ids_temp_table($backupid)   X-Ref
No description

create_backup_files_temp_table($backupid)   X-Ref
No description

drop_backup_ids_temp_table($backupid)   X-Ref
No description

decode_backup_temp_info($info)   X-Ref
Decode the info field from backup_ids_temp or backup_files_temp.

param: mixed $info The info field data to decode, may be an object or a simple integer.
return: mixed The decoded information.  For simple types it returns, for complex ones we decode.

encode_backup_temp_info($info)   X-Ref
Encode the info field for backup_ids_temp or backup_files_temp.

param: mixed $info string The info field data to encode.
return: string An encoded string of data or null if the input is null.

get_courseid_from_type_id($type, $id)   X-Ref
Given one type and id from controller, return the corresponding courseid


get_activity_backup_information($task)   X-Ref
Given one activity task, return the activity information and related settings
Used by get_moodle_backup_information()


get_section_backup_information($task)   X-Ref
Given one section task, return the section information and related settings
Used by get_moodle_backup_information()


get_course_backup_information($task)   X-Ref
Given one course task, return the course information and related settings
Used by get_moodle_backup_information()


get_root_backup_information($task)   X-Ref
Given one root task, return the course information and related settings
Used by get_moodle_backup_information()


get_moodle_backup_information($backupid,\core\progress\base $progress = null)   X-Ref
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).

param: string $backupid Backup ID
param: \core\progress\base $progress Optional progress monitor

apply_version_and_release()   X-Ref
Update CFG->backup_version and CFG->backup_release if change in
version is detected.


backup_includes_mnet_remote_users($backupid)   X-Ref
Given the backupid, detect if the backup includes "mnet" remote users or no


backup_includes_files($backupid)   X-Ref
Given the backupid, determine whether this backup should include
files from the moodle file storage system.

param: string $backupid The ID of the backup.
return: int Indicates whether files should be included in backups.

backup_includes_file_references($backupid)   X-Ref
Given the backupid, detect if the backup contains references to external contents

return: int

backup_get_original_course_info($courseid)   X-Ref
Given the courseid, return some course related information we want to transport

param: int $course the id of the course this backup belongs to

apply_config_defaults(backup_controller $controller)   X-Ref
Sets the default values for the settings in a backup operation

Based on the mode of the backup it will load proper defaults
using {@link apply_admin_config_defaults}.

param: backup_controller $controller

force_enable_settings(backup_controller $controller, array $settings)   X-Ref
Turn these settings on. No defaults from admin settings.

param: backup_controller $controller
param: array $settings a map from admin config names to setting names (Config name => Setting name)

apply_admin_config_defaults(backup_controller $controller, array $settings, $uselocks)   X-Ref
Sets the controller settings default values from the admin config.

param: backup_controller $controller
param: array $settings a map from admin config names to setting names (Config name => Setting name)
param: boolean $uselocks whether "locked" admin settings should be honoured

get_progress($backupid)   X-Ref
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.

param: string $backupid The backup id to query.
return: array $progress The backup progress details.