36 $userrightsInterwikiDelimiter = $this->context->getConfig()
37 ->get( MainConfigNames::UserrightsInterwikiDelimiter );
39 if ( !$this->plaintext ) {
40 $text = MediaWikiServices::getInstance()->getContentLanguage()->
41 ucfirst(
$title->getDBkey() );
42 $parts = explode( $userrightsInterwikiDelimiter, $text, 2 );
44 if ( count( $parts ) === 2 ) {
46 $titleLink = WikiMap::foreignUserLink(
50 strtr( $parts[0],
'_',
' ' ) .
51 $userrightsInterwikiDelimiter .
56 if ( $titleLink !==
false ) {
77 $params = parent::getMessageParameters();
80 if ( !isset( $params[3] ) && !isset( $params[4] ) ) {
84 $oldGroups = $this->makeGroupArray( $params[3] );
85 $newGroups = $this->makeGroupArray( $params[4] );
87 $userName = $this->entry->getTarget()->getText();
88 $lang = $this->context->getLanguage();
89 if ( !$this->plaintext && count( $oldGroups ) ) {
90 foreach ( $oldGroups as &$group ) {
91 $group =
$lang->getGroupMemberName( $group, $userName );
94 if ( !$this->plaintext && count( $newGroups ) ) {
95 foreach ( $newGroups as &$group ) {
96 $group =
$lang->getGroupMemberName( $group, $userName );
101 $allParams = $this->entry->getParameters();
103 if ( count( $oldGroups ) ) {
105 $allParams[
'oldmetadata'] ?? [] ) );
107 $params[3] = $this->
msg(
'rightsnone' )->text();
109 if ( count( $newGroups ) ) {
113 $allParams[
'newmetadata'] ?? [] ) );
115 $params[4] = $this->
msg(
'rightsnone' )->text();
118 $params[5] = $userName;
124 $uiLanguage = $this->context->getLanguage();
125 $uiUser = $this->context->getUser();
127 $tempList = $permList = [];
130 reset( $serializedUGMs );
131 while ( current( $groups ) ) {
132 $group = current( $groups );
134 if ( current( $serializedUGMs ) &&
135 isset( current( $serializedUGMs )[
'expiry'] ) &&
136 current( $serializedUGMs )[
'expiry']
139 $expiry = current( $serializedUGMs )[
'expiry'];
140 $expiryFormatted = $uiLanguage->userTimeAndDate( $expiry, $uiUser );
141 $expiryFormattedD = $uiLanguage->userDate( $expiry, $uiUser );
142 $expiryFormattedT = $uiLanguage->userTime( $expiry, $uiUser );
143 $tempList[] = $this->
msg(
'rightslogentry-temporary-group' )->params( $group,
144 $expiryFormatted, $expiryFormattedD, $expiryFormattedT )->parse();
147 $permList[] = htmlspecialchars( $group );
151 next( $serializedUGMs );
156 return $uiLanguage->listToText( array_merge( $tempList, $permList ) );
166 '4::oldgroups' =>
'4:array:oldgroups',
167 '5::newgroups' =>
'5:array:newgroups',
169 foreach ( $map as $index => $key ) {
170 if ( isset( $params[$index] ) ) {
171 $params[$key] = $params[$index];
172 unset( $params[$index] );
180 if ( isset( $params[
'4:array:oldgroups'] ) ) {
181 $params[
'4:array:oldgroups'] = $this->makeGroupArray( $params[
'4:array:oldgroups'] );
183 $oldmetadata =& $params[
'oldmetadata'];
185 unset( $params[
'oldmetadata'] );
186 $params[
'oldmetadata'] = array_map(
static function ( $index ) use ( $params, $oldmetadata ) {
187 $result = [
'group' => $params[
'4:array:oldgroups'][$index] ];
188 if ( isset( $oldmetadata[$index] ) ) {
189 $result += $oldmetadata[$index];
191 $result[
'expiry'] = ApiResult::formatExpiry( $result[
'expiry'] ??
null );
194 }, array_keys( $params[
'4:array:oldgroups'] ) );
197 if ( isset( $params[
'5:array:newgroups'] ) ) {
198 $params[
'5:array:newgroups'] = $this->makeGroupArray( $params[
'5:array:newgroups'] );
200 $newmetadata =& $params[
'newmetadata'];
202 unset( $params[
'newmetadata'] );
203 $params[
'newmetadata'] = array_map(
static function ( $index ) use ( $params, $newmetadata ) {
204 $result = [
'group' => $params[
'5:array:newgroups'][$index] ];
205 if ( isset( $newmetadata[$index] ) ) {
206 $result += $newmetadata[$index];
208 $result[
'expiry'] = ApiResult::formatExpiry( $result[
'expiry'] ??
null );
211 }, array_keys( $params[
'5:array:newgroups'] ) );
218 $ret = parent::formatParametersForApi();
219 if ( isset( $ret[
'oldgroups'] ) ) {
220 ApiResult::setIndexedTagName( $ret[
'oldgroups'],
'g' );
222 if ( isset( $ret[
'newgroups'] ) ) {
223 ApiResult::setIndexedTagName( $ret[
'newgroups'],
'g' );
225 if ( isset( $ret[
'oldmetadata'] ) ) {
226 ApiResult::setArrayType( $ret[
'oldmetadata'],
'array' );
227 ApiResult::setIndexedTagName( $ret[
'oldmetadata'],
'g' );
229 if ( isset( $ret[
'newmetadata'] ) ) {
230 ApiResult::setArrayType( $ret[
'newmetadata'],
'array' );
231 ApiResult::setIndexedTagName( $ret[
'newmetadata'],
'g' );