35 $key = parent::getMessageKey();
36 if ( in_array( $this->entry->getSubtype(), [
'event',
'revision' ] ) ) {
42 } elseif ( $this->entry->getSubtype() ===
'restore' ) {
43 $rawParams = $this->entry->getParameters();
44 if ( !isset( $rawParams[
':assoc:count'] ) ) {
46 return $key .
'-nocount';
54 if ( isset( $this->parsedParametersDeleteLog ) ) {
55 return $this->parsedParametersDeleteLog;
58 $params = parent::getMessageParameters();
59 $subtype = $this->entry->getSubtype();
60 if ( in_array( $subtype, [
'event',
'revision' ] ) ) {
68 $subtype ===
'revision' && isset(
$params[3] )
69 && in_array(
$params[3], [
'revision',
'archive',
'oldimage',
'filearchive' ] )
73 $paramStart = $subtype ===
'revision' ? 4 : 3;
80 foreach ( $hid
as $v ) {
81 $changes[] = $this->
msg(
"$v-hid" )->plain();
85 foreach ( $unhid
as $v ) {
86 $changes[] = $this->
msg(
"$v-unhid" )->plain();
88 foreach ( $extra
as $v ) {
89 $changes[] = $this->
msg( $v )->plain();
91 $changeText = $this->context->getLanguage()->listToText( $changes );
93 $newParams = array_slice(
$params, 0, 3 );
94 $newParams[3] = $changeText;
95 $ids = is_array(
$params[$paramStart] )
97 : explode(
',',
$params[$paramStart] );
98 $newParams[4] = $this->context->getLanguage()->formatNum(
count( $ids ) );
100 $this->parsedParametersDeleteLog = $newParams;
101 return $this->parsedParametersDeleteLog;
103 $this->parsedParametersDeleteLog = array_slice(
$params, 0, 3 );
104 return $this->parsedParametersDeleteLog;
106 } elseif ( $subtype ===
'restore' ) {
107 $rawParams = $this->entry->getParameters();
108 if ( isset( $rawParams[
':assoc:count'] ) ) {
110 foreach ( $rawParams[
':assoc:count']
as $type => $count ) {
113 $countList[] = $this->context->msg(
'restore-count-' .
$type )
114 ->numParams( $count )->plain();
117 $params[3] = $this->context->getLanguage()->listToText( $countList );
121 $this->parsedParametersDeleteLog =
$params;
122 return $this->parsedParametersDeleteLog;
127 if ( strpos( $string,
'field=' ) === 1 ) {
128 list( , $field ) = explode(
'=', $string );
137 $user = $this->context->getUser();
138 $linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer();
139 if ( !
$user->isAllowed(
'deletedhistory' )
145 switch ( $this->entry->getSubtype() ) {
148 if (
$user->isAllowed(
'undelete' ) ) {
149 $message =
'undeletelink';
151 $message =
'undeleteviewlink';
155 $this->
msg( $message )->
text(),
157 [
'target' => $this->entry->getTarget()->getPrefixedDBkey() ]
160 return $this->
msg(
'parentheses' )->rawParams(
$revert )->escaped();
178 if (
count( $ids ) == 1 ) {
180 if ( $key ==
'oldid' || $key ==
'revision' ) {
182 $this->entry->getTarget(),
183 $this->
msg(
'diff' )->text(),
186 'diff' => intval( $ids[0] ),
191 } elseif ( $key ==
'artimestamp' || $key ==
'archive' ) {
197 'target' => $this->entry->getTarget()->getPrefixedDBkey(),
199 'timestamp' => $ids[0]
208 $this->
msg(
'revdel-restore' )->
text(),
211 'target' => $this->entry->getTarget()->getPrefixedText(),
213 'ids' => implode(
',', $ids ),
217 return $this->
msg(
'parentheses' )->rawParams(
218 $this->context->getLanguage()->pipeList( $links ) )->escaped();
227 if ( is_array(
$query ) ) {
233 $this->
msg(
'revdel-restore' )->
text(),
236 'target' => $this->entry->getTarget()->getPrefixedText(),
242 return $this->
msg(
'parentheses' )->rawParams(
$revert )->escaped();
252 $subtype = $this->entry->getSubtype();
253 if ( in_array( $subtype, [
'event',
'revision' ] ) ) {
255 if ( $subtype ===
'event' ) {
256 array_unshift( $rawParams,
'logging' );
264 '4::ids' =>
'5::ids',
265 '5::ofield' =>
'6::ofield',
266 '6::nfield' =>
'7::nfield',
268 foreach ( $map
as $index => $key ) {
269 if ( isset( $rawParams[$index] ) ) {
270 $rawParams[$key] = $rawParams[$index];
271 unset( $rawParams[$index] );
277 if ( !is_array( $rawParams[
'5::ids'] ) ) {
278 $rawParams[
'5::ids'] = explode(
',', $rawParams[
'5::ids'] );
282 '::type' => $rawParams[
'4::type'],
283 ':array:ids' => $rawParams[
'5::ids'],
284 ':assoc:old' => [
'bitmask' => $old ],
285 ':assoc:new' => [
'bitmask' => $new ],
294 foreach ( $fields
as $bit => $key ) {
295 $params[
':assoc:old'][$key] = (bool)( $old & $bit );
296 $params[
':assoc:new'][$key] = (bool)( $new & $bit );
298 } elseif ( $subtype ===
'restore' ) {
300 if ( isset( $rawParams[
':assoc:count'] ) ) {
301 $params[
':assoc:count'] = $rawParams[
':assoc:count'];
309 $ret = parent::formatParametersForApi();
310 if ( isset(
$ret[
'ids'] ) ) {