MDL-19179 cache superfluous queries when listing categories on front page

This commit is contained in:
fmarier
2009-05-14 06:04:35 +00:00
parent f5afcd5d2e
commit dc247e5232
+6 -1
View File
@@ -2067,7 +2067,12 @@ function print_category_info($category, $depth, $showcourses = false) {
$catlinkcss = $category->visible ? '' : ' class="dimmed" ';
$coursecount = $DB->count_records('course') <= FRONTPAGECOURSELIMIT;
static $coursecount = null;
if (null === $coursecount) {
// only need to check this once
$coursecount = $DB->count_records('course') <= FRONTPAGECOURSELIMIT;
}
if ($showcourses and $coursecount) {
$catimage = '<img src="'.$CFG->pixpath.'/i/course.gif" alt="" />';
} else {