mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 08:22:07 +02:00
MDL-40759 fontawesome: Use a cache
Cache the callback info.
This commit is contained in:
parent
2154c9824d
commit
7e8940b544
@ -48,6 +48,7 @@ $string['cachedef_completion'] = 'Activity completion status';
|
||||
$string['cachedef_databasemeta'] = 'Database meta information';
|
||||
$string['cachedef_eventinvalidation'] = 'Event invalidation';
|
||||
$string['cachedef_externalbadges'] = 'External badges for particular user';
|
||||
$string['cachedef_fontawesomeiconmapping'] = 'Mapping of icons for font awesome';
|
||||
$string['cachedef_suspended_userids'] = 'List of suspended users per course';
|
||||
$string['cachedef_groupdata'] = 'Course group information';
|
||||
$string['cachedef_htmlpurifier'] = 'HTML Purifier - cleaned content';
|
||||
|
@ -431,16 +431,23 @@ class icon_system_fontawesome extends icon_system_font {
|
||||
*/
|
||||
public function get_icon_name_map() {
|
||||
if ($this->map === []) {
|
||||
$this->map = $this->get_core_icon_map();
|
||||
$callback = 'get_fontawesome_icon_map';
|
||||
$cache = \cache::make('core', 'fontawesomeiconmapping');
|
||||
|
||||
if ($pluginsfunction = get_plugins_with_function($callback)) {
|
||||
foreach ($pluginsfunction as $plugintype => $plugins) {
|
||||
foreach ($plugins as $pluginfunction) {
|
||||
$pluginmap = $pluginfunction();
|
||||
$this->map += $pluginmap;
|
||||
$this->map = $cache->get('mapping');
|
||||
|
||||
if (empty($this->map)) {
|
||||
$this->map = $this->get_core_icon_map();
|
||||
$callback = 'get_fontawesome_icon_map';
|
||||
|
||||
if ($pluginsfunction = get_plugins_with_function($callback)) {
|
||||
foreach ($pluginsfunction as $plugintype => $plugins) {
|
||||
foreach ($plugins as $pluginfunction) {
|
||||
$pluginmap = $pluginfunction();
|
||||
$this->map += $pluginmap;
|
||||
}
|
||||
}
|
||||
}
|
||||
$cache->set('mapping', $this->map);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -309,4 +309,14 @@ $definitions = array(
|
||||
'simplevalues' => true,
|
||||
'datasource' => '\core_message\time_last_message_between_users',
|
||||
),
|
||||
|
||||
// Caches font awesome icons.
|
||||
'fontawesomeiconmapping' => array(
|
||||
'mode' => cache_store::MODE_APPLICATION,
|
||||
'simplekeys' => true,
|
||||
'simpledata' => true,
|
||||
'staticacceleration' => true,
|
||||
'staticaccelerationsize' => 1
|
||||
),
|
||||
|
||||
);
|
||||
|
@ -29,7 +29,7 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$version = 2017031600.01; // YYYYMMDD = weekly release date of this DEV branch.
|
||||
$version = 2017031600.02; // YYYYMMDD = weekly release date of this DEV branch.
|
||||
// RR = release increments - 00 in DEV branches.
|
||||
// .XX = incremental changes.
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user