64 if ( $this->parsedParametersDeleteLog !==
null ) {
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] )
79 && in_array( $params[3], [
'revision',
'archive',
'oldimage',
'filearchive' ] )
83 $paramStart = $subtype ===
'revision' ? 4 : 3;
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] )
106 ? $params[$paramStart]
107 : explode(
',', $params[$paramStart] );
108 $newParams[4] = $this->context->getLanguage()->formatNum( count( $ids ) );
110 $this->parsedParametersDeleteLog = $newParams;
113 $this->parsedParametersDeleteLog = array_slice( $params, 0, 3 );
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;
147 $user = $this->context->getUser();
149 $permissionManager = MediaWikiServices::getInstance()->getPermissionManager();
150 if ( !$permissionManager->userHasRight( $user,
'deletedhistory' )
156 switch ( $this->entry->getSubtype() ) {
159 if ( $permissionManager->userHasRight( $user,
'undelete' ) ) {
160 $message =
'undeletelink';
162 $message =
'undeleteviewlink';
165 SpecialPage::getTitleFor(
'Undelete' ),
166 $this->
msg( $message )->text(),
168 [
'target' => $this->entry->getTarget()->getPrefixedDBkey() ]
171 return $this->
msg(
'parentheses' )->rawParams( $revert )->escaped();
175 if ( !isset( $params[3] ) || !isset( $params[4] ) ) {
182 $ids = is_array( $params[4] )
184 : explode(
',', $params[4] );
189 if ( count( $ids ) == 1 ) {
191 if ( $key ==
'oldid' || $key ==
'revision' ) {
193 $this->entry->getTarget(),
194 $this->msg(
'diff' )->text(),
197 'diff' => intval( $ids[0] ),
202 } elseif ( $key ==
'artimestamp' || $key ==
'archive' ) {
204 SpecialPage::getTitleFor(
'Undelete' ),
205 $this->
msg(
'diff' )->text(),
208 'target' => $this->entry->getTarget()->getPrefixedDBkey(),
210 'timestamp' => $ids[0]
218 SpecialPage::getTitleFor(
'Revisiondelete' ),
219 $this->
msg(
'revdel-restore' )->text(),
222 'target' => $this->entry->getTarget()->getPrefixedText(),
224 'ids' => implode(
',', $ids ),
228 return $this->
msg(
'parentheses' )->rawParams(
229 $this->context->getLanguage()->pipeList( $links ) )->escaped();
233 if ( !isset( $params[3] ) ) {
238 if ( is_array( $query ) ) {
239 $query = implode(
',', $query );
243 SpecialPage::getTitleFor(
'Revisiondelete' ),
244 $this->
msg(
'revdel-restore' )->text(),
247 'target' => $this->entry->getTarget()->getPrefixedText(),
253 return $this->
msg(
'parentheses' )->rawParams( $revert )->escaped();
264 if ( in_array( $subtype, [
'event',
'revision' ] ) ) {
266 if ( $subtype ===
'event' ) {
267 array_unshift( $rawParams,
'logging' );
275 '4::ids' =>
'5::ids',
276 '5::ofield' =>
'6::ofield',
277 '6::nfield' =>
'7::nfield',
279 foreach ( $map as $index => $key ) {
280 if ( isset( $rawParams[$index] ) ) {
281 $rawParams[$key] = $rawParams[$index];
282 unset( $rawParams[$index] );
286 if ( !is_array( $rawParams[
'5::ids'] ) ) {
287 $rawParams[
'5::ids'] = explode(
',', $rawParams[
'5::ids'] );
291 '::type' => $rawParams[
'4::type'],
292 ':array:ids' => $rawParams[
'5::ids'],
296 RevisionRecord::DELETED_TEXT =>
'content',
297 RevisionRecord::DELETED_COMMENT =>
'comment',
298 RevisionRecord::DELETED_USER =>
'user',
299 RevisionRecord::DELETED_RESTRICTED =>
'restricted',
302 if ( isset( $rawParams[
'6::ofield'] ) ) {
304 $params[
':assoc:old'] = [
'bitmask' => $old ];
305 foreach ( $fields as $bit => $key ) {
306 $params[
':assoc:old'][$key] = (bool)( $old & $bit );
309 if ( isset( $rawParams[
'7::nfield'] ) ) {
311 $params[
':assoc:new'] = [
'bitmask' => $new ];
312 foreach ( $fields as $bit => $key ) {
313 $params[
':assoc:new'][$key] = (bool)( $new & $bit );
316 } elseif ( $subtype ===
'restore' ) {
318 if ( isset( $rawParams[
':assoc:count'] ) ) {
319 $params[
':assoc:count'] = $rawParams[
':assoc:count'];