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