From f327b9c3f3165dd19474d6809c629eb04b876095 Mon Sep 17 00:00:00 2001 From: Petr Skoda Date: Sun, 10 Jun 2012 18:14:18 +0200 Subject: [PATCH] MDL-33204 use natural filename sorting when importing books form html --- mod/book/tool/importhtml/locallib.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mod/book/tool/importhtml/locallib.php b/mod/book/tool/importhtml/locallib.php index 7aa04cab1a5..932054ba5f9 100644 --- a/mod/book/tool/importhtml/locallib.php +++ b/mod/book/tool/importhtml/locallib.php @@ -298,10 +298,10 @@ function toolbook_importhtml_get_chapter_files($package, $type) { } } } - // TODO: natural dir sorting would be nice here... - textlib::asort($tophtmlfiles); - textlib::asort($subhtmlfiles); - textlib::asort($topdirs); + + collatorlib::ksort($tophtmlfiles, collatorlib::SORT_NATURAL); + collatorlib::ksort($subhtmlfiles, collatorlib::SORT_NATURAL); + collatorlib::ksort($topdirs, collatorlib::SORT_NATURAL); $chapterfiles = array(); @@ -313,7 +313,7 @@ function toolbook_importhtml_get_chapter_files($package, $type) { if (empty($htmlfiles)) { continue; } - textlib::asort($htmlfiles); + collatorlib::ksort($htmlfiles, collatorlib::SORT_NATURAL); if (isset($htmlfiles[$dir.'/index.html'])) { $htmlfile = $htmlfiles[$dir.'/index.html']; } else if (isset($htmlfiles[$dir.'/index.htm'])) {