r72794 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r72793‎ | r72794 | r72795 >
Date:10:06, 11 September 2010
Author:nikerabbit
Status:ok
Tags:
Comment:
Another approach for caching
Modified paths:
  • /trunk/extensions/Translate/SpecialTranslationStats.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Translate/SpecialTranslationStats.php
@@ -82,25 +82,21 @@
8383 if ( $this->including() ) {
8484 $wgOut->addHTML( $this->image( $opts ) );
8585 } elseif ( $opts['graphit'] ) {
86 - // Cache for two hours
87 - if ( !$opts['preview'] ) {
88 - $lastMod = $wgOut->checkLastModified( wfTimestamp( TS_MW, time() - 2 * 3600 ) );
8986
90 - if ( $lastMod ) {
91 - return;
92 - }
93 - }
94 -
95 - if ( !$wgRequest->getBool( 'debug' ) ) {
96 - $wgOut->disable();
97 - }
98 -
9987 if ( !class_exists( 'PHPlot' ) ) {
10088 header( "HTTP/1.0 500 Multi fail" );
10189 echo "PHPlot not found";
10290 }
10391
10492 $this->draw( $opts );
 93+
 94+ if ( !$wgRequest->getBool( 'debug' ) ) {
 95+ $wgOut->disable();
 96+ header( 'Content-Type: image/png' );
 97+ header( 'Cache-Control: private, max-age=3600' );
 98+ header( 'Expires: ' . wfTimestamp( TS_RFC2822, time() + 3600 ) );
 99+ }
 100+
105101 } else {
106102 $this->form( $opts );
107103 }

Status & tagging log