Merge "mediawiki.action.view.redirect: Explicitly scroll to element in hash"
[lhc/web/wiklou.git] / includes / specials / SpecialRevisiondelete.php
1 <?php
2 /**
3 * Implements Special:Revisiondelete
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * http://www.gnu.org/copyleft/gpl.html
19 *
20 * @file
21 * @ingroup SpecialPage
22 */
23
24 /**
25 * Special page allowing users with the appropriate permissions to view
26 * and hide revisions. Log items can also be hidden.
27 *
28 * @ingroup SpecialPage
29 */
30 class SpecialRevisionDelete extends UnlistedSpecialPage {
31 /** @var bool Was the DB modified in this request */
32 protected $wasSaved = false;
33
34 /** @var bool True if the submit button was clicked, and the form was posted */
35 private $submitClicked;
36
37 /** @var array Target ID list */
38 private $ids;
39
40 /** @var string Archive name, for reviewing deleted files */
41 private $archiveName;
42
43 /** @var string Edit token for securing image views against XSS */
44 private $token;
45
46 /** @var Title Title object for target parameter */
47 private $targetObj;
48
49 /** @var string Deletion type, may be revision, archive, oldimage, filearchive, logging. */
50 private $typeName;
51
52 /** @var array Array of checkbox specs (message, name, deletion bits) */
53 private $checks;
54
55 /** @var array UI Labels about the current type */
56 private $typeLabels;
57
58 /** @var RevDelList RevDelList object, storing the list of items to be deleted/undeleted */
59 private $revDelList;
60
61 /** @var bool Whether user is allowed to perform the action */
62 private $mIsAllowed;
63
64 /** @var string */
65 private $otherReason;
66
67 /**
68 * UI labels for each type.
69 */
70 private static $UILabels = array(
71 'revision' => array(
72 'check-label' => 'revdelete-hide-text',
73 'success' => 'revdelete-success',
74 'failure' => 'revdelete-failure',
75 'text' => 'revdelete-text-text',
76 'selected'=> 'revdelete-selected-text',
77 ),
78 'archive' => array(
79 'check-label' => 'revdelete-hide-text',
80 'success' => 'revdelete-success',
81 'failure' => 'revdelete-failure',
82 'text' => 'revdelete-text-text',
83 'selected'=> 'revdelete-selected-text',
84 ),
85 'oldimage' => array(
86 'check-label' => 'revdelete-hide-image',
87 'success' => 'revdelete-success',
88 'failure' => 'revdelete-failure',
89 'text' => 'revdelete-text-file',
90 'selected'=> 'revdelete-selected-file',
91 ),
92 'filearchive' => array(
93 'check-label' => 'revdelete-hide-image',
94 'success' => 'revdelete-success',
95 'failure' => 'revdelete-failure',
96 'text' => 'revdelete-text-file',
97 'selected'=> 'revdelete-selected-file',
98 ),
99 'logging' => array(
100 'check-label' => 'revdelete-hide-name',
101 'success' => 'logdelete-success',
102 'failure' => 'logdelete-failure',
103 'text' => 'logdelete-text',
104 'selected' => 'logdelete-selected',
105 ),
106 );
107
108 public function __construct() {
109 parent::__construct( 'Revisiondelete', 'deletedhistory' );
110 }
111
112 public function execute( $par ) {
113 $this->useTransactionalTimeLimit();
114
115 $this->checkPermissions();
116 $this->checkReadOnly();
117
118 $output = $this->getOutput();
119 $user = $this->getUser();
120
121 $this->setHeaders();
122 $this->outputHeader();
123 $request = $this->getRequest();
124 $this->submitClicked = $request->wasPosted() && $request->getBool( 'wpSubmit' );
125 # Handle our many different possible input types.
126 $ids = $request->getVal( 'ids' );
127 if ( !is_null( $ids ) ) {
128 # Allow CSV, for backwards compatibility, or a single ID for show/hide links
129 $this->ids = explode( ',', $ids );
130 } else {
131 # Array input
132 $this->ids = array_keys( $request->getArray( 'ids', array() ) );
133 }
134 // $this->ids = array_map( 'intval', $this->ids );
135 $this->ids = array_unique( array_filter( $this->ids ) );
136
137 $this->typeName = $request->getVal( 'type' );
138 $this->targetObj = Title::newFromText( $request->getText( 'target' ) );
139
140 # For reviewing deleted files...
141 $this->archiveName = $request->getVal( 'file' );
142 $this->token = $request->getVal( 'token' );
143 if ( $this->archiveName && $this->targetObj ) {
144 $this->tryShowFile( $this->archiveName );
145
146 return;
147 }
148
149 $this->typeName = RevisionDeleter::getCanonicalTypeName( $this->typeName );
150
151 # No targets?
152 if ( !$this->typeName || count( $this->ids ) == 0 ) {
153 throw new ErrorPageError( 'revdelete-nooldid-title', 'revdelete-nooldid-text' );
154 }
155
156 # Allow the list type to adjust the passed target
157 $this->targetObj = RevisionDeleter::suggestTarget(
158 $this->typeName,
159 $this->targetObj,
160 $this->ids
161 );
162
163 # We need a target page!
164 if ( $this->targetObj === null ) {
165 $output->addWikiMsg( 'undelete-header' );
166
167 return;
168 }
169
170 $this->typeLabels = self::$UILabels[$this->typeName];
171 $list = $this->getList();
172 $list->reset();
173 $this->mIsAllowed = $user->isAllowed( RevisionDeleter::getRestriction( $this->typeName ) );
174 $canViewSuppressedOnly = $this->getUser()->isAllowed( 'viewsuppressed' ) &&
175 !$this->getUser()->isAllowed( 'suppressrevision' );
176 $pageIsSuppressed = $list->areAnySuppressed();
177 $this->mIsAllowed = $this->mIsAllowed && !( $canViewSuppressedOnly && $pageIsSuppressed );
178
179 $this->otherReason = $request->getVal( 'wpReason' );
180 # Give a link to the logs/hist for this page
181 $this->showConvenienceLinks();
182
183 # Initialise checkboxes
184 $this->checks = array(
185 # Messages: revdelete-hide-text, revdelete-hide-image, revdelete-hide-name
186 array( $this->typeLabels['check-label'], 'wpHidePrimary',
187 RevisionDeleter::getRevdelConstant( $this->typeName )
188 ),
189 array( 'revdelete-hide-comment', 'wpHideComment', Revision::DELETED_COMMENT ),
190 array( 'revdelete-hide-user', 'wpHideUser', Revision::DELETED_USER )
191 );
192 if ( $user->isAllowed( 'suppressrevision' ) ) {
193 $this->checks[] = array( 'revdelete-hide-restricted',
194 'wpHideRestricted', Revision::DELETED_RESTRICTED );
195 }
196
197 # Either submit or create our form
198 if ( $this->mIsAllowed && $this->submitClicked ) {
199 $this->submit( $request );
200 } else {
201 $this->showForm();
202 }
203
204 $qc = $this->getLogQueryCond();
205 # Show relevant lines from the deletion log
206 $deleteLogPage = new LogPage( 'delete' );
207 $output->addHTML( "<h2>" . $deleteLogPage->getName()->escaped() . "</h2>\n" );
208 LogEventsList::showLogExtract(
209 $output,
210 'delete',
211 $this->targetObj,
212 '', /* user */
213 array( 'lim' => 25, 'conds' => $qc, 'useMaster' => $this->wasSaved )
214 );
215 # Show relevant lines from the suppression log
216 if ( $user->isAllowed( 'suppressionlog' ) ) {
217 $suppressLogPage = new LogPage( 'suppress' );
218 $output->addHTML( "<h2>" . $suppressLogPage->getName()->escaped() . "</h2>\n" );
219 LogEventsList::showLogExtract(
220 $output,
221 'suppress',
222 $this->targetObj,
223 '',
224 array( 'lim' => 25, 'conds' => $qc, 'useMaster' => $this->wasSaved )
225 );
226 }
227 }
228
229 /**
230 * Show some useful links in the subtitle
231 */
232 protected function showConvenienceLinks() {
233 # Give a link to the logs/hist for this page
234 if ( $this->targetObj ) {
235 // Also set header tabs to be for the target.
236 $this->getSkin()->setRelevantTitle( $this->targetObj );
237
238 $links = array();
239 $links[] = Linker::linkKnown(
240 SpecialPage::getTitleFor( 'Log' ),
241 $this->msg( 'viewpagelogs' )->escaped(),
242 array(),
243 array( 'page' => $this->targetObj->getPrefixedText() )
244 );
245 if ( !$this->targetObj->isSpecialPage() ) {
246 # Give a link to the page history
247 $links[] = Linker::linkKnown(
248 $this->targetObj,
249 $this->msg( 'pagehist' )->escaped(),
250 array(),
251 array( 'action' => 'history' )
252 );
253 # Link to deleted edits
254 if ( $this->getUser()->isAllowed( 'undelete' ) ) {
255 $undelete = SpecialPage::getTitleFor( 'Undelete' );
256 $links[] = Linker::linkKnown(
257 $undelete,
258 $this->msg( 'deletedhist' )->escaped(),
259 array(),
260 array( 'target' => $this->targetObj->getPrefixedDBkey() )
261 );
262 }
263 }
264 # Logs themselves don't have histories or archived revisions
265 $this->getOutput()->addSubtitle( $this->getLanguage()->pipeList( $links ) );
266 }
267 }
268
269 /**
270 * Get the condition used for fetching log snippets
271 * @return array
272 */
273 protected function getLogQueryCond() {
274 $conds = array();
275 // Revision delete logs for these item
276 $conds['log_type'] = array( 'delete', 'suppress' );
277 $conds['log_action'] = $this->getList()->getLogAction();
278 $conds['ls_field'] = RevisionDeleter::getRelationType( $this->typeName );
279 $conds['ls_value'] = $this->ids;
280
281 return $conds;
282 }
283
284 /**
285 * Show a deleted file version requested by the visitor.
286 * @todo Mostly copied from Special:Undelete. Refactor.
287 * @param string $archiveName
288 * @throws MWException
289 * @throws PermissionsError
290 */
291 protected function tryShowFile( $archiveName ) {
292 $repo = RepoGroup::singleton()->getLocalRepo();
293 $oimage = $repo->newFromArchiveName( $this->targetObj, $archiveName );
294 $oimage->load();
295 // Check if user is allowed to see this file
296 if ( !$oimage->exists() ) {
297 $this->getOutput()->addWikiMsg( 'revdelete-no-file' );
298
299 return;
300 }
301 $user = $this->getUser();
302 if ( !$oimage->userCan( File::DELETED_FILE, $user ) ) {
303 if ( $oimage->isDeleted( File::DELETED_RESTRICTED ) ) {
304 throw new PermissionsError( 'suppressrevision' );
305 } else {
306 throw new PermissionsError( 'deletedtext' );
307 }
308 }
309 if ( !$user->matchEditToken( $this->token, $archiveName ) ) {
310 $lang = $this->getLanguage();
311 $this->getOutput()->addWikiMsg( 'revdelete-show-file-confirm',
312 $this->targetObj->getText(),
313 $lang->userDate( $oimage->getTimestamp(), $user ),
314 $lang->userTime( $oimage->getTimestamp(), $user ) );
315 $this->getOutput()->addHTML(
316 Xml::openElement( 'form', array(
317 'method' => 'POST',
318 'action' => $this->getPageTitle()->getLocalURL( array(
319 'target' => $this->targetObj->getPrefixedDBkey(),
320 'file' => $archiveName,
321 'token' => $user->getEditToken( $archiveName ),
322 ) )
323 )
324 ) .
325 Xml::submitButton( $this->msg( 'revdelete-show-file-submit' )->text() ) .
326 '</form>'
327 );
328
329 return;
330 }
331 $this->getOutput()->disable();
332 # We mustn't allow the output to be CDN cached, otherwise
333 # if an admin previews a deleted image, and it's cached, then
334 # a user without appropriate permissions can toddle off and
335 # nab the image, and CDN will serve it
336 $this->getRequest()->response()->header( 'Expires: ' . gmdate( 'D, d M Y H:i:s', 0 ) . ' GMT' );
337 $this->getRequest()->response()->header(
338 'Cache-Control: no-cache, no-store, max-age=0, must-revalidate'
339 );
340 $this->getRequest()->response()->header( 'Pragma: no-cache' );
341
342 $key = $oimage->getStorageKey();
343 $path = $repo->getZonePath( 'deleted' ) . '/' . $repo->getDeletedHashPath( $key ) . $key;
344 $repo->streamFile( $path );
345 }
346
347 /**
348 * Get the list object for this request
349 * @return RevDelList
350 */
351 protected function getList() {
352 if ( is_null( $this->revDelList ) ) {
353 $this->revDelList = RevisionDeleter::createList(
354 $this->typeName, $this->getContext(), $this->targetObj, $this->ids
355 );
356 }
357
358 return $this->revDelList;
359 }
360
361 /**
362 * Show a list of items that we will operate on, and show a form with checkboxes
363 * which will allow the user to choose new visibility settings.
364 */
365 protected function showForm() {
366 $userAllowed = true;
367
368 // Messages: revdelete-selected-text, revdelete-selected-file, logdelete-selected
369 $out = $this->getOutput();
370 $out->wrapWikiMsg( "<strong>$1</strong>", array( $this->typeLabels['selected'],
371 $this->getLanguage()->formatNum( count( $this->ids ) ), $this->targetObj->getPrefixedText() ) );
372
373 $this->addHelpLink( 'Help:RevisionDelete' );
374 $out->addHTML( "<ul>" );
375
376 $numRevisions = 0;
377 // Live revisions...
378 $list = $this->getList();
379 // @codingStandardsIgnoreStart Generic.CodeAnalysis.ForLoopWithTestFunctionCall.NotAllowed
380 for ( $list->reset(); $list->current(); $list->next() ) {
381 // @codingStandardsIgnoreEnd
382 $item = $list->current();
383
384 if ( !$item->canView() ) {
385 if ( !$this->submitClicked ) {
386 throw new PermissionsError( 'suppressrevision' );
387 }
388 $userAllowed = false;
389 }
390
391 $numRevisions++;
392 $out->addHTML( $item->getHTML() );
393 }
394
395 if ( !$numRevisions ) {
396 throw new ErrorPageError( 'revdelete-nooldid-title', 'revdelete-nooldid-text' );
397 }
398
399 $out->addHTML( "</ul>" );
400 // Explanation text
401 $this->addUsageText();
402
403 // Normal sysops can always see what they did, but can't always change it
404 if ( !$userAllowed ) {
405 return;
406 }
407
408 // Show form if the user can submit
409 if ( $this->mIsAllowed ) {
410 $out->addModuleStyles( 'mediawiki.special' );
411
412 $form = Xml::openElement( 'form', array( 'method' => 'post',
413 'action' => $this->getPageTitle()->getLocalURL( array( 'action' => 'submit' ) ),
414 'id' => 'mw-revdel-form-revisions' ) ) .
415 Xml::fieldset( $this->msg( 'revdelete-legend' )->text() ) .
416 $this->buildCheckBoxes() .
417 Xml::openElement( 'table' ) .
418 "<tr>\n" .
419 '<td class="mw-label">' .
420 Xml::label( $this->msg( 'revdelete-log' )->text(), 'wpRevDeleteReasonList' ) .
421 '</td>' .
422 '<td class="mw-input">' .
423 Xml::listDropDown( 'wpRevDeleteReasonList',
424 $this->msg( 'revdelete-reason-dropdown' )->inContentLanguage()->text(),
425 $this->msg( 'revdelete-reasonotherlist' )->inContentLanguage()->text(),
426 $this->getRequest()->getText( 'wpRevDeleteReasonList', 'other' ), 'wpReasonDropDown'
427 ) .
428 '</td>' .
429 "</tr><tr>\n" .
430 '<td class="mw-label">' .
431 Xml::label( $this->msg( 'revdelete-otherreason' )->text(), 'wpReason' ) .
432 '</td>' .
433 '<td class="mw-input">' .
434 Xml::input(
435 'wpReason',
436 60,
437 $this->otherReason,
438 array( 'id' => 'wpReason', 'maxlength' => 100 )
439 ) .
440 '</td>' .
441 "</tr><tr>\n" .
442 '<td></td>' .
443 '<td class="mw-submit">' .
444 Xml::submitButton( $this->msg( 'revdelete-submit', $numRevisions )->text(),
445 array( 'name' => 'wpSubmit' ) ) .
446 '</td>' .
447 "</tr>\n" .
448 Xml::closeElement( 'table' ) .
449 Html::hidden( 'wpEditToken', $this->getUser()->getEditToken() ) .
450 Html::hidden( 'target', $this->targetObj->getPrefixedText() ) .
451 Html::hidden( 'type', $this->typeName ) .
452 Html::hidden( 'ids', implode( ',', $this->ids ) ) .
453 Xml::closeElement( 'fieldset' ) . "\n" .
454 Xml::closeElement( 'form' ) . "\n";
455 // Show link to edit the dropdown reasons
456 if ( $this->getUser()->isAllowed( 'editinterface' ) ) {
457 $link = Linker::linkKnown(
458 $this->msg( 'revdelete-reason-dropdown' )->inContentLanguage()->getTitle(),
459 $this->msg( 'revdelete-edit-reasonlist' )->escaped(),
460 array(),
461 array( 'action' => 'edit' )
462 );
463 $form .= Xml::tags( 'p', array( 'class' => 'mw-revdel-editreasons' ), $link ) . "\n";
464 }
465 } else {
466 $form = '';
467 }
468 $out->addHTML( $form );
469 }
470
471 /**
472 * Show some introductory text
473 * @todo FIXME: Wikimedia-specific policy text
474 */
475 protected function addUsageText() {
476 // Messages: revdelete-text-text, revdelete-text-file, logdelete-text
477 $this->getOutput()->wrapWikiMsg(
478 "<strong>$1</strong>\n$2", $this->typeLabels['text'],
479 'revdelete-text-others'
480 );
481
482 if ( $this->getUser()->isAllowed( 'suppressrevision' ) ) {
483 $this->getOutput()->addWikiMsg( 'revdelete-suppress-text' );
484 }
485
486 if ( $this->mIsAllowed ) {
487 $this->getOutput()->addWikiMsg( 'revdelete-confirm' );
488 }
489 }
490
491 /**
492 * @return string HTML
493 */
494 protected function buildCheckBoxes() {
495 $html = '<table>';
496 // If there is just one item, use checkboxes
497 $list = $this->getList();
498 if ( $list->length() == 1 ) {
499 $list->reset();
500 $bitfield = $list->current()->getBits(); // existing field
501
502 if ( $this->submitClicked ) {
503 $bitfield = RevisionDeleter::extractBitfield( $this->extractBitParams(), $bitfield );
504 }
505
506 foreach ( $this->checks as $item ) {
507 // Messages: revdelete-hide-text, revdelete-hide-image, revdelete-hide-name,
508 // revdelete-hide-comment, revdelete-hide-user, revdelete-hide-restricted
509 list( $message, $name, $field ) = $item;
510 $innerHTML = Xml::checkLabel(
511 $this->msg( $message )->text(),
512 $name,
513 $name,
514 $bitfield & $field
515 );
516
517 if ( $field == Revision::DELETED_RESTRICTED ) {
518 $innerHTML = "<b>$innerHTML</b>";
519 }
520
521 $line = Xml::tags( 'td', array( 'class' => 'mw-input' ), $innerHTML );
522 $html .= "<tr>$line</tr>\n";
523 }
524 } else {
525 // Otherwise, use tri-state radios
526 $html .= '<tr>';
527 $html .= '<th class="mw-revdel-checkbox">'
528 . $this->msg( 'revdelete-radio-same' )->escaped() . '</th>';
529 $html .= '<th class="mw-revdel-checkbox">'
530 . $this->msg( 'revdelete-radio-unset' )->escaped() . '</th>';
531 $html .= '<th class="mw-revdel-checkbox">'
532 . $this->msg( 'revdelete-radio-set' )->escaped() . '</th>';
533 $html .= "<th></th></tr>\n";
534 foreach ( $this->checks as $item ) {
535 // Messages: revdelete-hide-text, revdelete-hide-image, revdelete-hide-name,
536 // revdelete-hide-comment, revdelete-hide-user, revdelete-hide-restricted
537 list( $message, $name, $field ) = $item;
538 // If there are several items, use third state by default...
539 if ( $this->submitClicked ) {
540 $selected = $this->getRequest()->getInt( $name, 0 /* unchecked */ );
541 } else {
542 $selected = -1; // use existing field
543 }
544 $line = '<td class="mw-revdel-checkbox">' . Xml::radio( $name, -1, $selected == -1 ) . '</td>';
545 $line .= '<td class="mw-revdel-checkbox">' . Xml::radio( $name, 0, $selected == 0 ) . '</td>';
546 $line .= '<td class="mw-revdel-checkbox">' . Xml::radio( $name, 1, $selected == 1 ) . '</td>';
547 $label = $this->msg( $message )->escaped();
548 if ( $field == Revision::DELETED_RESTRICTED ) {
549 $label = "<b>$label</b>";
550 }
551 $line .= "<td>$label</td>";
552 $html .= "<tr>$line</tr>\n";
553 }
554 }
555
556 $html .= '</table>';
557
558 return $html;
559 }
560
561 /**
562 * UI entry point for form submission.
563 * @throws PermissionsError
564 * @return bool
565 */
566 protected function submit() {
567 # Check edit token on submission
568 $token = $this->getRequest()->getVal( 'wpEditToken' );
569 if ( $this->submitClicked && !$this->getUser()->matchEditToken( $token ) ) {
570 $this->getOutput()->addWikiMsg( 'sessionfailure' );
571
572 return false;
573 }
574 $bitParams = $this->extractBitParams();
575 // from dropdown
576 $listReason = $this->getRequest()->getText( 'wpRevDeleteReasonList', 'other' );
577 $comment = $listReason;
578 if ( $comment === 'other' ) {
579 $comment = $this->otherReason;
580 } elseif ( $this->otherReason !== '' ) {
581 // Entry from drop down menu + additional comment
582 $comment .= $this->msg( 'colon-separator' )->inContentLanguage()->text()
583 . $this->otherReason;
584 }
585 # Can the user set this field?
586 if ( $bitParams[Revision::DELETED_RESTRICTED] == 1
587 && !$this->getUser()->isAllowed( 'suppressrevision' )
588 ) {
589 throw new PermissionsError( 'suppressrevision' );
590 }
591 # If the save went through, go to success message...
592 $status = $this->save( $bitParams, $comment );
593 if ( $status->isGood() ) {
594 $this->success();
595
596 return true;
597 } else {
598 # ...otherwise, bounce back to form...
599 $this->failure( $status );
600 }
601
602 return false;
603 }
604
605 /**
606 * Report that the submit operation succeeded
607 */
608 protected function success() {
609 // Messages: revdelete-success, logdelete-success
610 $this->getOutput()->setPageTitle( $this->msg( 'actioncomplete' ) );
611 $this->getOutput()->wrapWikiMsg(
612 "<div class=\"successbox\">\n$1\n</div>",
613 $this->typeLabels['success']
614 );
615 $this->wasSaved = true;
616 $this->revDelList->reloadFromMaster();
617 $this->showForm();
618 }
619
620 /**
621 * Report that the submit operation failed
622 * @param Status $status
623 */
624 protected function failure( $status ) {
625 // Messages: revdelete-failure, logdelete-failure
626 $this->getOutput()->setPageTitle( $this->msg( 'actionfailed' ) );
627 $this->getOutput()->addWikiText( '<div class="errorbox">' .
628 $status->getWikiText( $this->typeLabels['failure'] ) .
629 '</div>'
630 );
631 $this->showForm();
632 }
633
634 /**
635 * Put together an array that contains -1, 0, or the *_deleted const for each bit
636 *
637 * @return array
638 */
639 protected function extractBitParams() {
640 $bitfield = array();
641 foreach ( $this->checks as $item ) {
642 list( /* message */, $name, $field ) = $item;
643 $val = $this->getRequest()->getInt( $name, 0 /* unchecked */ );
644 if ( $val < -1 || $val > 1 ) {
645 $val = -1; // -1 for existing value
646 }
647 $bitfield[$field] = $val;
648 }
649 if ( !isset( $bitfield[Revision::DELETED_RESTRICTED] ) ) {
650 $bitfield[Revision::DELETED_RESTRICTED] = 0;
651 }
652
653 return $bitfield;
654 }
655
656 /**
657 * Do the write operations. Simple wrapper for RevDel*List::setVisibility().
658 * @param array $bitPars ExtractBitParams() bitfield array
659 * @param string $reason
660 * @return Status
661 */
662 protected function save( array $bitPars, $reason ) {
663 return $this->getList()->setVisibility(
664 array( 'value' => $bitPars, 'comment' => $reason )
665 );
666 }
667
668 protected function getGroupName() {
669 return 'pagetools';
670 }
671 }