Skip to content
Browse files

Merge branch 'MDL-35637_master' of git://github.com/markn86/moodle

  • Loading branch information...
2 parents a499689 + 5a45b93 commit a5fc5b6cebbff3d07fff6b509a4243b70260a5c0 @stronk7 stronk7 committed Oct 1, 2012
Showing with 11 additions and 10 deletions.
  1. +11 −10 group/lib.php
View
21 group/lib.php
@@ -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);
}
}

0 comments on commit a5fc5b6

Please sign in to comment.
Something went wrong with that request. Please try again.