Merge branch 'MDL-47590_28' of git://github.com/timhunt/moodle into MOODLE_28_STABLE

This commit is contained in:
Sam Hemelryk
2014-11-17 10:38:49 +13:00
+16 -7
View File
@@ -1925,13 +1925,22 @@ class backup_annotate_all_question_files extends backup_execution_step {
$components = backup_qtype_plugin::get_components_and_fileareas();
// Let's loop
foreach($rs as $record) {
// We don't need to specify filearea nor itemid as far as by
// component and context it's enough to annotate the whole bank files
// This backups "questiontext", "generalfeedback" and "answerfeedback" fileareas (all them
// belonging to the "question" component
backup_structure_dbops::annotate_files($this->get_backupid(), $record->contextid, 'question', null, null);
// Again, it is enough to pick files only by context and component
// Do it for qtype specific components
// Backup all the file areas the are managed by the core question component.
// That is, by the question_type base class. In particular, we don't want
// to include files belonging to responses here.
backup_structure_dbops::annotate_files($this->get_backupid(), $record->contextid, 'question', 'questiontext', null);
backup_structure_dbops::annotate_files($this->get_backupid(), $record->contextid, 'question', 'generalfeedback', null);
backup_structure_dbops::annotate_files($this->get_backupid(), $record->contextid, 'question', 'answer', null);
backup_structure_dbops::annotate_files($this->get_backupid(), $record->contextid, 'question', 'answerfeedback', null);
backup_structure_dbops::annotate_files($this->get_backupid(), $record->contextid, 'question', 'hint', null);
backup_structure_dbops::annotate_files($this->get_backupid(), $record->contextid, 'question', 'correctfeedback', null);
backup_structure_dbops::annotate_files($this->get_backupid(), $record->contextid, 'question', 'partiallycorrectfeedback', null);
backup_structure_dbops::annotate_files($this->get_backupid(), $record->contextid, 'question', 'incorrectfeedback', null);
// For files belonging to question types, we make the leap of faith that
// all the files belonging to the question type are part of the question definition,
// so we can just backup all the files in bulk, without specifying each
// file area name separately.
foreach ($components as $component => $fileareas) {
backup_structure_dbops::annotate_files($this->get_backupid(), $record->contextid, $component, null, null);
}