From: skodak Date: Sun, 26 Aug 2007 07:58:20 +0000 (+0000) Subject: MDL-10995 course parents cache size now limited X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=47ba005d0d29be601ac3b8a7377f6979afd28b5c;p=moodle.git MDL-10995 course parents cache size now limited --- diff --git a/lib/accesslib.php b/lib/accesslib.php index fc2438170c..cbf0d75118 100755 --- a/lib/accesslib.php +++ b/lib/accesslib.php @@ -311,6 +311,11 @@ function get_parent_cats($context) { if (array_key_exists($context->instanceid, $courseparents)) { return $courseparents[$context->instanceid]; } + + if (count($courseparents) > 1000) { + $courseparents = array(); // max cache size when looping through thousands of courses + } + if ($context->instanceid == SITEID) { return $courseparents[$context->instanceid] = array(); // frontpage course does not have parent cats }