Skip to content

Commit

Permalink
MDL-16072 converted forum reset
Browse files Browse the repository at this point in the history
  • Loading branch information
skodak committed Aug 17, 2008
1 parent 272c2c9 commit b6774c8
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion mod/forum/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -6691,9 +6691,14 @@ function forum_reset_userdata($data) {
$DB->delete_records_select('forum_discussions', "forum IN ($forumssql)", $params);

// now get rid of all attachments
$fs = get_file_storage();
if ($forums = $DB->get_records_sql($forumssql, $params)) {
foreach ($forums as $forumid=>$unused) {
fulldelete($CFG->dataroot.'/'.$data->courseid.'/moddata/forum/'.$forumid);
if (!$cm = get_coursemodule_from_instance('forum', $forumid)) {
continue;
}
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
$fs->delete_area_files($context->id, 'forum_attachment');
}
}

Expand Down

0 comments on commit b6774c8

Please sign in to comment.