75 $params = parent::getMessageParameters();
78 if ( !isset( $params[3] ) && !isset( $params[4] ) ) {
85 $userName = $this->entry->getTarget()->getText();
86 if ( !$this->plaintext && count( $oldGroups ) ) {
87 foreach ( $oldGroups as &$group ) {
88 $group = UserGroupMembership::getGroupMemberName( $group, $userName );
91 if ( !$this->plaintext && count( $newGroups ) ) {
92 foreach ( $newGroups as &$group ) {
93 $group = UserGroupMembership::getGroupMemberName( $group, $userName );
98 $allParams = $this->entry->getParameters();
100 if ( count( $oldGroups ) ) {
102 $allParams[
'oldmetadata'] ?? [] ) );
104 $params[3] = $this->
msg(
'rightsnone' )->text();
106 if ( count( $newGroups ) ) {
110 $allParams[
'newmetadata'] ?? [] ) );
112 $params[4] = $this->
msg(
'rightsnone' )->text();
115 $params[5] = $userName;
121 $uiLanguage = $this->context->getLanguage();
122 $uiUser = $this->context->getUser();
124 $tempList = $permList = [];
127 reset( $serializedUGMs );
128 while ( current( $groups ) ) {
129 $group = current( $groups );
131 if ( current( $serializedUGMs ) &&
132 isset( current( $serializedUGMs )[
'expiry'] ) &&
133 current( $serializedUGMs )[
'expiry']
136 $expiry = current( $serializedUGMs )[
'expiry'];
137 $expiryFormatted = $uiLanguage->userTimeAndDate( $expiry, $uiUser );
138 $expiryFormattedD = $uiLanguage->userDate( $expiry, $uiUser );
139 $expiryFormattedT = $uiLanguage->userTime( $expiry, $uiUser );
140 $tempList[] = $this->
msg(
'rightslogentry-temporary-group' )->params( $group,
141 $expiryFormatted, $expiryFormattedD, $expiryFormattedT )->parse();
144 $permList[] = $group;
148 next( $serializedUGMs );
153 return $uiLanguage->listToText( array_merge( $tempList, $permList ) );
163 '4::oldgroups' =>
'4:array:oldgroups',
164 '5::newgroups' =>
'5:array:newgroups',
166 foreach ( $map as $index => $key ) {
167 if ( isset( $params[$index] ) ) {
168 $params[$key] = $params[$index];
169 unset( $params[$index] );
177 if ( isset( $params[
'4:array:oldgroups'] ) ) {
178 $params[
'4:array:oldgroups'] = $this->
makeGroupArray( $params[
'4:array:oldgroups'] );
180 $oldmetadata =& $params[
'oldmetadata'];
182 unset( $params[
'oldmetadata'] );
183 $params[
'oldmetadata'] = array_map(
static function ( $index ) use ( $params, $oldmetadata ) {
184 $result = [
'group' => $params[
'4:array:oldgroups'][$index] ];
185 if ( isset( $oldmetadata[$index] ) ) {
186 $result += $oldmetadata[$index];
188 $result[
'expiry'] = ApiResult::formatExpiry( $result[
'expiry'] ??
null );
191 }, array_keys( $params[
'4:array:oldgroups'] ) );
194 if ( isset( $params[
'5:array:newgroups'] ) ) {
195 $params[
'5:array:newgroups'] = $this->
makeGroupArray( $params[
'5:array:newgroups'] );
197 $newmetadata =& $params[
'newmetadata'];
199 unset( $params[
'newmetadata'] );
200 $params[
'newmetadata'] = array_map(
static function ( $index ) use ( $params, $newmetadata ) {
201 $result = [
'group' => $params[
'5:array:newgroups'][$index] ];
202 if ( isset( $newmetadata[$index] ) ) {
203 $result += $newmetadata[$index];
205 $result[
'expiry'] = ApiResult::formatExpiry( $result[
'expiry'] ??
null );
208 }, array_keys( $params[
'5:array:newgroups'] ) );
215 $ret = parent::formatParametersForApi();
216 if ( isset( $ret[
'oldgroups'] ) ) {
217 ApiResult::setIndexedTagName( $ret[
'oldgroups'],
'g' );
219 if ( isset( $ret[
'newgroups'] ) ) {
220 ApiResult::setIndexedTagName( $ret[
'newgroups'],
'g' );
222 if ( isset( $ret[
'oldmetadata'] ) ) {
223 ApiResult::setArrayType( $ret[
'oldmetadata'],
'array' );
224 ApiResult::setIndexedTagName( $ret[
'oldmetadata'],
'g' );
226 if ( isset( $ret[
'newmetadata'] ) ) {
227 ApiResult::setArrayType( $ret[
'newmetadata'],
'array' );
228 ApiResult::setIndexedTagName( $ret[
'newmetadata'],
'g' );