MDL-46147 modinfo: performance improvement for course page (check filterall)

This commit is contained in:
Marina Glancy 2014-07-01 15:28:54 +08:00
parent 0d9805dc14
commit acbf4579d5

View File

@ -1316,6 +1316,7 @@ class cm_info implements IteratorAggregate {
* @return string
*/
public function get_formatted_name($options = array()) {
global $CFG;
$options = (array)$options;
if (!isset($options['context'])) {
$options['context'] = $this->get_context();
@ -1323,7 +1324,9 @@ class cm_info implements IteratorAggregate {
// Improve filter performance by preloading filter setttings for all
// activities on the course (this does nothing if called multiple
// times).
filter_preload_activities($this->get_modinfo());
if (!empty($CFG->filterall)) {
filter_preload_activities($this->get_modinfo());
}
return format_string($this->get_name(), true, $options);
}