Skip to content

Commit

Permalink
MDL-40086 file: Correct ordering of subdirectories
Browse files Browse the repository at this point in the history
Thanks to Mohamed Alsharaf for the proposed solution.
  • Loading branch information
Frederic Massart committed Aug 6, 2013
1 parent a31e811 commit bc42e97
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/filestorage/file_storage.php
Expand Up @@ -647,8 +647,10 @@ public function get_area_tree($contextid, $component, $filearea, $itemid) {
protected function sort_area_tree($tree) {
foreach ($tree as $key => &$value) {
if ($key == 'subdirs') {
$value = $this->sort_area_tree($value);
collatorlib::ksort($value, collatorlib::SORT_NATURAL);
foreach ($value as $subdirname => &$subtree) {
$subtree = $this->sort_area_tree($subtree);
}
} else if ($key == 'files') {
collatorlib::ksort($value, collatorlib::SORT_NATURAL);
}
Expand Down

0 comments on commit bc42e97

Please sign in to comment.