(bug 25573) Send Cache-Control: must-revalidate in debug mode
authorRoan Kattouw <catrope@users.mediawiki.org>
Mon, 1 Nov 2010 20:48:30 +0000 (20:48 +0000)
committerRoan Kattouw <catrope@users.mediawiki.org>
Mon, 1 Nov 2010 20:48:30 +0000 (20:48 +0000)
includes/resourceloader/ResourceLoader.php

index 128156b..52520d6 100644 (file)
@@ -293,8 +293,12 @@ class ResourceLoader {
 
                header( 'Content-Type: ' . ( $context->getOnly() === 'styles' ? 'text/css' : 'text/javascript' ) );
                header( 'Last-Modified: ' . wfTimestamp( TS_RFC2822, $mtime ) );
-               header( "Cache-Control: public, max-age=$maxage, s-maxage=$smaxage" );
-               header( 'Expires: ' . wfTimestamp( TS_RFC2822, min( $maxage, $smaxage ) + time() ) );
+               if ( $context->getDebug() ) {
+                       header( 'Cache-Control: must-revalidate' );
+               } else {
+                       header( "Cache-Control: public, max-age=$maxage, s-maxage=$smaxage" );
+                       header( 'Expires: ' . wfTimestamp( TS_RFC2822, min( $maxage, $smaxage ) + time() ) );
+               }
 
                // If there's an If-Modified-Since header, respond with a 304 appropriately
                $ims = $context->getRequest()->getHeader( 'If-Modified-Since' );