$result = true;
+ // now get rid of all attachments
+ $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');
+ }
+
if (! $DB->delete_records('assignment_submissions', array('assignment'=>$assignment->id))) {
$result = false;
}
$result = false;
}
+
+
// delete file area with all attachments - ignore errors
require_once($CFG->libdir.'/filelib.php');
fulldelete($CFG->dataroot.'/'.$assignment->course.'/'.$CFG->moddata.'/assignment/'.$assignment->id);