Merge "Selenium: replace UserLoginPage with BlankPage where possible"
[lhc/web/wiklou.git] / includes / actions / RawAction.php
index c9d0ae9..f6c4472 100644 (file)
@@ -27,6 +27,7 @@
  */
 
 use MediaWiki\Logger\LoggerFactory;
+use MediaWiki\MediaWikiServices;
 
 /**
  * A simple method to retrieve the plain source of an article,
@@ -49,6 +50,7 @@ class RawAction extends FormlessAction {
 
        /**
         * @suppress SecurityCheck-XSS Non html mime type
+        * @return string|null
         */
        function onView() {
                $this->getOutput()->disable();
@@ -57,16 +59,16 @@ class RawAction extends FormlessAction {
                $config = $this->context->getConfig();
 
                if ( !$request->checkUrlExtension() ) {
-                       return;
+                       return null;
                }
 
                if ( $this->getOutput()->checkLastModified( $this->page->getTouched() ) ) {
-                       return; // Client cache fresh and headers sent, nothing more to do.
+                       return null; // Client cache fresh and headers sent, nothing more to do.
                }
 
                $contentType = $this->getContentType();
 
-               $maxage = $request->getInt( 'maxage', $config->get( 'SquidMaxage' ) );
+               $maxage = $request->getInt( 'maxage', $config->get( 'CdnMaxAge' ) );
                $smaxage = $request->getIntOrNull( 'smaxage' );
                if ( $smaxage === null ) {
                        if (
@@ -86,9 +88,6 @@ class RawAction extends FormlessAction {
 
                // Set standard Vary headers so cache varies on cookies and such (T125283)
                $response->header( $this->getOutput()->getVaryHeader() );
-               if ( $config->get( 'UseKeyHeader' ) ) {
-                       $response->header( $this->getOutput()->getKeyHeader() );
-               }
 
                // Output may contain user-specific data;
                // vary generated content for open sessions on private wikis
@@ -172,6 +171,8 @@ class RawAction extends FormlessAction {
                }
 
                echo $text;
+
+               return null;
        }
 
        /**
@@ -181,8 +182,6 @@ class RawAction extends FormlessAction {
         * @return string|bool
         */
        public function getRawText() {
-               global $wgParser;
-
                $text = false;
                $title = $this->getTitle();
                $request = $this->getRequest();
@@ -221,7 +220,7 @@ class RawAction extends FormlessAction {
                }
 
                if ( $text !== false && $text !== '' && $request->getRawVal( 'templates' ) === 'expand' ) {
-                       $text = $wgParser->preprocess(
+                       $text = MediaWikiServices::getInstance()->getParser()->preprocess(
                                $text,
                                $title,
                                ParserOptions::newFromContext( $this->getContext() )