Fix.
[lhc/web/wiklou.git] / includes / RawPage.php
index 5685385..1a6d6ef 100644 (file)
@@ -10,9 +10,6 @@
  * @package MediaWiki
  */
 
-/** */
-require_once( 'Revision.php' );
-
 /**
  * @todo document
  * @package MediaWiki
@@ -40,6 +37,7 @@ class RawPage {
                $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' ) ) {
@@ -136,8 +134,10 @@ class RawPage {
        }
 
        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') {
@@ -155,8 +155,12 @@ class RawPage {
                $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
@@ -187,14 +191,8 @@ class RawPage {
                        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;
        }