From ae67f8201f18221fb778307eb447c81f4244a5fa Mon Sep 17 00:00:00 2001 From: "Eloy Lafuente (stronk7)" Date: Wed, 25 Sep 2013 01:46:53 +0200 Subject: [PATCH] MDL-41889 Use moodle collator for NATURAL sort --- admin/tool/generator/classes/site_backend.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/admin/tool/generator/classes/site_backend.php b/admin/tool/generator/classes/site_backend.php index fe0b60fdc51..9bf6a0c7ff1 100644 --- a/admin/tool/generator/classes/site_backend.php +++ b/admin/tool/generator/classes/site_backend.php @@ -189,7 +189,8 @@ class tool_generator_site_backend extends tool_generator_backend { } // SQL order by is not appropiate here as is ordering strings. $shortnames = array_keys($testcourses); - rsort($shortnames, SORT_NATURAL); + core_collator::asort($shortnames, core_collator::SORT_NATURAL); + $shortnames = array_reverse($shortnames); // They come ordered by shortname DESC, so non-numeric values will be the first ones. $prefixnchars = strlen(self::SHORTNAMEPREFIX);