64 if ( $this->parsedParametersDeleteLog !==
null ) {
65 return $this->parsedParametersDeleteLog;
68 $params = parent::getMessageParameters();
69 $subtype = $this->entry->getSubtype();
70 if ( in_array( $subtype, [
'event',
'revision' ] ) ) {
76 ( $subtype ===
'event' && count(
$params ) === 6 )
78 $subtype ===
'revision' && isset(
$params[3] ) && count(
$params ) === 7
79 && in_array(
$params[3], [
'revision',
'archive',
'oldimage',
'filearchive' ] )
83 $paramStart = $subtype ===
'revision' ? 4 : 3;
87 [ $hid, $unhid, $extra ] = RevisionDeleter::getChanges( $new, $old );
90 foreach ( $hid as $v ) {
91 $changes[] = $this->
msg(
"$v-hid" )->plain();
95 foreach ( $unhid as $v ) {
96 $changes[] = $this->
msg(
"$v-unhid" )->plain();
98 foreach ( $extra as $v ) {
99 $changes[] = $this->
msg( $v )->plain();
101 $changeText = $this->context->getLanguage()->listToText( $changes );
103 $newParams = array_slice(
$params, 0, 3 );
104 $newParams[3] = $changeText;
105 $ids = is_array(
$params[$paramStart] )
107 : explode(
',',
$params[$paramStart] );
108 $newParams[4] = $this->context->getLanguage()->formatNum( count( $ids ) );
110 $this->parsedParametersDeleteLog = $newParams;
111 return $this->parsedParametersDeleteLog;
113 $this->parsedParametersDeleteLog = array_slice(
$params, 0, 3 );
114 return $this->parsedParametersDeleteLog;
116 } elseif ( $subtype ===
'restore' ) {
117 $rawParams = $this->entry->getParameters();
118 if ( isset( $rawParams[
':assoc:count'] ) ) {
120 foreach ( $rawParams[
':assoc:count'] as $type => $count ) {
123 $countList[] = $this->context->msg(
'restore-count-' . $type )
124 ->numParams( $count )->plain();
127 $params[3] = $this->context->getLanguage()->listToText( $countList );
131 $this->parsedParametersDeleteLog =
$params;
132 return $this->parsedParametersDeleteLog;
148 if ( !$this->context->getAuthority()->isAllowed(
'deletedhistory' )
149 || $this->entry->isDeleted( LogPage::DELETED_ACTION )
154 switch ( $this->entry->getSubtype() ) {
157 case 'delete_redir2':
158 if ( $this->context->getAuthority()->isAllowed(
'undelete' ) ) {
159 $message =
'undeletelink';
161 $message =
'undeleteviewlink';
163 $revert = $linkRenderer->makeKnownLink(
164 SpecialPage::getTitleFor(
'Undelete' ),
165 $this->
msg( $message )->text(),
167 [
'target' => $this->entry->getTarget()->getPrefixedDBkey() ]
170 return $this->
msg(
'parentheses' )->rawParams( $revert )->escaped();
188 if ( count( $ids ) == 1 ) {
190 if ( $key ==
'oldid' || $key ==
'revision' ) {
191 $links[] = $linkRenderer->makeKnownLink(
192 $this->entry->getTarget(),
193 $this->msg(
'diff' )->text(),
196 'diff' => intval( $ids[0] ),
201 } elseif ( $key ==
'artimestamp' || $key ==
'archive' ) {
202 $links[] = $linkRenderer->makeKnownLink(
203 SpecialPage::getTitleFor(
'Undelete' ),
204 $this->
msg(
'diff' )->text(),
207 'target' => $this->entry->getTarget()->getPrefixedDBkey(),
209 'timestamp' => $ids[0]
216 $links[] = $linkRenderer->makeKnownLink(
217 SpecialPage::getTitleFor(
'Revisiondelete' ),
218 $this->
msg(
'revdel-restore' )->text(),
221 'target' => $this->entry->getTarget()->getPrefixedText(),
223 'ids' => implode(
',', $ids ),
227 return $this->
msg(
'parentheses' )->rawParams(
228 $this->context->getLanguage()->pipeList( $links ) )->escaped();
237 if ( is_array( $query ) ) {
238 $query = implode(
',', $query );
241 $revert = $linkRenderer->makeKnownLink(
242 SpecialPage::getTitleFor(
'Revisiondelete' ),
243 $this->
msg(
'revdel-restore' )->text(),
246 'target' => $this->entry->getTarget()->getPrefixedText(),
252 return $this->
msg(
'parentheses' )->rawParams( $revert )->escaped();
263 if ( in_array( $subtype, [
'event',
'revision' ] ) ) {
265 if ( $subtype ===
'event' ) {
266 array_unshift( $rawParams,
'logging' );
274 '4::ids' =>
'5::ids',
275 '5::ofield' =>
'6::ofield',
276 '6::nfield' =>
'7::nfield',
278 foreach ( $map as $index => $key ) {
279 if ( isset( $rawParams[$index] ) ) {
280 $rawParams[$key] = $rawParams[$index];
281 unset( $rawParams[$index] );
285 if ( !is_array( $rawParams[
'5::ids'] ) ) {
286 $rawParams[
'5::ids'] = explode(
',', $rawParams[
'5::ids'] );
290 '::type' => $rawParams[
'4::type'],
291 ':array:ids' => $rawParams[
'5::ids'],
295 RevisionRecord::DELETED_TEXT =>
'content',
296 RevisionRecord::DELETED_COMMENT =>
'comment',
297 RevisionRecord::DELETED_USER =>
'user',
298 RevisionRecord::DELETED_RESTRICTED =>
'restricted',
301 if ( isset( $rawParams[
'6::ofield'] ) ) {
303 $params[
':assoc:old'] = [
'bitmask' => $old ];
304 foreach ( $fields as $bit => $key ) {
305 $params[
':assoc:old'][$key] = (bool)( $old & $bit );
308 if ( isset( $rawParams[
'7::nfield'] ) ) {
310 $params[
':assoc:new'] = [
'bitmask' => $new ];
311 foreach ( $fields as $bit => $key ) {
312 $params[
':assoc:new'][$key] = (bool)( $new & $bit );
315 } elseif ( $subtype ===
'restore' ) {
317 if ( isset( $rawParams[
':assoc:count'] ) ) {
318 $params[
':assoc:count'] = $rawParams[
':assoc:count'];