Merge branch 'MDL-69698-39-licensecache' of git://github.com/mudrd8mz/moodle into MOODLE_39_STABLE

This commit is contained in:
Eloy Lafuente (stronk7)
2020-09-24 16:50:47 +02:00
2 changed files with 12 additions and 9 deletions
+2 -2
View File
@@ -466,7 +466,7 @@ $definitions = array(
// Cache for licenses.
'license' => [
'mode' => cache_store::MODE_APPLICATION,
'simplekeys' => false,
'simpledata' => false
'simplekeys' => true,
'simpledata' => false,
],
);
+10 -7
View File
@@ -227,21 +227,24 @@ class license_manager {
$cache = \cache::make('core', 'license');
$licenses = $cache->get('licenses');
if (empty($licenses)) {
if ($licenses === false) {
$licenses = [];
$records = $DB->get_records_select('license', null, null, 'sortorder ASC');
foreach ($records as $license) {
// Interpret core license strings for internationalisation.
if ($license->custom == self::CORE_LICENSE) {
$license->fullname = get_string($license->shortname, 'license');
} else {
$license->fullname = format_string($license->fullname);
}
$licenses[$license->shortname] = $license;
}
$cache->set('licenses', $licenses);
}
foreach ($licenses as $license) {
// Localise the license names.
if ($license->custom == self::CORE_LICENSE) {
$license->fullname = get_string($license->shortname, 'core_license');
} else {
$license->fullname = format_string($license->fullname);
}
}
return $licenses;
}