From: Sam Hemelryk Date: Mon, 5 Aug 2013 01:36:56 +0000 (+1200) Subject: Merge branch 'wip-MDL-34785-master' of git://github.com/marinaglancy/moodle X-Git-Tag: v2.6.0-beta~786 X-Git-Url: http://git.moodle.org/gw?p=moodle.git;a=commitdiff_plain;h=324b489bdba84f35586ae8c908301a6857ead99f;hp=98260b31a50c5533f39af435c8d8fa8d41153813 Merge branch 'wip-MDL-34785-master' of git://github.com/marinaglancy/moodle --- diff --git a/blocks/course_overview/locallib.php b/blocks/course_overview/locallib.php index bc159de98c6..71267b63323 100644 --- a/blocks/course_overview/locallib.php +++ b/blocks/course_overview/locallib.php @@ -31,8 +31,17 @@ function block_course_overview_get_overviews($courses) { $htmlarray = array(); if ($modules = get_plugin_list_with_function('mod', 'print_overview')) { - foreach ($modules as $fname) { - $fname($courses,$htmlarray); + // Split courses list into batches with no more than MAX_MODINFO_CACHE_SIZE courses in one batch. + // Otherwise we exceed the cache limit in get_fast_modinfo() and rebuild it too often. + if (defined('MAX_MODINFO_CACHE_SIZE') && MAX_MODINFO_CACHE_SIZE > 0 && count($courses) > MAX_MODINFO_CACHE_SIZE) { + $batches = array_chunk($courses, MAX_MODINFO_CACHE_SIZE, true); + } else { + $batches = array($courses); + } + foreach ($batches as $courses) { + foreach ($modules as $fname) { + $fname($courses, $htmlarray); + } } } return $htmlarray;