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:55:25 +08:00
parent f171a8c06e
commit 03589368a3
+3 -1
View File
@@ -644,8 +644,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);
}