MDL-65327 performance: Lazy-load module name strings

This commit is contained in:
Mark Johnson 2019-04-10 16:27:36 +01:00
parent 6735197cc2
commit d91aa1e760
4 changed files with 10 additions and 11 deletions

View file

@ -559,12 +559,10 @@ function get_module_types_names($plural = false) {
if ($allmods = $DB->get_records("modules")) {
foreach ($allmods as $mod) {
if (file_exists("$CFG->dirroot/mod/$mod->name/lib.php") && $mod->visible) {
$modnames[0][$mod->name] = get_string("modulename", "$mod->name");
$modnames[1][$mod->name] = get_string("modulenameplural", "$mod->name");
$modnames[0][$mod->name] = get_string("modulename", "$mod->name", null, true);
$modnames[1][$mod->name] = get_string("modulenameplural", "$mod->name", null, true);
}
}
core_collator::asort($modnames[0]);
core_collator::asort($modnames[1]);
}
}
return $modnames[(int)$plural];