Skip to content

Commit

Permalink
MDL-15904 fixed assignment instance deleting
Browse files Browse the repository at this point in the history
  • Loading branch information
skodak committed Aug 17, 2008
1 parent de7295a commit dc85b32
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions mod/assignment/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,14 @@ function delete_instance($assignment) {

$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;
}
Expand All @@ -403,6 +411,8 @@ function delete_instance($assignment) {
$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);
Expand Down

0 comments on commit dc85b32

Please sign in to comment.