38 $userrightsInterwikiDelimiter = $this->context->getConfig()
39 ->get( MainConfigNames::UserrightsInterwikiDelimiter );
41 if ( !$this->plaintext ) {
42 $text = MediaWikiServices::getInstance()->getContentLanguage()->
43 ucfirst( $title->getDBkey() );
44 $parts = explode( $userrightsInterwikiDelimiter, $text, 2 );
46 if ( count( $parts ) === 2 ) {
48 $titleLink = WikiMap::foreignUserLink(
52 strtr( $parts[0],
'_',
' ' ) .
53 $userrightsInterwikiDelimiter .
58 if ( $titleLink !==
false ) {
64 return parent::makePageLink( $title, $parameters, $title ? $title->getText() : null );
79 $params = parent::getMessageParameters();
82 if ( !isset( $params[3] ) && !isset( $params[4] ) ) {
86 $oldGroups = $this->makeGroupArray( $params[3] );
87 $newGroups = $this->makeGroupArray( $params[4] );
89 $userName = $this->entry->getTarget()->getText();
90 $lang = $this->context->getLanguage();
91 if ( !$this->plaintext && count( $oldGroups ) ) {
92 foreach ( $oldGroups as &$group ) {
93 $group = $lang->getGroupMemberName( $group, $userName );
96 if ( !$this->plaintext && count( $newGroups ) ) {
97 foreach ( $newGroups as &$group ) {
98 $group = $lang->getGroupMemberName( $group, $userName );
103 $allParams = $this->entry->getParameters();
105 if ( count( $oldGroups ) ) {
107 $allParams[
'oldmetadata'] ?? [] ) );
109 $params[3] = $this->
msg(
'rightsnone' )->text();
111 if ( count( $newGroups ) ) {
115 $allParams[
'newmetadata'] ?? [] ) );
117 $params[4] = $this->
msg(
'rightsnone' )->text();
120 $params[5] = $userName;
126 $uiLanguage = $this->context->getLanguage();
127 $uiUser = $this->context->getUser();
129 $tempList = $permList = [];
132 reset( $serializedUGMs );
133 while ( current( $groups ) ) {
134 $group = current( $groups );
136 if ( current( $serializedUGMs ) &&
137 isset( current( $serializedUGMs )[
'expiry'] ) &&
138 current( $serializedUGMs )[
'expiry']
141 $expiry = current( $serializedUGMs )[
'expiry'];
142 $expiryFormatted = $uiLanguage->userTimeAndDate( $expiry, $uiUser );
143 $expiryFormattedD = $uiLanguage->userDate( $expiry, $uiUser );
144 $expiryFormattedT = $uiLanguage->userTime( $expiry, $uiUser );
145 $tempList[] = $this->
msg(
'rightslogentry-temporary-group' )->params( $group,
146 $expiryFormatted, $expiryFormattedD, $expiryFormattedT )->parse();
149 $permList[] = htmlspecialchars( $group );
153 next( $serializedUGMs );
158 return $uiLanguage->listToText( array_merge( $tempList, $permList ) );
168 '4::oldgroups' =>
'4:array:oldgroups',
169 '5::newgroups' =>
'5:array:newgroups',
171 foreach ( $map as $index => $key ) {
172 if ( isset( $params[$index] ) ) {
173 $params[$key] = $params[$index];
174 unset( $params[$index] );
182 if ( isset( $params[
'4:array:oldgroups'] ) ) {
183 $params[
'4:array:oldgroups'] = $this->makeGroupArray( $params[
'4:array:oldgroups'] );
185 $oldmetadata =& $params[
'oldmetadata'];
187 unset( $params[
'oldmetadata'] );
188 $params[
'oldmetadata'] = array_map(
static function ( $index ) use ( $params, $oldmetadata ) {
189 $result = [
'group' => $params[
'4:array:oldgroups'][$index] ];
190 if ( isset( $oldmetadata[$index] ) ) {
191 $result += $oldmetadata[$index];
193 $result[
'expiry'] = ApiResult::formatExpiry( $result[
'expiry'] ??
null );
196 }, array_keys( $params[
'4:array:oldgroups'] ) );
199 if ( isset( $params[
'5:array:newgroups'] ) ) {
200 $params[
'5:array:newgroups'] = $this->makeGroupArray( $params[
'5:array:newgroups'] );
202 $newmetadata =& $params[
'newmetadata'];
204 unset( $params[
'newmetadata'] );
205 $params[
'newmetadata'] = array_map(
static function ( $index ) use ( $params, $newmetadata ) {
206 $result = [
'group' => $params[
'5:array:newgroups'][$index] ];
207 if ( isset( $newmetadata[$index] ) ) {
208 $result += $newmetadata[$index];
210 $result[
'expiry'] = ApiResult::formatExpiry( $result[
'expiry'] ??
null );
213 }, array_keys( $params[
'5:array:newgroups'] ) );
220 $ret = parent::formatParametersForApi();
221 if ( isset( $ret[
'oldgroups'] ) ) {
222 ApiResult::setIndexedTagName( $ret[
'oldgroups'],
'g' );
224 if ( isset( $ret[
'newgroups'] ) ) {
225 ApiResult::setIndexedTagName( $ret[
'newgroups'],
'g' );
227 if ( isset( $ret[
'oldmetadata'] ) ) {
228 ApiResult::setArrayType( $ret[
'oldmetadata'],
'array' );
229 ApiResult::setIndexedTagName( $ret[
'oldmetadata'],
'g' );
231 if ( isset( $ret[
'newmetadata'] ) ) {
232 ApiResult::setArrayType( $ret[
'newmetadata'],
'array' );
233 ApiResult::setIndexedTagName( $ret[
'newmetadata'],
'g' );