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