]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-16220 allow deleting of all files attached to context
authorskodak <skodak>
Wed, 27 Aug 2008 11:46:48 +0000 (11:46 +0000)
committerskodak <skodak>
Wed, 27 Aug 2008 11:46:48 +0000 (11:46 +0000)
mod/assignment/lib.php
mod/forum/lib.php
mod/glossary/lib.php

index 12c6e255e323261683d325a75edbb32a43323bbe..8f92902c6e20b9dc57f4e53b0ccb437dbfdd4cd4 100644 (file)
@@ -391,12 +391,11 @@ class assignment_base {
 
         $result = true;
 
-        // now get rid of all attachments
+        // now get rid of all files
         $fs = get_file_storage();
         if ($cm = get_coursemodule_from_instance('assignment', $assignment->id)) {
             $context = get_context_instance(CONTEXT_MODULE, $cm->id);
-            $fs->delete_area_files($context->id, 'assignment_submission');
-            $fs->delete_area_files($context->id, 'assignment_response');
+            $fs->delete_area_files($context->id);
         }
 
         if (! $DB->delete_records('assignment_submissions', array('assignment'=>$assignment->id))) {
index 508a239ac4db628181ddb66d8d0b2f0dbef6aaea..23a6181718335d3737fda3e4094c65a537374494 100644 (file)
@@ -179,6 +179,13 @@ function forum_delete_instance($id) {
         return false;
     }
 
+    // now get rid of all files
+    $fs = get_file_storage();
+    if ($cm = get_coursemodule_from_instance('forum', $forum->id)) {
+        $context = get_context_instance(CONTEXT_MODULE, $cm->id);
+        $fs->delete_area_files($context->id);
+    }
+
     $result = true;
 
     if ($discussions = $DB->get_records('forum_discussions', array('forum'=>$forum->id))) {
index b7d31fe1b069bcd6be7a90714bcae38d4a409517..9695a8713ecdc4b1441915a0758c723490c80210 100644 (file)
@@ -172,12 +172,8 @@ function glossary_delete_instance($id) {
     $DB->delete_records_select('glossary_entries_categories', "categoryid IN ($category_select)", array($id));
     $DB->delete_records('glossary_categories', array('glossaryid'=>$id));
 
-    // delete attachments
-    if ($attachments = $DB->get_records('glossary_entries', array('glossaryid'=>$id, 'attachment'=>'1'), '', 'id')) {
-        foreach ($attachments as $entryid=>$unused) {
-            $fs->delete_area_files($context->id, 'glossary_attachment', $entryid);
-        }
-    }
+    // delete all files
+    $fs->delete_area_files($context->id);
 
     glossary_grade_item_delete($glossary);