MDL-35637 group: Fix form submission error that occurs when GD version is not set.
This commit is contained in:
+11
-10
@@ -311,17 +311,18 @@ function groups_update_group_icon($group, $data, $editform) {
|
||||
$context = context_course::instance($group->courseid, MUST_EXIST);
|
||||
|
||||
//TODO: it would make sense to allow picture deleting too (skodak)
|
||||
|
||||
if ($iconfile = $editform->save_temp_file('imagefile')) {
|
||||
if (process_new_icon($context, 'group', 'icon', $group->id, $iconfile)) {
|
||||
$DB->set_field('groups', 'picture', 1, array('id'=>$group->id));
|
||||
$group->picture = 1;
|
||||
} else {
|
||||
$fs->delete_area_files($context->id, 'group', 'icon', $group->id);
|
||||
$DB->set_field('groups', 'picture', 0, array('id'=>$group->id));
|
||||
$group->picture = 0;
|
||||
if (!empty($CFG->gdversion)) {
|
||||
if ($iconfile = $editform->save_temp_file('imagefile')) {
|
||||
if (process_new_icon($context, 'group', 'icon', $group->id, $iconfile)) {
|
||||
$DB->set_field('groups', 'picture', 1, array('id'=>$group->id));
|
||||
$group->picture = 1;
|
||||
} else {
|
||||
$fs->delete_area_files($context->id, 'group', 'icon', $group->id);
|
||||
$DB->set_field('groups', 'picture', 0, array('id'=>$group->id));
|
||||
$group->picture = 0;
|
||||
}
|
||||
@unlink($iconfile);
|
||||
}
|
||||
@unlink($iconfile);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user