From 03589368a397b57b7e3c96f7ccfe2a1679340416 Mon Sep 17 00:00:00 2001 From: Frederic Massart Date: Tue, 6 Aug 2013 13:46:31 +0800 Subject: [PATCH] MDL-40086 file: Correct ordering of subdirectories Thanks to Mohamed Alsharaf for the proposed solution. --- lib/filestorage/file_storage.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/filestorage/file_storage.php b/lib/filestorage/file_storage.php index 967a3298e71..2b43fa622fd 100644 --- a/lib/filestorage/file_storage.php +++ b/lib/filestorage/file_storage.php @@ -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); }