# This patch file was generated by NetBeans IDE
# This patch can be applied using context Tools: Apply Diff Patch action on respective folder.
# It uses platform neutral UTF-8 encoding.
# Above lines and this line are ignored by the patching process.
Index: moodle/lib/accesslib.php
--- moodle/lib/accesslib.php Base (1.619)
+++ moodle/lib/accesslib.php Locally Modified (Based On 1.619)
@@ -2303,7 +2303,7 @@
  * @return bool properly deleted
  */
 function delete_context($contextlevel, $instanceid) {
-    global $DB, $ACCESSLIB_PRIVATE;
+    global $DB, $ACCESSLIB_PRIVATE, $CFG;
 
     // do not use get_context_instance(), because the related object might not exist,
     // or the context does not exist yet and it would be created now
@@ -2325,6 +2325,10 @@
         blocks_delete_all_for_context($context->id);
         filter_delete_all_for_context($context->id);
 
+        require_once($CFG->libdir.'/filelib.php');
+        $fs = get_file_storage();
+        $fs->delete_area_files($context->id);
+
         return $result;
     } else {
 
