MDL-19179 cache superfluous queries when listing categories on front page
This commit is contained in:
+6
-1
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user