Merge "Fix warning on Special:ListGroupRights for group with invalid group page"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Mon, 29 Dec 2014 20:47:46 +0000 (20:47 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Mon, 29 Dec 2014 20:47:46 +0000 (20:47 +0000)
includes/api/ApiMain.php
includes/logging/LogFormatter.php
languages/Language.php

index a5287b6..1544189 100644 (file)
@@ -710,12 +710,14 @@ class ApiMain extends ApiBase {
 
                        $errMessage = array(
                                'code' => 'internal_api_error_' . get_class( $e ),
-                               'info' => $info,
-                       );
-                       ApiResult::setContent(
-                               $errMessage,
-                               $config->get( 'ShowExceptionDetails' ) ? "\n\n{$e->getTraceAsString()}\n\n" : ''
+                               'info' => '[' . MWExceptionHandler::getLogId( $e ) . '] ' . $info,
                        );
+                       if ( $config->get( 'ShowExceptionDetails' ) ) {
+                               ApiResult::setContent(
+                                       $errMessage,
+                                       MWExceptionHandler::getRedactedTraceAsString( $e )
+                               );
+                       }
                }
 
                // Remember all the warnings to re-add them later
index 464b723..c6fcdb0 100644 (file)
@@ -355,8 +355,10 @@ class LogFormatter {
                                $element = $this->styleRestricedElement( $element );
                        }
                } else {
-                       $performer = $this->getPerformerElement() . $this->msg( 'word-separator' )->text();
-                       $element = $performer . $this->getRestrictedElement( 'rev-deleted-event' );
+                       $sep = $this->msg( 'word-separator' );
+                       $sep = $this->plaintext ? $sep->text() : $sep->escaped();
+                       $performer = $this->getPerformerElement();
+                       $element = $performer . $sep . $this->getRestrictedElement( 'rev-deleted-event' );
                }
 
                return $element;
@@ -731,7 +733,9 @@ class LegacyLogFormatter extends LogFormatter {
 
                $performer = $this->getPerformerElement();
                if ( !$this->irctext ) {
-                       $action = $performer . $this->msg( 'word-separator' )->text() . $action;
+                       $sep = $this->msg( 'word-separator' );
+                       $sep = $this->plaintext ? $sep->text() : $sep->escaped();
+                       $action = $performer . $sep . $action;
                }
 
                return $action;
index c0de1b4..72cc1ac 100644 (file)
@@ -962,7 +962,17 @@ class Language {
         * @return string
         */
        function getMessageFromDB( $msg ) {
-               return wfMessage( $msg )->inLanguage( $this )->text();
+               return $this->msg( $msg )->text();
+       }
+
+       /**
+        * Get message object in this language. Only for use inside this class.
+        *
+        * @param string $msg Message name
+        * @return Message
+        */
+       protected function msg( $msg ) {
+               return wfMessage( $msg )->inLanguage( $this );
        }
 
        /**
@@ -3406,10 +3416,10 @@ class Language {
                        return '';
                }
                if ( $m > 0 ) {
-                       $and = htmlspecialchars( $this->getMessageFromDB( 'and' ) );
-                       $space = htmlspecialchars( $this->getMessageFromDB( 'word-separator' ) );
+                       $and = $this->msg( 'and' )->escaped();
+                       $space = $this->msg( 'word-separator' )->escaped();
                        if ( $m > 1 ) {
-                               $comma = htmlspecialchars( $this->getMessageFromDB( 'comma-separator' ) );
+                               $comma = $this->msg( 'comma-separator' )->escaped();
                        }
                }
                $s = $l[$m];
@@ -4643,17 +4653,22 @@ class Language {
         * Make a list item, used by various special pages
         *
         * @param string $page Page link
-        * @param string $details Text between brackets
+        * @param string $details HTML safe text between brackets
         * @param bool $oppositedm Add the direction mark opposite to your
         *   language, to display text properly
-        * @return string
+        * @return HTML escaped string
         */
        function specialList( $page, $details, $oppositedm = true ) {
-               $dirmark = ( $oppositedm ? $this->getDirMark( true ) : '' ) .
-                       $this->getDirMark();
-               $details = $details ? $dirmark . $this->getMessageFromDB( 'word-separator' ) .
-                       wfMessage( 'parentheses' )->rawParams( $details )->inLanguage( $this )->escaped() : '';
-               return $page . $details;
+               if ( !$details ) {
+                       return $page;
+               }
+
+               $dirmark = ( $oppositedm ? $this->getDirMark( true ) : '' ) . $this->getDirMark();
+               return
+                       $page .
+                       $dirmark .
+                       $this->msg( 'word-separator' )->escaped() .
+                       $this->msg( 'parentheses' )->rawParams( $details )->escaped();
        }
 
        /**