From: Aaron Schulz Date: Thu, 5 Mar 2009 23:04:13 +0000 (+0000) Subject: * Allow for cache hits when the current rev is requested X-Git-Tag: 1.31.0-rc.0~42596 X-Git-Url: http://git.cyclocoop.org/?a=commitdiff_plain;h=a613c358739d4424ca043a4e8837917b1d7ff490;p=lhc%2Fweb%2Fwiklou.git * Allow for cache hits when the current rev is requested * Fixed comments * Fixed type of getLatest() --- diff --git a/includes/Article.php b/includes/Article.php index 0e942de1f0..b79172574e 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -729,16 +729,18 @@ class Article { # Get variables from query string $oldid = $this->getOldID(); - # Try file cache + # Try client and file cache if( $oldid === 0 && $this->checkTouched() ) { global $wgUseETag; if( $wgUseETag ) { $parserCache = ParserCache::singleton(); $wgOut->setETag( $parserCache->getETag($this,$wgUser) ); } + # Is is client cached? if( $wgOut->checkLastModified( $this->getTouched() ) ) { wfProfileOut( __METHOD__ ); return; + # Try file cache } else if( $this->tryFileCache() ) { # tell wgOut that output is taken care of $wgOut->disable(); @@ -932,13 +934,23 @@ class Article { // and we are allowed to see... } } + // Is this the current revision and otherwise cacheable? Try the parser cache... + if( $oldid === $this->getLatest() && $this->useParserCache( false ) + && $wgOut->tryParserCache( $this, $wgUser ) ) + { + $outputDone = true; + } } } + // Ensure that UI elements requiring revision ID have + // the correct version information. $wgOut->setRevisionId( $this->getRevIdFetched() ); - // Pages containing custom CSS or JavaScript get special treatment - if( $this->mTitle->isCssOrJsPage() || $this->mTitle->isCssJsSubpage() ) { + if( $outputDone ) { + // do nothing... + // Pages containing custom CSS or JavaScript get special treatment + } else if( $this->mTitle->isCssOrJsPage() || $this->mTitle->isCssJsSubpage() ) { $wgOut->addHTML( wfMsgExt( 'clearyourcache', 'parse' ) ); // Give hooks a chance to customise the output if( wfRunHooks( 'ShowRawCssJs', array( $this->mContent, $this->mTitle, $wgOut ) ) ) { @@ -3145,7 +3157,7 @@ class Article { if( !$this->mDataLoaded ) { $this->loadPageData(); } - return $this->mLatest; + return (int)$this->mLatest; } /**