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:08 +08:00
parent cd08b5c878
commit 2980ec2eea
+3 -1
View File
@@ -493,8 +493,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);
}