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