MDL-40086 file: Correct ordering of subdirectories

Thanks to Mohamed Alsharaf for the proposed solution.
This commit is contained in:
Frederic Massart
2013-08-06 13:53:54 +08:00
parent a31e811563
commit bc42e97989
+3 -1
View File
@@ -647,8 +647,10 @@ class file_storage {
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);
}