MDL-41889 Use moodle collator for NATURAL sort
authorEloy Lafuente (stronk7) <stronk7@moodle.org>
Tue, 24 Sep 2013 23:46:53 +0000 (01:46 +0200)
committerEloy Lafuente (stronk7) <stronk7@moodle.org>
Tue, 24 Sep 2013 23:46:53 +0000 (01:46 +0200)
admin/tool/generator/classes/site_backend.php

index fe0b60f..9bf6a0c 100644 (file)
@@ -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);