Merge "Enable configuration to supply options for Special:Search form"
[lhc/web/wiklou.git] / includes / api / ApiMain.php
index 295d5d0..1a7175a 100644 (file)
@@ -218,7 +218,7 @@ class ApiMain extends ApiBase {
                                                'cookies' => $sessionCookies,
                                                'ip' => $request->getIP(),
                                                'userAgent' => $this->getUserAgent(),
-                                               'wiki' => wfWikiID(),
+                                               'wiki' => WikiMap::getCurrentWikiDbDomain()->getId(),
                                        ]
                                );
                        }
@@ -321,7 +321,7 @@ class ApiMain extends ApiBase {
                $request = $this->getRequest();
 
                // JSONP mode
-               if ( $request->getVal( 'callback' ) !== null ) {
+               if ( $request->getCheck( 'callback' ) ) {
                        $this->lacksSameOriginSecurity = true;
                        return true;
                }
@@ -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
@@ -1633,7 +1631,7 @@ class ApiMain extends ApiBase {
                        'ts' => time(),
                        'ip' => $request->getIP(),
                        'userAgent' => $this->getUserAgent(),
-                       'wiki' => wfWikiID(),
+                       'wiki' => WikiMap::getCurrentWikiDbDomain()->getId(),
                        'timeSpentBackend' => (int)round( $time * 1000 ),
                        'hadError' => $e !== null,
                        'errorCodes' => [],
@@ -1653,7 +1651,7 @@ class ApiMain extends ApiBase {
                                'method' => $request->getMethod(),
                                'client_ip' => $request->getIP()
                        ],
-                       'database' => wfWikiID(),
+                       'database' => WikiMap::getCurrentWikiDbDomain()->getId(),
                        'backend_time_ms' => (int)round( $time * 1000 ),
                ];
 
@@ -1840,7 +1838,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;