Skip to content

Commit

Permalink
MDL-40889 prevent 304 when minimising JS
Browse files Browse the repository at this point in the history
  • Loading branch information
skodak committed Aug 2, 2013
1 parent a31e811 commit 7c3943a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/jslib.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,12 @@ function js_minify($files) {

require_once("$CFG->libdir/minify/lib/Minify/Loader.php");
Minify_Loader::register();

// We do not really want any 304 here!
// There does not seem to be any better way to prevent them here.
unset($_SERVER['HTTP_IF_NONE_MATCH']);
unset($_SERVER['HTTP_IF_MODIFIED_SINCE']);

if (0 === stripos(PHP_OS, 'win')) {
Minify::setDocRoot(); // IIS may need help
}
Expand All @@ -132,7 +138,7 @@ function js_minify($files) {
$error = 'unknown';
try {
$result = Minify::serve('Files', $options);
if ($result['success']) {
if ($result['success'] and $result['statusCode'] == 200) {
return $result['content'];
}
} catch (Exception $e) {
Expand Down

0 comments on commit 7c3943a

Please sign in to comment.