MDL-37082 core_course: create new course_delete_module function that handles the...
[moodle.git] / course / dnduploadlib.php
index ecb519b..73c8a79 100644 (file)
@@ -616,7 +616,7 @@ class dndupload_ajax_processor {
 
         if (!$instanceid) {
             // Something has gone wrong - undo everything we can.
 
         if (!$instanceid) {
             // Something has gone wrong - undo everything we can.
-            delete_course_module($this->cm->id);
+            course_delete_module($this->cm->id);
             throw new moodle_exception('errorcreatingactivity', 'moodle', '', $this->module->name);
         }
 
             throw new moodle_exception('errorcreatingactivity', 'moodle', '', $this->module->name);
         }
 
@@ -639,7 +639,7 @@ class dndupload_ajax_processor {
         $info = get_fast_modinfo($this->course);
         if (!isset($info->cms[$this->cm->id])) {
             // The course module has not been properly created in the course - undo everything.
         $info = get_fast_modinfo($this->course);
         if (!isset($info->cms[$this->cm->id])) {
             // The course module has not been properly created in the course - undo everything.
-            delete_course_module($this->cm->id);
+            course_delete_module($this->cm->id);
             throw new moodle_exception('errorcreatingactivity', 'moodle', '', $this->module->name);
         }
         $mod = $info->get_cm($this->cm->id);
             throw new moodle_exception('errorcreatingactivity', 'moodle', '', $this->module->name);
         }
         $mod = $info->get_cm($this->cm->id);