Merge "Add GENDER to rollback-success message"
[lhc/web/wiklou.git] / includes / api / ApiMain.php
index fe6ed41..9e00830 100644 (file)
@@ -79,6 +79,7 @@ class ApiMain extends ApiBase {
                'tokens' => 'ApiTokens',
                'checktoken' => 'ApiCheckToken',
                'cspreport' => 'ApiCSPReport',
+               'validatepassword' => 'ApiValidatePassword',
 
                // Write modules
                'purge' => 'ApiPurge',
@@ -105,6 +106,7 @@ class ApiMain extends ApiBase {
                'managetags' => 'ApiManageTags',
                'tag' => 'ApiTag',
                'mergehistory' => 'ApiMergeHistory',
+               'setpagelanguage' => 'ApiSetPageLanguage',
        ];
 
        /**
@@ -1046,7 +1048,9 @@ class ApiMain extends ApiBase {
                                $params = [
                                        'apierror-exceptioncaught',
                                        WebRequest::getRequestId(),
-                                       wfEscapeWikiText( $e->getMessage() )
+                                       $e instanceof ILocalizedException
+                                               ? $e->getMessageObject()
+                                               : wfEscapeWikiText( $e->getMessage() )
                                ];
                        }
                        $messages[] = ApiMessage::create( $params, $code );
@@ -1105,10 +1109,16 @@ class ApiMain extends ApiBase {
                        $result->addContentValue(
                                $path,
                                'docref',
-                               $this->msg( 'api-usage-docref', $link )->inLanguage( $formatter->getLanguage() )->text()
+                               trim(
+                                       $this->msg( 'api-usage-docref', $link )->inLanguage( $formatter->getLanguage() )->text()
+                                       . ' '
+                                       . $this->msg( 'api-usage-mailinglist-ref' )->inLanguage( $formatter->getLanguage() )->text()
+                               )
                        );
                } else {
-                       if ( $config->get( 'ShowExceptionDetails' ) ) {
+                       if ( $config->get( 'ShowExceptionDetails' ) &&
+                               ( !$e instanceof DBError || $config->get( 'ShowDBErrorBacktrace' ) )
+                       ) {
                                $result->addContentValue(
                                        $path,
                                        'trace',