Merge branch 'MDL-68677-38' of git://github.com/andrewnicols/moodle into MOODLE_38_STABLE

This commit is contained in:
Eloy Lafuente (stronk7)
2020-05-15 02:00:39 +02:00
3 changed files with 12 additions and 8 deletions
+1 -1
View File
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+10 -6
View File
@@ -79,11 +79,6 @@ define([
* @return {Object} jQuery promise resolved with the template source
*/
var getTemplatePromiseFromCache = function(searchKey) {
// Do not cache anything if templaterev is not valid.
if (M.cfg.templaterev <= 0) {
return null;
}
// First try the cache of promises.
if (searchKey in templatePromises) {
return templatePromises[searchKey];
@@ -96,6 +91,11 @@ define([
return templatePromises[searchKey];
}
if (M.cfg.templaterev <= 0) {
// Template caching is disabled. Do not store in persistent storage.
return null;
}
// Now try local storage.
var cached = storage.get('core_template/' + M.cfg.templaterev + ':' + searchKey);
if (cached) {
@@ -183,7 +183,11 @@ define([
// Cache all of the dependent templates because we'll need them to render
// the requested template.
templateCache[tempSearchKey] = data.value;
storage.set('core_template/' + M.cfg.templaterev + ':' + tempSearchKey, data.value);
if (M.cfg.templaterev > 0) {
// The template cache is enabled - set the value there.
storage.set('core_template/' + M.cfg.templaterev + ':' + tempSearchKey, data.value);
}
if (data.component == component && data.name == name) {
// This is the original template that was requested so remember it to return.