SECURITY: rate-limit and prevent blocked users from changing email
[lhc/web/wiklou.git] / includes / api / ApiMain.php
index f60443c..b845c57 100644 (file)
@@ -148,7 +148,7 @@ class ApiMain extends ApiBase {
        private $mContinuationManager;
        private $mAction;
        private $mEnableWrite;
-       private $mInternalMode, $mSquidMaxage;
+       private $mInternalMode, $mCdnMaxAge;
        /** @var ApiBase */
        private $mModule;
 
@@ -288,7 +288,7 @@ class ApiMain extends ApiBase {
                $this->mContinuationManager = null;
                $this->mEnableWrite = $enableWrite;
 
-               $this->mSquidMaxage = -1; // flag for executeActionWithErrorHandling()
+               $this->mCdnMaxAge = -1; // flag for executeActionWithErrorHandling()
                $this->mCommit = false;
        }
 
@@ -1117,19 +1117,17 @@ class ApiMain extends ApiBase {
                                        . $this->msg( 'api-usage-mailinglist-ref' )->inLanguage( $formatter->getLanguage() )->text()
                                )
                        );
-               } else {
-                       if ( $config->get( 'ShowExceptionDetails' ) ) {
-                               $result->addContentValue(
-                                       $path,
-                                       'trace',
-                                       $this->msg( 'api-exception-trace',
-                                               get_class( $e ),
-                                               $e->getFile(),
-                                               $e->getLine(),
-                                               MWExceptionHandler::getRedactedTraceAsString( $e )
-                                       )->inLanguage( $formatter->getLanguage() )->text()
-                               );
-                       }
+               } elseif ( $config->get( 'ShowExceptionDetails' ) ) {
+                       $result->addContentValue(
+                               $path,
+                               'trace',
+                               $this->msg( 'api-exception-trace',
+                                       get_class( $e ),
+                                       $e->getFile(),
+                                       $e->getLine(),
+                                       MWExceptionHandler::getRedactedTraceAsString( $e )
+                               )->inLanguage( $formatter->getLanguage() )->text()
+                       );
                }
 
                // Add the id and such
@@ -1370,18 +1368,20 @@ class ApiMain extends ApiBase {
                                                $ts->format( 'D M j H:i:s Y' ) === $value ||
                                                $ts->format( 'D M  j H:i:s Y' ) === $value
                                        ) {
+                                               $config = $this->getConfig();
                                                $lastMod = $module->getConditionalRequestData( 'last-modified' );
                                                if ( $lastMod !== null ) {
                                                        // Mix in some MediaWiki modification times
                                                        $modifiedTimes = [
                                                                'page' => $lastMod,
                                                                'user' => $this->getUser()->getTouched(),
-                                                               'epoch' => $this->getConfig()->get( 'CacheEpoch' ),
+                                                               'epoch' => $config->get( 'CacheEpoch' ),
                                                        ];
-                                                       if ( $this->getConfig()->get( 'UseSquid' ) ) {
+
+                                                       if ( $config->get( 'UseCdn' ) ) {
                                                                // T46570: the core page itself may not change, but resources might
                                                                $modifiedTimes['sepoch'] = wfTimestamp(
-                                                                       TS_MW, time() - $this->getConfig()->get( 'SquidMaxage' )
+                                                                       TS_MW, time() - $config->get( 'CdnMaxAge' )
                                                                );
                                                        }
                                                        Hooks::run( 'OutputPageCheckLastModified', [ &$modifiedTimes, $this->getOutput() ] );
@@ -1840,7 +1840,7 @@ class ApiMain extends ApiBase {
         */
        protected function printResult( $httpCode = 0 ) {
                if ( $this->getConfig()->get( 'DebugAPI' ) !== false ) {
-                       $this->addWarning( 'apiwarn-wgDebugAPI' );
+                       $this->addWarning( 'apiwarn-wgdebugapi' );
                }
 
                $printer = $this->mPrinter;