Merge "WebResponse: Implement statusHeader() using the new HttpStatus::header()"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Thu, 4 Jun 2015 20:24:12 +0000 (20:24 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Thu, 4 Jun 2015 20:24:12 +0000 (20:24 +0000)
1  2 
includes/OutputPage.php

diff --combined includes/OutputPage.php
@@@ -20,8 -20,6 +20,8 @@@
   * @file
   */
  
 +use MediaWiki\Logger\LoggerFactory;
 +
  /**
   * This class should be covered by a general architecture document which does
   * not exist as of January 2011.  This is one of the Core classes and should
@@@ -838,10 -836,10 +838,10 @@@ class OutputPage extends ContextSource 
                }
  
                # Not modified
-               # Give a 304 response code and disable body output
+               # Give a 304 Not Modified response code and disable body output
                wfDebug( __METHOD__ . ": NOT MODIFIED, $info\n", 'log' );
                ini_set( 'zlib.output_compression', 0 );
-               $this->getRequest()->response()->header( "HTTP/1.1 304 Not Modified" );
+               $this->getRequest()->response()->statusHeader( 304 );
                $this->sendCacheControl();
                $this->disable();
  
                        if ( Hooks::run( "BeforePageRedirect", array( $this, &$redirect, &$code ) ) ) {
                                if ( $code == '301' || $code == '303' ) {
                                        if ( !$config->get( 'DebugRedirects' ) ) {
-                                               $message = HttpStatus::getMessage( $code );
-                                               $response->header( "HTTP/1.1 $code $message" );
+                                               $response->statusHeader( $code );
                                        }
                                        $this->mLastModified = wfTimestamp( TS_RFC2822 );
                                }
  
                        return;
                } elseif ( $this->mStatusCode ) {
-                       $message = HttpStatus::getMessage( $this->mStatusCode );
-                       if ( $message ) {
-                               $response->header( 'HTTP/1.1 ' . $this->mStatusCode . ' ' . $message );
-                       }
+                       $response->statusHeader( $this->mStatusCode );
                }
  
                # Buffer output; final headers may depend on later processing
         */
        public function getResourceLoader() {
                if ( is_null( $this->mResourceLoader ) ) {
 -                      $this->mResourceLoader = new ResourceLoader( $this->getConfig() );
 +                      $this->mResourceLoader = new ResourceLoader(
 +                              $this->getConfig(),
 +                              LoggerFactory::getInstance( 'resourceloader' )
 +                      );
                }
                return $this->mResourceLoader;
        }