Merge "Remove full form of ChangeTags::buildTagFilterSelector"
[lhc/web/wiklou.git] / includes / logging / RightsLogFormatter.php
index 79ffe86..be73c86 100644 (file)
  * @since 1.21
  */
 class RightsLogFormatter extends LogFormatter {
-       protected function makePageLink( Title $title = null, $parameters = array(), $html = null ) {
+       protected function makePageLink( Title $title = null, $parameters = [], $html = null ) {
                global $wgContLang, $wgUserrightsInterwikiDelimiter;
 
                if ( !$this->plaintext ) {
-                       $text = $wgContLang->ucfirst( $title->getText() );
+                       $text = $wgContLang->ucfirst( $title->getDBkey() );
                        $parts = explode( $wgUserrightsInterwikiDelimiter, $text, 2 );
 
                        if ( count( $parts ) === 2 ) {
-                               $titleLink = WikiMap::foreignUserLink( $parts[1], $parts[0],
-                                       htmlspecialchars( $title->getText() ) );
+                               $titleLink = WikiMap::foreignUserLink(
+                                       $parts[1],
+                                       $parts[0],
+                                       htmlspecialchars(
+                                               strtr( $parts[0], '_', ' ' ) .
+                                               $wgUserrightsInterwikiDelimiter .
+                                               $parts[1]
+                                       )
+                               );
 
                                if ( $titleLink !== false ) {
                                        return $titleLink;
@@ -53,6 +60,7 @@ class RightsLogFormatter extends LogFormatter {
                $key = parent::getMessageKey();
                $params = $this->getMessageParameters();
                if ( !isset( $params[3] ) && !isset( $params[4] ) ) {
+                       // Messages: logentry-rights-rights-legacy
                        $key .= '-legacy';
                }
 
@@ -89,13 +97,15 @@ class RightsLogFormatter extends LogFormatter {
                        $params[3] = $this->msg( 'rightsnone' )->text();
                }
                if ( count( $newGroups ) ) {
-                       // Array_values is used here because of bug 42211
+                       // Array_values is used here because of T44211
                        // see use of array_unique in UserrightsPage::doSaveUserGroups on $newGroups.
                        $params[4] = $lang->listToText( array_values( $newGroups ) );
                } else {
                        $params[4] = $this->msg( 'rightsnone' )->text();
                }
 
+               $params[5] = $userName;
+
                return $params;
        }
 
@@ -103,12 +113,12 @@ class RightsLogFormatter extends LogFormatter {
                $entry = $this->entry;
                $params = $entry->getParameters();
 
-               static $map = array(
+               static $map = [
                        '4:array:oldgroups',
                        '5:array:newgroups',
                        '4::oldgroups' => '4:array:oldgroups',
                        '5::newgroups' => '5:array:newgroups',
-               );
+               ];
                foreach ( $map as $index => $key ) {
                        if ( isset( $params[$index] ) ) {
                                $params[$key] = $params[$index];
@@ -141,7 +151,7 @@ class RightsLogFormatter extends LogFormatter {
        private function makeGroupArray( $group ) {
                // Migrate old group params from string to array
                if ( $group === '' ) {
-                       $group = array();
+                       $group = [];
                } elseif ( is_string( $group ) ) {
                        $group = array_map( 'trim', explode( ',', $group ) );
                }