MDL-83350 files: Avoid cacheing user and file repo files

Set the lifetime to zero for files referenced in
the local/internal repository (private files and file system),
because they should not be cached.

Add `no-store` to the cache-control to ensure resources are
never cached, always fetching the latest version.
This commit is contained in:
meirzamoodle
2025-05-13 09:37:46 +07:00
parent 6dd1f61866
commit fbca55fa27
3 changed files with 12 additions and 2 deletions
+2 -2
View File
@@ -2609,8 +2609,8 @@ function send_file($path, $filename, $lifetime = null , $filter=0, $pathisstring
header('Cache-Control: private, max-age=10, no-transform');
header('Expires: '. gmdate('D, d M Y H:i:s', 0) .' GMT');
header('Pragma: ');
} else { //normal http - prevent caching at all cost
header('Cache-Control: private, must-revalidate, pre-check=0, post-check=0, max-age=0, no-transform');
} else { // Normal http - prevent caching at all cost.
header('Cache-Control: private, must-revalidate, pre-check=0, post-check=0, max-age=0, no-transform', 'no-store');
header('Expires: '. gmdate('D, d M Y H:i:s', 0) .' GMT');
header('Pragma: no-cache');
}