Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

MDL-31541 Repositories - make sure all repository instances have uniq…

…ue 'sortorder' values when retrieved
  • Loading branch information...
commit fdb0322d72689556bc3ad57e5e54e5ac03429fe8 1 parent baa5cd8
@davosmith davosmith authored
Showing with 4 additions and 1 deletion.
  1. +4 −1 repository/lib.php
View
5 repository/lib.php
@@ -818,6 +818,9 @@ public static function get_instances($args = array()) {
} else {
$accepted_types = '*';
}
+ // Sortorder should be unique, which is not true if we use $record->sortorder
+ // and there are multiple instances of any repository type
+ $sortorder = 1;
foreach ($records as $record) {
if (!file_exists($CFG->dirroot . '/repository/'. $record->repositorytype.'/lib.php')) {
continue;
@@ -826,7 +829,7 @@ public static function get_instances($args = array()) {
$options['visible'] = $record->visible;
$options['type'] = $record->repositorytype;
$options['typeid'] = $record->typeid;
- $options['sortorder'] = $record->sortorder;
+ $options['sortorder'] = $sortorder++;
// tell instance what file types will be accepted by file picker
$classname = 'repository_' . $record->repositorytype;
Please sign in to comment.
Something went wrong with that request. Please try again.