MDL-47494 gapselect: Improve file handling in overall feedback.
authorTim Hunt <T.J.Hunt@open.ac.uk>
Wed, 12 Oct 2011 16:41:04 +0000 (17:41 +0100)
committerTim Hunt <T.J.Hunt@open.ac.uk>
Wed, 12 Oct 2011 16:41:04 +0000 (17:41 +0100)
question/type/gapselect/backup/moodle2/backup_qtype_gapselect_plugin.class.php
question/type/gapselect/questiontypebase.php

index 8af1eec..76a0615 100755 (executable)
@@ -68,17 +68,4 @@ class backup_qtype_gapselect_plugin extends backup_qtype_plugin {
 
         return $plugin;
     }
-
-    /**
-     * Returns one array with filearea => mappingname elements for the qtype
-     *
-     * Used by {@link get_components_and_fileareas} to know about all the qtype
-     * files to be processed both in backup and restore.
-     */
-    public static function get_qtype_fileareas() {
-        return array(
-            'correctfeedback' => 'question_created',
-            'partiallycorrectfeedback' => 'question_created',
-            'incorrectfeedback' => 'question_created');
-    }
 }
index 26c7361..63e19fc 100644 (file)
@@ -312,22 +312,11 @@ abstract class qtype_gapselect_base extends question_type {
 
     public function move_files($questionid, $oldcontextid, $newcontextid) {
         parent::move_files($questionid, $oldcontextid, $newcontextid);
-
-        $fs = get_file_storage();
-        $fs->move_area_files_to_new_context($oldcontextid,
-                $newcontextid, 'question', 'correctfeedback', $questionid);
-        $fs->move_area_files_to_new_context($oldcontextid,
-                $newcontextid, 'question', 'partiallycorrectfeedback', $questionid);
-        $fs->move_area_files_to_new_context($oldcontextid,
-                $newcontextid, 'question', 'incorrectfeedback', $questionid);
+        $this->move_files_in_combined_feedback($questionid, $oldcontextid, $newcontextid);
     }
 
     protected function delete_files($questionid, $contextid) {
         parent::delete_files($questionid, $contextid);
-
-        $fs = get_file_storage();
-        $fs->delete_area_files($contextid, 'question', 'correctfeedback', $questionid);
-        $fs->delete_area_files($contextid, 'question', 'partiallycorrectfeedback', $questionid);
-        $fs->delete_area_files($contextid, 'question', 'incorrectfeedback', $questionid);
+        $this->delete_files_in_combined_feedback($questionid, $contextid);
     }
 }