Localisation updates from https://translatewiki.net.
[lhc/web/wiklou.git] / includes / api / ApiMain.php
index d943c86..c641c95 100644 (file)
@@ -618,10 +618,13 @@ class ApiMain extends ApiBase {
 
                        $response->header( "Access-Control-Allow-Origin: $originHeader" );
                        $response->header( 'Access-Control-Allow-Credentials: true' );
-                       $response->header( "Timing-Allow-Origin: $originHeader" ); # http://www.w3.org/TR/resource-timing/#timing-allow-origin
+                       // http://www.w3.org/TR/resource-timing/#timing-allow-origin
+                       $response->header( "Timing-Allow-Origin: $originHeader" );
 
                        if ( !$preflight ) {
-                               $response->header( 'Access-Control-Expose-Headers: MediaWiki-API-Error, Retry-After, X-Database-Lag' );
+                               $response->header(
+                                       'Access-Control-Expose-Headers: MediaWiki-API-Error, Retry-After, X-Database-Lag'
+                               );
                        }
                }
 
@@ -757,12 +760,12 @@ class ApiMain extends ApiBase {
                        return;
                }
 
-               $useXVO = $config->get( 'UseXVO' );
+               $useKeyHeader = $config->get( 'UseKeyHeader' );
                if ( $this->mCacheMode == 'anon-public-user-private' ) {
                        $out->addVaryHeader( 'Cookie' );
                        $response->header( $out->getVaryHeader() );
-                       if ( $useXVO ) {
-                               $response->header( $out->getXVO() );
+                       if ( $useKeyHeader ) {
+                               $response->header( $out->getKeyHeader() );
                                if ( $out->haveCacheVaryCookies() ) {
                                        // Logged in, mark this request private
                                        $response->header( "Cache-Control: $privateCache" );
@@ -775,13 +778,13 @@ class ApiMain extends ApiBase {
                                $response->header( "Cache-Control: $privateCache" );
 
                                return;
-                       } // else no XVO and anonymous, send public headers below
+                       } // else no Key and anonymous, send public headers below
                }
 
                // Send public headers
                $response->header( $out->getVaryHeader() );
-               if ( $useXVO ) {
-                       $response->header( $out->getXVO() );
+               if ( $useKeyHeader ) {
+                       $response->header( $out->getKeyHeader() );
                }
 
                // If nobody called setCacheMaxAge(), use the (s)maxage parameters
@@ -977,7 +980,8 @@ class ApiMain extends ApiBase {
                                )
                        ) {
                                $this->dieUsage(
-                                       "The '{$module->encodeParamName( 'token' )}' parameter was found in the query string, but must be in the POST body",
+                                       "The '{$module->encodeParamName( 'token' )}' parameter was " .
+                                               'found in the query string, but must be in the POST body',
                                        'mustposttoken'
                                );
                        }
@@ -1236,7 +1240,7 @@ class ApiMain extends ApiBase {
                $this->reportUnusedParams();
 
                if ( !$this->mInternalMode ) {
-                       //append Debug information
+                       // append Debug information
                        MWDebug::appendDebugInfoToApiResult( $this->getContext(), $this->getResult() );
 
                        // Print result data
@@ -1592,25 +1596,19 @@ class ApiMain extends ApiBase {
         */
        public function makeHelpMsg() {
                wfDeprecated( __METHOD__, '1.25' );
-               global $wgMemc;
-               $this->setHelp();
-               // Get help text from cache if present
-               $key = wfMemcKey( 'apihelp', $this->getModuleName(),
-                       str_replace( ' ', '_', SpecialVersion::getVersion( 'nodb' ) ) );
 
+               $this->setHelp();
                $cacheHelpTimeout = $this->getConfig()->get( 'APICacheHelpTimeout' );
-               if ( $cacheHelpTimeout > 0 ) {
-                       $cached = $wgMemc->get( $key );
-                       if ( $cached ) {
-                               return $cached;
-                       }
-               }
-               $retval = $this->reallyMakeHelpMsg();
-               if ( $cacheHelpTimeout > 0 ) {
-                       $wgMemc->set( $key, $retval, $cacheHelpTimeout );
-               }
 
-               return $retval;
+               return ObjectCache::getMainWANInstance()->getWithSetCallback(
+                       wfMemcKey(
+                               'apihelp',
+                               $this->getModuleName(),
+                               str_replace( ' ', '_', SpecialVersion::getVersion( 'nodb' ) )
+                       ),
+                       $cacheHelpTimeout > 0 ? $cacheHelpTimeout : WANObjectCache::TTL_UNCACHEABLE,
+                       array( $this, 'reallyMakeHelpMsg' )
+               );
        }
 
        /**