* @package MediaWiki
*/
-/** */
-require_once( 'Revision.php' );
-
/**
* @todo document
* @package MediaWiki
$smaxage = $this->mRequest->getIntOrNull( 'smaxage', $wgSquidMaxage );
$maxage = $this->mRequest->getInt( 'maxage', $wgSquidMaxage );
$this->mExpandTemplates = $this->mRequest->getVal( 'templates' ) === 'expand';
+ $this->mUseMessageCache = $this->mRequest->getBool( 'usemsgcache' );
$oldid = $this->mRequest->getInt( 'oldid' );
switch ( $wgRequest->getText( 'direction' ) ) {
}
function getRawText() {
- global $wgUser, $wgOut;
+ global $wgUser, $wgOut, $wgRequest;
if($this->mGen) {
+ // May contain user-specific data; vary for open sessions
+ $wgRequest->response()->header( 'Vary: Accept-Encoding, Cookie' );
$sk = $wgUser->getSkin();
$sk->initPage($wgOut);
if($this->mGen == 'css') {
$text = '';
if( $this->mTitle ) {
// If it's a MediaWiki message we can just hit the message cache
- if ( $this->mTitle->getNamespace() == NS_MEDIAWIKI ) {
- $text = wfMsgForContentNoTrans( $this->mTitle->getDbkey() );
+ if ( $this->mUseMessageCache && $this->mTitle->getNamespace() == NS_MEDIAWIKI ) {
+ $key = $this->mTitle->getDBkey();
+ $text = wfMsgForContentNoTrans( $key );
+ # If the message doesn't exist, return a blank
+ if( wfEmptyMsg( $key, $text ) )
+ $text = '';
$found = true;
} else {
// Get it from the DB
return '';
else
if ( $this->mExpandTemplates ) {
- global $wgTitle;
-
- $parser = new Parser();
- $parser->Options( new ParserOptions() ); // We don't want this to be user-specific
- $parser->Title( $wgTitle );
- $parser->OutputType( OT_HTML );
-
- return $parser->replaceVariables( $text );
+ global $wgParser;
+ return $wgParser->preprocess( $text, $this->mTitle, new ParserOptions() );
} else
return $text;
}