From 47ba005d0d29be601ac3b8a7377f6979afd28b5c Mon Sep 17 00:00:00 2001 From: skodak Date: Sun, 26 Aug 2007 07:58:20 +0000 Subject: [PATCH] MDL-10995 course parents cache size now limited --- lib/accesslib.php | 5 +++++ 1 file changed, 5 insertions(+) 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 } -- 2.39.5