Moodle PHP Documentation 4.2
Moodle 4.2.8 (Build: 20240610) (2d41ac46f45)
core_backup

Namespaces

namespace  core_backup\copy
  
 
namespace  core_backup\output
  
 
namespace  core_backup\privacy
  
 

Classes

class  anonymizer_final_element
 Implementation of backup_final_element that provides one interceptor for anonymization of data. More...
 
class  backup_activities_setting
 root setting to control if backup will include activities or no. More...
 
class  backup_activity_generic_setting
 generic activity setting to pass various settings between tasks and steps More...
 
class  backup_activity_included_setting
 activity backup setting to control if activity will be included or no, depends of @backup_activities_setting and optionally parent section included setting More...
 
class  backup_activity_structure_step
 Abstract structure step, parent of all the activity structure steps. More...
 
class  backup_activity_task
 Provides all the settings and steps to perform one complete backup of the activity. More...
 
class  backup_activity_userinfo_setting
 activity backup setting to control if activity will include user information or no, depends of @backup_users_setting More...
 
class  backup_anonymize_setting
 root setting to control if backup will generate anonymized user info or no, depends of @backup_users_setting so only is available if the former is enabled (apart from security that can change it More...
 
class  backup_badges_setting
 root setting to control if backup will include badges or not, depends on @backup_activities_setting More...
 
class  backup_block_task
 abstract block task that provides all the properties and common steps to be performed when one block is being backup More...
 
class  backup_calendarevents_setting
 root setting to control if backup will include calender events or no (any level), depends of @backup_users_setting exactly in the same way than @backup_anonymize_setting so we extend from it More...
 
class  backup_comments_setting
 root setting to control if backup will include comments or no (any level), depends of @backup_users_setting exactly in the same way than @backup_anonymize_setting so we extend from it More...
 
class  backup_competencies_setting
 root setting to control if backup will include competencies or not. More...
 
class  backup_confirmation_form
 Confirmation backup user interface stage moodleform. More...
 
class  backup_contentbankcontent_setting
 Root setting to control if backup will include content bank content or no. More...
 
class  backup_controller
 Class implementing the controller of any backup process. More...
 
class  backup_controller_exception
 Exception class used by all the @backup_controller stuff. More...
 
class  backup_course_task
 course task that provides all the properties and common steps to be performed when one course is being backup More...
 
class  backup_coursereport_plugin
 
class  backup_customfield_setting
 root setting to control if backup will include custom field information More...
 
class  backup_default_block_task
 Default block task to backup blocks that haven't own DB structures to be added when one block is being backup. More...
 
class  backup_enrol_plugin
 Base class for enrol backup plugins. More...
 
class  backup_filename_setting
 root setting to handle backup file names (no dependencies nor anything else) More...
 
class  backup_files_viewer
 Data structure representing backup files viewer. More...
 
class  backup_final_task
 Final task that provides all the final steps necessary in order to finish one backup (mainly gathering references and creating the main xml) apart from some final cleaning. More...
 
class  backup_format_plugin
 Class extending standard backup_plugin in order to implement some helper methods related with the course formats (format plugin) More...
 
class  backup_generic_setting
 root generic setting to store different things without dependencies More...
 
class  backup_gradingform_plugin
 Base class for backup all advanced grading form plugins. More...
 
class  backup_groups_setting
 root setting to control if backup will include group information depends on @backup_users_setting More...
 
class  backup_initial_form
 Initial backup user interface stage moodleform. More...
 
class  backup_local_plugin
 Class extending standard backup_plugin in order to implement some helper methods related with the local plugins. More...
 
class  backup_logs_setting
 root setting to control if backup will include logs or no (any level), depends of @backup_users_setting exactly in the same way than @backup_anonymize_setting so we extend from it More...
 
class  backup_moodleform
 Backup moodleform bridge. More...
 
class  backup_permissions_setting
 root setting to control if backup will include permission information by roles More...
 
class  backup_plagiarism_plugin
 Class extending standard backup_plugin in order to implement some helper methods related with the plagiarism plugins (plagiarism plugin) More...
 
class  backup_plan_builder
 Abstract class defining the static method in charge of building the whole backup plan, based in @backup_controller preferences. More...
 
class  backup_plugin
 Class implementing the plugins support for moodle2 backups. More...
 
class  backup_qbank_plugin
 Base class for qbank backup plugins. More...
 
class  backup_qtype_extrafields_plugin
 Class extending backup_qtype_plugin in order to use extra fields method. More...
 
class  backup_qtype_plugin
 Class extending standard backup_plugin in order to implement some helper methods related with the questions (qtype plugin) More...
 
class  backup_report_plugin
 
class  backup_role_assignments_setting
 root setting to control if backup will include role assignments or no (any level), depends of @backup_users_setting exactly in the same way than @backup_anonymize_setting so we extend from it More...
 
class  backup_root_task
 Start task that provides all the settings common to all backups and some initialization steps. More...
 
class  backup_schema_form
 Schema backup user interface stage moodleform. More...
 
class  backup_section_generic_setting
 generic section setting to pass various settings between tasks and steps More...
 
class  backup_section_included_setting
 Setting to define if one section is included or no. More...
 
class  backup_section_task
 section task that provides all the properties and common steps to be performed when one section is being backup More...
 
class  backup_section_userinfo_setting
 section backup setting to control if section will include user information or no, depends of @backup_users_setting More...
 
class  backup_setting
 Parent class for all backup settings. More...
 
class  backup_setting_exception
 Exception class used by all the @backup_setting stuff. More...
 
class  backup_setting_ui
 Abstract class to represent the user interface backup settings have. More...
 
class  backup_setting_ui_checkbox
 A checkbox user interface element for backup settings (default) More...
 
class  backup_setting_ui_dateselector
 A date selector user interface widget for backup settings. More...
 
class  backup_setting_ui_defaultcustom
 A wrapper for defaultcustom form element - can have either text or date_selector type. More...
 
class  backup_setting_ui_exception
 Backup setting UI exception class. More...
 
class  backup_setting_ui_radio
 Radio button user interface element for backup settings. More...
 
class  backup_setting_ui_select
 A select box, drop down user interface for backup settings. More...
 
class  backup_setting_ui_text
 A text input user interface element for backup settings. More...
 
class  backup_subplugin
 Class implementing the subplugins support for moodle2 backups. More...
 
class  backup_theme_plugin
 Base class for theme backup plugins. More...
 
class  backup_tool_plugin
 Admin tool backup plugin base class. More...
 
class  backup_ui
 This is the backup user interface class. More...
 
class  backup_ui_exception
 Backup user interface exception. More...
 
class  backup_ui_stage
 Abstract stage class. More...
 
class  backup_ui_stage_complete
 The completed backup stage. More...
 
class  backup_ui_stage_confirmation
 Confirmation stage. More...
 
class  backup_ui_stage_final
 Final stage of backup. More...
 
class  backup_ui_stage_initial
 Class representing the initial stage of a backup. More...
 
class  backup_ui_stage_schema
 Schema stage of backup process. More...
 
class  backup_users_setting
 root setting to control if backup will include user information A lot of other settings are dependent of this (module's user info, grades user info, messages, blogs... More...
 
class  backup_userscompletion_setting
 root setting to control if backup will include users completion data or no (any level), depends of @backup_users_setting exactly in the same way than @backup_anonymize_setting so we extend from it More...
 
class  backup_xapistate_setting
 Root setting to control if backup will include xAPI state or not. More...
 
class  backup_xml_transformer
 Class implementing the @xml_contenttransformed logic to be applied in moodle2 backups. More...
 
class  base64_encode_final_element
 Implementation of backup_final_element that provides base64 encoding. More...
 
class  base_controller
 
class  base_moodleform
 Base moodleform bridge. More...
 
class  base_setting_ui
 Abstract class used to represent the user interface that a setting has. More...
 
class  base_setting_ui_exception
 Base setting UI exception class. More...
 
class  base_ui
 This is the backup user interface class. More...
 
class  base_ui_exception
 Backup user interface exception. More...
 
class  base_ui_stage
 Abstract stage class. More...
 
class  behat_backup
 Backup-related steps definitions. More...
 
class  copy_helper
 
class  core_backup\copy\copy
 Course copy class. More...
 
class  core_backup\output\copy_form
 Course copy form class. More...
 
class  core_backup\privacy\provider
 Privacy Subsystem implementation for core_backup. More...
 
class  core_backup_backup_restore_base_testcase
 Basic testcase class for backup / restore functionality. More...
 
class  core_backup_external
 Backup external functions. More...
 
class  core_backup_html_logger
 
class  core_backup_renderer
 The primary renderer for the backup. More...
 
class  create_and_clean_temp_stuff
 Create the temp dir where backup/restore will happen and create temp ids table. More...
 
class  create_taskbasepath_directory
 Create the directory where all the task (activity/block...) information will be stored. More...
 
class  drop_and_clean_temp_stuff
 Delete the temp dir used by backup/restore (conditionally) and drop temp ids table. More...
 
class  encrypted_final_element
 Implementation of backup_final_element that provides symmetric-key AES-256 encryption of contents. More...
 
class  import_course_search
 Extends the restore course search to search for import courses. More...
 
class  import_ui
 Import UI class. More...
 
class  import_ui_stage_confirmation
 Extends the confirmation stage. More...
 
class  import_ui_stage_final
 Overrides the final stage. More...
 
class  import_ui_stage_inital
 Extends the initial stage. More...
 
class  import_ui_stage_precheck
 Class representing the precheck/selection stage of a import. More...
 
class  import_ui_stage_schema
 Extends the schema stage. More...
 
class  mnethosturl_final_element
 Implementation of backup_final_element that provides special handling of mnethosturl. More...
 
class  restore_activities_setting
 root setting to control if restore will create activities A lot of other settings (_included at activity levels) are dependent of this setting More...
 
class  restore_activity_competencies_structure_step
 Restore activity competencies structure step. More...
 
class  restore_activity_generic_setting
 generic activity setting to pass various settings between tasks and steps More...
 
class  restore_activity_grade_history_structure_step
 Step in charge of restoring the grade history of an activity. More...
 
class  restore_activity_grades_structure_step
 This structure step restores the grade items associated with one activity All the grade items are made child of the "course" grade item but the original categoryid is saved as parentitemid in the backup_ids table, so, when restoring the complete gradebook (categories and calculations), that information is available there. More...
 
class  restore_activity_grading_structure_step
 Defines the restore step for advanced grading methods attached to the activity module. More...
 
class  restore_activity_included_setting
 activity backup setting to control if activity will be included or no, depends of @restore_activities_setting and optionally parent section included setting More...
 
class  restore_activity_logs_structure_step
 This structure step restores activity logs, extending restore_course_logs_structure_step sharing its same structure but modifying the way records are handled. More...
 
class  restore_activity_logstores_structure_step
 Structure step in charge of restoring the logstores.xml file for the activity logs. More...
 
class  restore_activity_structure_step
 Abstract structure step, parent of all the activity structure steps. More...
 
class  restore_activity_task
 abstract activity task that provides all the properties and common tasks to be performed when one activity is being restored More...
 
class  restore_activity_userinfo_setting
 activity backup setting to control if activity will include user information or no, depends of @restore_users_setting More...
 
class  restore_badges_setting
 root setting to control if restore will create badges or not, depends on @restore_activities_setting More...
 
class  restore_badges_structure_step
 This structure steps restores the badges and their configs. More...
 
class  restore_block_instance_structure_step
 This structure steps restores one instance + positions of one block Note: Positions corresponding to one existing context are restored here, but all the ones having unknown contexts are sent to backup_ids for a later chance to be restored at the end (final task) More...
 
class  restore_block_task
 abstract block task that provides all the properties and common steps to be performed when one block is being restored More...
 
class  restore_calendarevents_setting
 root setting to control if restore will create events or no, depends of @restore_users_setting exactly in the same way than @restore_role_assignments_setting so we extend from it More...
 
class  restore_calendarevents_structure_step
 This structure steps restores the calendar events. More...
 
class  restore_category_search
 A category search component. More...
 
class  restore_comments_setting
 root setting to control if restore will create comments or no, depends of @restore_users_setting exactly in the same way than @restore_role_assignments_setting so we extend from it More...
 
class  restore_comments_structure_step
 This structure steps restores the comments Note: Cannot use the comments API because defaults to USER->id. More...
 
class  restore_competencies_setting
 root setting to control if competencies will also be restored. More...
 
class  restore_contentbankcontent_setting
 root setting to control if restore will create content bank content or no More...
 
class  restore_contentbankcontent_structure_step
 This structure steps restores the content bank content. More...
 
class  restore_course_competencies_structure_step
 Restore course competencies structure step. More...
 
class  restore_course_completion_structure_step
 
class  restore_course_defaultcustom_setting
 Setting to switch between current and new course name/startdate. More...
 
class  restore_course_generic_setting
 generic course setting to pass various settings between tasks and steps More...
 
class  restore_course_generic_text_setting
 
class  restore_course_legacy_files_step
 Execution step that will migrate legacy files if present. More...
 
class  restore_course_loglastaccess_structure_step
 Structure step in charge of restoring the loglastaccess.xml file for the course logs. More...
 
class  restore_course_logs_structure_step
 This structure step restores course logs (cmid = 0), delegating the hard work to the corresponding restore_logs_processor passing the collection of restore_log_rule rules to be observed as they are defined by the task. More...
 
class  restore_course_logstores_structure_step
 Structure step in charge of restoring the logstores.xml file for the course logs. More...
 
class  restore_course_overwrite_conf_setting
 Setting to define is we are going to overwrite course configuration. More...
 
class  restore_course_search
 A course search component. More...
 
class  restore_course_structure_step
 Structure step that will read the course.xml file, loading it and performing various actions depending of the site/restore settings. More...
 
class  restore_course_task
 course task that provides all the properties and common steps to be performed when one course is being restored More...
 
class  restore_coursereport_plugin
 
class  restore_create_and_clean_temp_stuff
 delete old directories and conditionally create backup_temp_ids table More...
 
class  restore_create_categories_and_questions
 Structure step in charge of creating/mapping all the qcats and qs by parsing the questions.xml file and checking it against the results calculated by restore_process_categories_and_questions and stored in backup_ids_temp. More...
 
class  restore_create_included_users
 Execution step that will create all the needed users as calculated by @restore_process_included_users (those having newiteind = 0) More...
 
class  restore_create_question_files
 Execution step that will create all the question/answers/qtype-specific files for the restored questions. More...
 
class  restore_customfield_setting
 root setting to control if restore will include custom field information More...
 
class  restore_decode_interlinks
 decode all the interlinks present in restored content relying 100% in the restore_decode_processor that handles both the contents to modify and the rules to be applied More...
 
class  restore_default_block_task
 Default block task to restore blocks not having own DB structures to be added. More...
 
class  restore_default_enrolments_step
 If no instances yet add default enrol methods the same way as when creating new course in UI. More...
 
class  restore_drop_and_clean_temp_stuff
 Drop temp ids table and delete the temp dir used by backup/restore (conditionally). More...
 
class  restore_enrol_plugin
 Base class for enrol backup plugins. More...
 
class  restore_enrolments_structure_step
 This structure steps restores the enrol plugins and their underlying enrolments, performing all the mappings and/or movements required. More...
 
class  restore_execute_after_restore
 Review all the tasks having one after_restore method executing it to perform some final adjustments of information not available when the task was executed. More...
 
class  restore_filters_structure_step
 This structure steps restores the filters and their configs. More...
 
class  restore_final_task
 Final task that provides all the final steps necessary in order to finish one restore like gradebook, interlinks... apart from some final cleaning. More...
 
class  restore_fix_restorer_access_step
 Make sure the user restoring the course can actually access it. More...
 
class  restore_format_plugin
 Class extending standard restore_plugin in order to implement some helper methods related with the course formats (format plugin) More...
 
class  restore_generic_setting
 root generic setting to store different things without dependencies More...
 
class  restore_grade_histories_setting
 root setting to control if restore will create grade_histories or no, depends of @restore_users_setting exactly in the same way than @restore_role_assignments_setting so we extend from it More...
 
class  restore_grade_history_structure_step
 Step in charge of restoring the grade history of a course. More...
 
class  restore_gradebook_structure_step
 Restore calculated grade items, grade categories etc. More...
 
class  restore_gradingform_plugin
 Base class for restoring all advanced grading form plugins. More...
 
class  restore_groups_members_structure_step
 Structure step that will create all the needed group memberships by loading them from the groups.xml file performing the required matches. More...
 
class  restore_groups_setting
 root setting to control if restore will create groups/grouping information. More...
 
class  restore_groups_structure_step
 Structure step that will create all the needed groups and groupings by loading them from the groups.xml file performing the required matches. More...
 
class  restore_load_and_map_roles
 Execution step that, conditionally (if there isn't preloaded information), will load all the needed roles to backup_temp_ids. More...
 
class  restore_load_categories_and_questions
 Execution step that, conditionally (if there isn't preloaded information will load all the question categories and questions (header info only) to backup_temp_ids. More...
 
class  restore_load_included_files
 
class  restore_load_included_inforef_records
 
class  restore_load_included_users
 Execution step that, conditionally (if there isn't preloaded information and users have been selected in settings, will load all the needed users to backup_temp_ids. More...
 
class  restore_local_plugin
 Class extending standard restore_plugin in order to implement some helper methods related with local plugins. More...
 
class  restore_logs_setting
 root setting to control if restore will create logs or no, depends of @restore_users_setting exactly in the same way than @restore_role_assignments_setting so we extend from it More...
 
class  restore_module_structure_step
 Structure step to restore common course_module information. More...
 
class  restore_moodleform
 An abstract moodleform class specially designed for the restore forms. More...
 
class  restore_move_module_questions_categories
 Execution step that will move all the CONTEXT_MODULE question categories created at early stages of restore in course context (because modules weren't created yet) to their target module (matching by old-new-contextid mapping) More...
 
class  restore_outcomes_structure_step
 Structure step that will create all the needed outocomes by loading them from the outcomes.xml. More...
 
class  restore_permissions_setting
 root setting to control if restore will create override permission information by roles More...
 
class  restore_plagiarism_plugin
 Class extending standard restore_plugin in order to implement some helper methods related with the plagiarism plugins. More...
 
class  restore_plan_builder
 Abstract class defining the static method in charge of building the whole restore plan, based in @restore_controller preferences. More...
 
class  restore_plugin
 Class implementing the plugins support for moodle2 restore. More...
 
class  restore_process_categories_and_questions
 Execution step that, conditionally (if there isn't preloaded information) will process all the needed categories and questions in order to decide and perform any action with them (create / map / error) Note: Any error will cause exception, as far as this is the same processing than the one into restore prechecks (that should have stopped process earlier) More...
 
class  restore_process_course_modules_availability
 Process legacy module availability records in backup_ids. More...
 
class  restore_process_file_aliases_queue
 Try to restore aliases and references to external files. More...
 
class  restore_process_included_users
 Execution step that, conditionally (if there isn't preloaded information and users have been selected in settings, will process all the needed users in order to decide and perform any action with them (create / map / error) Note: Any error will cause exception, as far as this is the same processing than the one into restore prechecks (that should have stopped process earlier) More...
 
class  restore_qbank_plugin
 Base class for qbank backup plugins. More...
 
class  restore_qtype_extrafields_plugin
 Class extending restore_qtype_plugin in order to use extra fields method. More...
 
class  restore_qtype_plugin
 Class extending standard restore_plugin in order to implement some helper methods related with the questions (qtype plugin) More...
 
class  restore_ras_and_caps_structure_step
 
class  restore_rebuild_course_cache
 first, ensure that we have no gaps in section numbers and then, rebuid the course cache More...
 
class  restore_report_plugin
 
class  restore_review_form
 Restore complete process review form. More...
 
class  restore_review_pending_block_positions
 Review all the (pending) block positions in backup_ids, matching by contextid, creating positions as needed. More...
 
class  restore_role_assignments_setting
 root setting to control if restore will create role assignments or no (any level), depends of @restore_users_setting More...
 
class  restore_root_task
 Start task that provides all the settings common to all restores and other initial steps. More...
 
class  restore_scales_structure_step
 Structure step that will create all the needed scales by loading them from the scales.xml. More...
 
class  restore_schema_form
 Restore schema review form. More...
 
class  restore_search_base
 A base class that can be used to build a specific search upon. More...
 
class  restore_section_generic_setting
 generic section setting to pass various settings between tasks and steps More...
 
class  restore_section_included_setting
 Setting to define if one section is included or no. More...
 
class  restore_section_structure_step
 Structure step that will read the section.xml creating/updating sections as needed, rebuilding course cache and other friends. More...
 
class  restore_section_task
 section task that provides all the properties and common steps to be performed when one section is being restored More...
 
class  restore_section_userinfo_setting
 section backup setting to control if section will include user information or no, depends of @restore_users_setting More...
 
class  restore_settings_form
 Restore settings form. More...
 
class  restore_subplugin
 Class implementing the subplugins support for moodle2 restore. More...
 
class  restore_theme_plugin
 
class  restore_tool_plugin
 Admin tool restore plugin base class. More...
 
class  restore_ui
 This is the restore user interface class. More...
 
class  restore_ui_exception
 Restore user interface exception. More...
 
class  restore_ui_independent_stage
 Abstract class used to represent a restore stage that is indenependent. More...
 
class  restore_ui_stage
 Abstract stage class. More...
 
class  restore_ui_stage_complete
 This is the completed stage. More...
 
class  restore_ui_stage_confirm
 The confirmation stage. More...
 
class  restore_ui_stage_destination
 This is the destination stage. More...
 
class  restore_ui_stage_process
 Final stage of backup. More...
 
class  restore_ui_stage_review
 Confirmation stage. More...
 
class  restore_ui_stage_schema
 Schema stage of backup process. More...
 
class  restore_ui_stage_settings
 This stage is the settings stage. More...
 
class  restore_update_availability
 Updates the availability data for course modules and sections. More...
 
class  restore_users_setting
 root setting to control if restore will create user information A lot of other settings are dependent of this (module's user info, grades user info, messages, blogs... More...
 
class  restore_userscompletion_setting
 root setting to control if restore will create completion info or no, depends of @restore_users_setting exactly in the same way than @restore_role_assignments_setting so we extend from it More...
 
class  restore_userscompletion_structure_step
 Structure step that will process the user activity completion information if all these conditions are met: More...
 
class  restore_xapistate_setting
 Root setting to control if restore will create xAPI states or not. More...
 
class  restore_xapistate_structure_step
 This structure steps restores the xAPI states. More...
 
class  root_backup_setting
 Abstract class containing all the common stuff for root backup settings. More...
 

Functions

 encrypted_final_element::__construct ($name, $attributes=null)
 Constructor - instantiates a encrypted_final_element, specifying its basic info.
 
 add_question_usages ($element, &$paths, $nameprefix='')
 Attach below $element (usually attempts) the needed restore_path_elements to restore question_usages and all they contain.
 
 after_execute ()
 
static encrypted_final_element::generate_encryption_random_key ($bytes)
 Generate an appropiate random key to be used for encrypting backup information.
 
 get_qtype_restorer ($qtype)
 Get the restore_qtype_plugin subclass for a specific question type.
 
 inform_new_usage_id ($newusageid)
 When process_question_usage creates the new usage, it calls this method to let the activity link to the new usage.
 
 process_question_attempt ($data)
 Process question_attempts.
 
 process_question_attempt_step ($data)
 Process question_attempt_steps.
 
 process_question_usage ($data)
 Process question_usages.
 
 questions_recode_layout ($layout)
 Given a list of question->ids, separated by commas, returns the recoded list, with all the restore question mappings applied.
 
 questions_recode_response_data ( $qtype, $newquestionid, $sequencenumber, array $response)
 Recode the respones data for a particular step of an attempt at at particular question.
 
 restore_question_attempt_step_worker ($data, $nameprefix)
 This method does the actual work for process_question_attempt_step or process_{nameprefix}_question_attempt_step.
 
 restore_question_attempt_worker ($data, $nameprefix)
 This method does the actual work for process_question_attempt or process_{nameprefix}_question_attempt.
 
 restore_question_usage_worker ($data, $nameprefix)
 This method does the actual work for process_question_usage or process_{nameprefix}_question_usage.
 
 encrypted_final_element::set_key ($key)
 Set the encryption key manually, overriding default backup_encryptkey config.
 
 anonymizer_final_element::set_value ($value)
 
 base64_encode_final_element::set_value ($value)
 Set the value for the final element, encoding it as utf-8/xml safe base64.
 
 encrypted_final_element::set_value ($value)
 Set the value of the field.
 
 mnethosturl_final_element::set_value ($value)
 

Variables

foreach($mods as $mod=> $moddir) $blocks = core_component::get_plugin_list('block')
 
foreach($mods as $mod=> $moddir) $blocks = core_component::get_plugin_list('block')
 
global $CFG
 
global $CFG
 
global $CFG
 
global $CFG
 
global core_backup\copy::$CFG
 
string encrypted_final_element::$key = null
 cypher appropiate raw key for backups in the site.
 
global $LINKS_ENCODERS_CACHE = array()
 
 $mods = core_component::get_plugin_list('mod')
 
 $mods = core_component::get_plugin_list('mod')
 
array $newquestionids = array()
 question_attempt->id to questionid.
 
trait restore_questions_attempt_data_trait
 Helper code for use by any plugin that stores question attempt data that it needs to back up.
 

Detailed Description

Function Documentation

◆ __construct()

encrypted_final_element::__construct ( $name,
$attributes = null )

Constructor - instantiates a encrypted_final_element, specifying its basic info.

Overridden to automatically add the 'encrypted' attribute if missing.

Parameters
string$namename of the element
array$attributesattributes this element will handle (optional, defaults to null)

Reimplemented from base_final_element.

◆ add_question_usages()

add_question_usages ( $element,
& $paths,
$nameprefix = '' )
protected

Attach below $element (usually attempts) the needed restore_path_elements to restore question_usages and all they contain.

If you use the $nameprefix parameter, then you will need to implement some extra methods in your class, like

protected function process_{nameprefix}question_attempt($data) { $this->restore_question_usage_worker($data, '{nameprefix}'); } protected function process_{nameprefix}question_attempt($data) { $this->restore_question_attempt_worker($data, '{nameprefix}'); } protected function process_{nameprefix}question_attempt_step($data) { $this->restore_question_attempt_step_worker($data, '{nameprefix}'); }

Parameters
restore_path_element$elementthe parent element that the usages are stored inside.
array$pathsthe paths array that is being built.
string$nameprefixshould match the prefix passed to the corresponding backup_questions_activity_structure_step\add_question_usages call.

◆ generate_encryption_random_key()

static encrypted_final_element::generate_encryption_random_key ( $bytes)
staticprotected

Generate an appropiate random key to be used for encrypting backup information.

Normally used as site default encryption key (backup_encryptkey config) and also for calculating the init vectors.

Note that until PHP 5.6.12 openssl_random_pseudo_bytes() did NOT use a "cryptographically strong algorithm" But it's beyond my crypto-knowledge when it's worth finding a real better alternative.

Parameters
int$bytesNumber of bytes to determine the key length expected.

◆ get_qtype_restorer()

get_qtype_restorer ( $qtype)
protected

Get the restore_qtype_plugin subclass for a specific question type.

Parameters
string$qtypee.g. multichoice.
Return values
restore_qtype_plugininstance.

◆ inform_new_usage_id()

inform_new_usage_id ( $newusageid)
abstractprotected

When process_question_usage creates the new usage, it calls this method to let the activity link to the new usage.

For example, the quiz uses this method to set quiz_attempts.uniqueid to the new usage id.

Parameters
integer$newusageid

◆ questions_recode_layout()

questions_recode_layout ( $layout)
protected

Given a list of question->ids, separated by commas, returns the recoded list, with all the restore question mappings applied.

Note: Used by quiz->questions and quiz_attempts->layout Note: 0 = page break (unconverted)

◆ questions_recode_response_data()

questions_recode_response_data ( $qtype,
$newquestionid,
$sequencenumber,
array $response )

Recode the respones data for a particular step of an attempt at at particular question.

Parameters
string$qtypethe question type.
int$newquestionidthe question id.
int$sequencenumberthe sequence number.
array$responsethe response data to recode.

◆ restore_question_attempt_step_worker()

restore_question_attempt_step_worker ( $data,
$nameprefix )
protected

This method does the actual work for process_question_attempt_step or process_{nameprefix}_question_attempt_step.

Parameters
array$datathe data from the XML file.
string$nameprefixthe element name prefix.

◆ restore_question_attempt_worker()

restore_question_attempt_worker ( $data,
$nameprefix )
protected

This method does the actual work for process_question_attempt or process_{nameprefix}_question_attempt.

Parameters
array$datathe data from the XML file.
string$nameprefixthe element name prefix.

◆ restore_question_usage_worker()

restore_question_usage_worker ( $data,
$nameprefix )
protected

This method does the actual work for process_question_usage or process_{nameprefix}_question_usage.

Parameters
array$datathe data from the XML file.
string$nameprefixthe element name prefix.

◆ set_key()

encrypted_final_element::set_key ( $key)
protected

Set the encryption key manually, overriding default backup_encryptkey config.

Parameters
string$keykey to be used for encrypting. Required to be 256-bit key. Use a safe generation technique. See self\generate_encryption_random_key() below.

◆ set_value() [1/4]

anonymizer_final_element::set_value ( $value)

Reimplemented from base_atom.

◆ set_value() [2/4]

base64_encode_final_element::set_value ( $value)

Set the value for the final element, encoding it as utf-8/xml safe base64.

Parameters
string$valueOriginal value coming from backup step source, usually db.

Reimplemented from base_atom.

◆ set_value() [3/4]

encrypted_final_element::set_value ( $value)

Set the value of the field.

This method sets the value of the element, encrypted using the specified key for it, defaulting to (and generating) backup_encryptkey config. HMAC is used for integrity.

Parameters
string$valueplain-text content the will be stored encrypted and encoded.

Reimplemented from base_atom.

◆ set_value() [4/4]

mnethosturl_final_element::set_value ( $value)

Reimplemented from base_atom.

Variable Documentation

◆ $key

string encrypted_final_element::$key = null
protected

cypher appropiate raw key for backups in the site.

Defaults to backup_encryptkey config.

◆ restore_questions_attempt_data_trait

trait restore_questions_attempt_data_trait
Initial value:
{
protected array $qtypes = array()

Helper code for use by any plugin that stores question attempt data that it needs to back up.