MDL-48023 Files API: Theme files must be cache-able by shared proxies.

The profile image AKA user icon will be cache-able by shared proxies too,
under its specific accessibility constraints/conditions.
This commit is contained in:
Matteo Scaramuccia 2014-11-09 08:06:46 +01:00
parent c106341098
commit bb8ed60a3c
4 changed files with 37 additions and 9 deletions

View file

@ -88,6 +88,10 @@ function theme_clean_set_logo($css, $logo) {
function theme_clean_pluginfile($course, $cm, $context, $filearea, $args, $forcedownload, array $options = array()) {
if ($context->contextlevel == CONTEXT_SYSTEM and $filearea === 'logo') {
$theme = theme_config::load('clean');
// By default, theme files must be cache-able by both browsers and proxies.
if (!array_key_exists('cacheability', $options)) {
$options['cacheability'] = 'public';
}
return $theme->setting_file_serve('logo', $args, $forcedownload, $options);
} else {
send_file_not_found();

View file

@ -149,6 +149,10 @@ function theme_more_set_logo($css, $logo) {
function theme_more_pluginfile($course, $cm, $context, $filearea, $args, $forcedownload, array $options = array()) {
if ($context->contextlevel == CONTEXT_SYSTEM && ($filearea === 'logo' || $filearea === 'backgroundimage')) {
$theme = theme_config::load('more');
// By default, theme files must be cache-able by both browsers and proxies.
if (!array_key_exists('cacheability', $options)) {
$options['cacheability'] = 'public';
}
return $theme->setting_file_serve($filearea, $args, $forcedownload, $options);
} else {
send_file_not_found();