From ff8018c65c1045cb6728766438e35e90763969c6 Mon Sep 17 00:00:00 2001 From: Marina Glancy Date: Tue, 3 Sep 2013 13:45:00 +1000 Subject: [PATCH] MDL-41517 Do not call fix_course_sortorder unnecessarily Thanks to Thomas Worthington --- course/lib.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/course/lib.php b/course/lib.php index 6ed5bb5f0b2..baec9dffc56 100644 --- a/course/lib.php +++ b/course/lib.php @@ -2402,7 +2402,10 @@ function update_course($data, $editoroptions = NULL) { context_moved($context, $newparent); } - fix_course_sortorder(); + if ($movecat || (isset($data->sortorder) && $oldcourse->sortorder != $data->sortorder)) { + fix_course_sortorder(); + } + // purge appropriate caches in case fix_course_sortorder() did not change anything cache_helper::purge_by_event('changesincourse'); if ($changesincoursecat) {