merged master
[lhc/web/wiklou.git] / includes / api / ApiMain.php
index 695eccd..7405e91 100644 (file)
@@ -4,7 +4,7 @@
  *
  * Created on Sep 4, 2006
  *
- * Copyright © 2006 Yuri Astrakhan <Firstname><Lastname>@gmail.com
+ * Copyright © 2006 Yuri Astrakhan "<Firstname><Lastname>@gmail.com"
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -104,6 +104,7 @@ class ApiMain extends ApiBase {
                'dbgfm' => 'ApiFormatDbg',
                'dump' => 'ApiFormatDump',
                'dumpfm' => 'ApiFormatDump',
+               'none' => 'ApiFormatNone',
        );
 
        /**
@@ -491,6 +492,11 @@ class ApiMain extends ApiBase {
        protected function sendCacheHeaders() {
                global $wgUseXVO, $wgVaryOnXFP;
                $response = $this->getRequest()->response();
+               $out = $this->getOutput();
+
+               if ( $wgVaryOnXFP ) {
+                       $out->addVaryHeader( 'X-Forwarded-Proto' );
+               }
 
                if ( $this->mCacheMode == 'private' ) {
                        $response->header( 'Cache-Control: private' );
@@ -498,13 +504,9 @@ class ApiMain extends ApiBase {
                }
 
                if ( $this->mCacheMode == 'anon-public-user-private' ) {
-                       $xfp = $wgVaryOnXFP ? ', X-Forwarded-Proto' : '';
-                       $response->header( 'Vary: Accept-Encoding, Cookie' . $xfp );
+                       $out->addVaryHeader( 'Cookie' );
+                       $response->header( $out->getVaryHeader() );
                        if ( $wgUseXVO ) {
-                               $out = $this->getOutput();
-                               if ( $wgVaryOnXFP ) {
-                                       $out->addVaryHeader( 'X-Forwarded-Proto' );
-                               }
                                $response->header( $out->getXVO() );
                                if ( $out->haveCacheVaryCookies() ) {
                                        // Logged in, mark this request private
@@ -521,12 +523,9 @@ class ApiMain extends ApiBase {
                }
 
                // Send public headers
-               if ( $wgVaryOnXFP ) {
-                       $response->header( 'Vary: Accept-Encoding, X-Forwarded-Proto' );
-                       if ( $wgUseXVO ) {
-                               // Bleeeeegh. Our header setting system sucks
-                               $response->header( 'X-Vary-Options: Accept-Encoding;list-contains=gzip, X-Forwarded-Proto' );
-                       }
+               $response->header( $out->getVaryHeader() );
+               if ( $wgUseXVO ) {
+                       $response->header( $out->getXVO() );
                }
 
                // If nobody called setCacheMaxAge(), use the (s)maxage parameters
@@ -969,11 +968,11 @@ class ApiMain extends ApiBase {
        protected function getCredits() {
                return array(
                        'API developers:',
-                       '    Roan Kattouw <Firstname>.<Lastname>@gmail.com (lead developer Sep 2007-present)',
+                       '    Roan Kattouw "<Firstname>.<Lastname>@gmail.com" (lead developer Sep 2007-present)',
                        '    Victor Vasiliev - vasilvv at gee mail dot com',
                        '    Bryan Tong Minh - bryan . tongminh @ gmail . com',
                        '    Sam Reed - sam @ reedyboy . net',
-                       '    Yuri Astrakhan <Firstname><Lastname>@gmail.com (creator, lead developer Sep 2006-Sep 2007)',
+                       '    Yuri Astrakhan "<Firstname><Lastname>@gmail.com" (creator, lead developer Sep 2006-Sep 2007)',
                        '',
                        'Please send your comments, suggestions and questions to mediawiki-api@lists.wikimedia.org',
                        'or file a bug report at https://bugzilla.wikimedia.org/'
@@ -1162,8 +1161,18 @@ class ApiMain extends ApiBase {
 class UsageException extends MWException {
 
        private $mCodestr;
+
+       /**
+        * @var null|array
+        */
        private $mExtraData;
 
+       /**
+        * @param $message string
+        * @param $codestr string
+        * @param $code int
+        * @param $extradata array|null
+        */
        public function __construct( $message, $codestr, $code = 0, $extradata = null ) {
                parent::__construct( $message, $code );
                $this->mCodestr = $codestr;