]> git.mjollnir.org Git - moodle.git/commitdiff
accesslib: MDL-17626 admin/modules.php should call delete_context when a module is...
authortjhunt <tjhunt>
Fri, 9 Jan 2009 05:34:49 +0000 (05:34 +0000)
committertjhunt <tjhunt>
Fri, 9 Jan 2009 05:34:49 +0000 (05:34 +0000)
admin/modules.php

index ffb22524b7c218cb987b9b0598c1cfa199d81474..143a68a10e5319b73bd34f1ea7ffa1249be9e0d0 100644 (file)
             if (!$DB->delete_records("course_modules", array("module"=>$module->id))) {
                 notify("Error occurred while deleting all $strmodulename records in course_modules table");
             }
+            if ($coursemods) {
+                foreach ($coursemods as $coursemod) {
+                    if (!delete_context(CONTEXT_MODULE, $coursemod->id)) {
+                        notify("Could not delete the context for $strmodulename with id = $coursemod->id");
+                    }
+                }
+            }
 
             // Then delete all the logs
             if (!$DB->delete_records("log", array("module"=>$module->name))) {