74 $params = parent::getMessageParameters();
77 if ( !isset( $params[3] ) && !isset( $params[4] ) ) {
84 $userName = $this->entry->getTarget()->getText();
85 if ( !$this->plaintext && count( $oldGroups ) ) {
86 foreach ( $oldGroups as &$group ) {
87 $group = UserGroupMembership::getGroupMemberName( $group, $userName );
90 if ( !$this->plaintext && count( $newGroups ) ) {
91 foreach ( $newGroups as &$group ) {
92 $group = UserGroupMembership::getGroupMemberName( $group, $userName );
97 $allParams = $this->entry->getParameters();
99 if ( count( $oldGroups ) ) {
101 $allParams[
'oldmetadata'] ?? [] ) );
103 $params[3] = $this->
msg(
'rightsnone' )->text();
105 if ( count( $newGroups ) ) {
109 $allParams[
'newmetadata'] ?? [] ) );
111 $params[4] = $this->
msg(
'rightsnone' )->text();
114 $params[5] = $userName;
120 $uiLanguage = $this->context->getLanguage();
121 $uiUser = $this->context->getUser();
123 $tempList = $permList = [];
126 reset( $serializedUGMs );
127 while ( current( $groups ) ) {
128 $group = current( $groups );
130 if ( current( $serializedUGMs ) &&
131 isset( current( $serializedUGMs )[
'expiry'] ) &&
132 current( $serializedUGMs )[
'expiry']
135 $expiry = current( $serializedUGMs )[
'expiry'];
136 $expiryFormatted = $uiLanguage->userTimeAndDate( $expiry, $uiUser );
137 $expiryFormattedD = $uiLanguage->userDate( $expiry, $uiUser );
138 $expiryFormattedT = $uiLanguage->userTime( $expiry, $uiUser );
139 $tempList[] = $this->
msg(
'rightslogentry-temporary-group' )->params( $group,
140 $expiryFormatted, $expiryFormattedD, $expiryFormattedT )->parse();
143 $permList[] = htmlspecialchars( $group );
147 next( $serializedUGMs );
152 return $uiLanguage->listToText( array_merge( $tempList, $permList ) );
162 '4::oldgroups' =>
'4:array:oldgroups',
163 '5::newgroups' =>
'5:array:newgroups',
165 foreach ( $map as $index => $key ) {
166 if ( isset( $params[$index] ) ) {
167 $params[$key] = $params[$index];
168 unset( $params[$index] );
176 if ( isset( $params[
'4:array:oldgroups'] ) ) {
177 $params[
'4:array:oldgroups'] = $this->
makeGroupArray( $params[
'4:array:oldgroups'] );
179 $oldmetadata =& $params[
'oldmetadata'];
181 unset( $params[
'oldmetadata'] );
182 $params[
'oldmetadata'] = array_map(
function ( $index ) use ( $params, $oldmetadata ) {
183 $result = [
'group' => $params[
'4:array:oldgroups'][$index] ];
184 if ( isset( $oldmetadata[$index] ) ) {
185 $result += $oldmetadata[$index];
187 $result[
'expiry'] = ApiResult::formatExpiry( $result[
'expiry'] ??
null );
190 }, array_keys( $params[
'4:array:oldgroups'] ) );
193 if ( isset( $params[
'5:array:newgroups'] ) ) {
194 $params[
'5:array:newgroups'] = $this->
makeGroupArray( $params[
'5:array:newgroups'] );
196 $newmetadata =& $params[
'newmetadata'];
198 unset( $params[
'newmetadata'] );
199 $params[
'newmetadata'] = array_map(
function ( $index ) use ( $params, $newmetadata ) {
200 $result = [
'group' => $params[
'5:array:newgroups'][$index] ];
201 if ( isset( $newmetadata[$index] ) ) {
202 $result += $newmetadata[$index];
204 $result[
'expiry'] = ApiResult::formatExpiry( $result[
'expiry'] ??
null );
207 }, array_keys( $params[
'5:array:newgroups'] ) );
214 $ret = parent::formatParametersForApi();
215 if ( isset( $ret[
'oldgroups'] ) ) {
216 ApiResult::setIndexedTagName( $ret[
'oldgroups'],
'g' );
218 if ( isset( $ret[
'newgroups'] ) ) {
219 ApiResult::setIndexedTagName( $ret[
'newgroups'],
'g' );
221 if ( isset( $ret[
'oldmetadata'] ) ) {
222 ApiResult::setArrayType( $ret[
'oldmetadata'],
'array' );
223 ApiResult::setIndexedTagName( $ret[
'oldmetadata'],
'g' );
225 if ( isset( $ret[
'newmetadata'] ) ) {
226 ApiResult::setArrayType( $ret[
'newmetadata'],
'array' );
227 ApiResult::setIndexedTagName( $ret[
'newmetadata'],
'g' );