]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-10995 course parents cache size now limited
authorskodak <skodak>
Sun, 26 Aug 2007 07:58:20 +0000 (07:58 +0000)
committerskodak <skodak>
Sun, 26 Aug 2007 07:58:20 +0000 (07:58 +0000)
lib/accesslib.php

index fc2438170c0c55f2041276431d534bec1aa3d7ec..cbf0d7511815192031d2fc443c6f3b09dcf08f78 100755 (executable)
@@ -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
             }