(bug 37714) Use log type in target object when deleting logs of the same type
[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 /** True if the submit button was clicked, and the form was posted */
32 var $submitClicked;
33
34 /** Target ID list */
35 var $ids;
36
37 /** Archive name, for reviewing deleted files */
38 var $archiveName;
39
40 /** Edit token for securing image views against XSS */
41 var $token;
42
43 /** Title object for target parameter */
44 var $targetObj;
45
46 /** Deletion type, may be revision, archive, oldimage, filearchive, logging. */
47 var $typeName;
48
49 /** Array of checkbox specs (message, name, deletion bits) */
50 var $checks;
51
52 /** Information about the current type */
53 var $typeInfo;
54
55 /** The RevDel_List object, storing the list of items to be deleted/undeleted */
56 var $list;
57
58 /**
59 * Assorted information about each type, needed by the special page.
60 * TODO Move some of this to the list class
61 */
62 static $allowedTypes = array(
63 'revision' => array(
64 'check-label' => 'revdelete-hide-text',
65 'deletion-bits' => Revision::DELETED_TEXT,
66 'success' => 'revdelete-success',
67 'failure' => 'revdelete-failure',
68 'list-class' => 'RevDel_RevisionList',
69 'permission' => 'deleterevision',
70 ),
71 'archive' => array(
72 'check-label' => 'revdelete-hide-text',
73 'deletion-bits' => Revision::DELETED_TEXT,
74 'success' => 'revdelete-success',
75 'failure' => 'revdelete-failure',
76 'list-class' => 'RevDel_ArchiveList',
77 'permission' => 'deleterevision',
78 ),
79 'oldimage'=> array(
80 'check-label' => 'revdelete-hide-image',
81 'deletion-bits' => File::DELETED_FILE,
82 'success' => 'revdelete-success',
83 'failure' => 'revdelete-failure',
84 'list-class' => 'RevDel_FileList',
85 'permission' => 'deleterevision',
86 ),
87 'filearchive' => array(
88 'check-label' => 'revdelete-hide-image',
89 'deletion-bits' => File::DELETED_FILE,
90 'success' => 'revdelete-success',
91 'failure' => 'revdelete-failure',
92 'list-class' => 'RevDel_ArchivedFileList',
93 'permission' => 'deleterevision',
94 ),
95 'logging' => array(
96 'check-label' => 'revdelete-hide-name',
97 'deletion-bits' => LogPage::DELETED_ACTION,
98 'success' => 'logdelete-success',
99 'failure' => 'logdelete-failure',
100 'list-class' => 'RevDel_LogList',
101 'permission' => 'deletelogentry',
102 ),
103 );
104
105 /** Type map to support old log entries */
106 static $deprecatedTypeMap = array(
107 'oldid' => 'revision',
108 'artimestamp' => 'archive',
109 'oldimage' => 'oldimage',
110 'fileid' => 'filearchive',
111 'logid' => 'logging',
112 );
113
114 public function __construct() {
115 parent::__construct( 'Revisiondelete', 'deletedhistory' );
116 }
117
118 public function execute( $par ) {
119 $this->checkPermissions();
120 $this->checkReadOnly();
121
122 $output = $this->getOutput();
123 $user = $this->getUser();
124
125 $this->setHeaders();
126 $this->outputHeader();
127 $request = $this->getRequest();
128 $this->submitClicked = $request->wasPosted() && $request->getBool( 'wpSubmit' );
129 # Handle our many different possible input types.
130 $ids = $request->getVal( 'ids' );
131 if ( !is_null( $ids ) ) {
132 # Allow CSV, for backwards compatibility, or a single ID for show/hide links
133 $this->ids = explode( ',', $ids );
134 } else {
135 # Array input
136 $this->ids = array_keys( $request->getArray('ids',array()) );
137 }
138 // $this->ids = array_map( 'intval', $this->ids );
139 $this->ids = array_unique( array_filter( $this->ids ) );
140
141 if ( $request->getVal( 'action' ) == 'historysubmit' || $request->getVal( 'action' ) == 'revisiondelete' ) {
142 // For show/hide form submission from history page
143 // Since we are access through index.php?title=XXX&action=historysubmit
144 // getFullTitle() will contain the target title and not our title
145 $this->targetObj = $this->getFullTitle();
146 $this->typeName = 'revision';
147 } else {
148 $this->typeName = $request->getVal( 'type' );
149 $this->targetObj = Title::newFromText( $request->getText( 'target' ) );
150 if ( $this->targetObj && $this->targetObj->isSpecial( 'Log' ) ) {
151 $result = wfGetDB( DB_SLAVE )->select( 'logging',
152 'log_type',
153 array( 'log_id' => $this->ids ),
154 __METHOD__,
155 array( 'DISTINCT' )
156 );
157
158 if ( $result->numRows() == 1 ) {
159 // If there's only one type, the target can be set to include it.
160 $this->targetObj = SpecialPage::getTitleFor( 'Log', $result->current()->log_type );
161 }
162 }
163 }
164
165 # For reviewing deleted files...
166 $this->archiveName = $request->getVal( 'file' );
167 $this->token = $request->getVal( 'token' );
168 if ( $this->archiveName && $this->targetObj ) {
169 $this->tryShowFile( $this->archiveName );
170 return;
171 }
172
173 if ( isset( self::$deprecatedTypeMap[$this->typeName] ) ) {
174 $this->typeName = self::$deprecatedTypeMap[$this->typeName];
175 }
176
177 # No targets?
178 if( !isset( self::$allowedTypes[$this->typeName] ) || count( $this->ids ) == 0 ) {
179 throw new ErrorPageError( 'revdelete-nooldid-title', 'revdelete-nooldid-text' );
180 }
181 $this->typeInfo = self::$allowedTypes[$this->typeName];
182 $this->mIsAllowed = $user->isAllowed( $this->typeInfo['permission'] );
183
184 # If we have revisions, get the title from the first one
185 # since they should all be from the same page. This allows
186 # for more flexibility with page moves...
187 if( $this->typeName == 'revision' ) {
188 $rev = Revision::newFromId( $this->ids[0] );
189 $this->targetObj = $rev ? $rev->getTitle() : $this->targetObj;
190 }
191
192 $this->otherReason = $request->getVal( 'wpReason' );
193 # We need a target page!
194 if( is_null($this->targetObj) ) {
195 $output->addWikiMsg( 'undelete-header' );
196 return;
197 }
198 # Give a link to the logs/hist for this page
199 $this->showConvenienceLinks();
200
201 # Initialise checkboxes
202 $this->checks = array(
203 array( $this->typeInfo['check-label'], 'wpHidePrimary', $this->typeInfo['deletion-bits'] ),
204 array( 'revdelete-hide-comment', 'wpHideComment', Revision::DELETED_COMMENT ),
205 array( 'revdelete-hide-user', 'wpHideUser', Revision::DELETED_USER )
206 );
207 if( $user->isAllowed('suppressrevision') ) {
208 $this->checks[] = array( 'revdelete-hide-restricted',
209 'wpHideRestricted', Revision::DELETED_RESTRICTED );
210 }
211
212 # Either submit or create our form
213 if( $this->mIsAllowed && $this->submitClicked ) {
214 $this->submit( $request );
215 } else {
216 $this->showForm();
217 }
218
219 $qc = $this->getLogQueryCond();
220 # Show relevant lines from the deletion log
221 $deleteLogPage = new LogPage( 'delete' );
222 $output->addHTML( "<h2>" . $deleteLogPage->getName()->escaped() . "</h2>\n" );
223 LogEventsList::showLogExtract( $output, 'delete',
224 $this->targetObj, '', array( 'lim' => 25, 'conds' => $qc ) );
225 # Show relevant lines from the suppression log
226 if( $user->isAllowed( 'suppressionlog' ) ) {
227 $suppressLogPage = new LogPage( 'suppress' );
228 $output->addHTML( "<h2>" . $suppressLogPage->getName()->escaped() . "</h2>\n" );
229 LogEventsList::showLogExtract( $output, 'suppress',
230 $this->targetObj, '', array( 'lim' => 25, 'conds' => $qc ) );
231 }
232 }
233
234 /**
235 * Show some useful links in the subtitle
236 */
237 protected function showConvenienceLinks() {
238 # Give a link to the logs/hist for this page
239 if( $this->targetObj ) {
240 $links = array();
241 $links[] = Linker::linkKnown(
242 SpecialPage::getTitleFor( 'Log' ),
243 $this->msg( 'viewpagelogs' )->escaped(),
244 array(),
245 array( 'page' => $this->targetObj->getPrefixedText() )
246 );
247 if ( !$this->targetObj->isSpecialPage() ) {
248 # Give a link to the page history
249 $links[] = Linker::linkKnown(
250 $this->targetObj,
251 $this->msg( 'pagehist' )->escaped(),
252 array(),
253 array( 'action' => 'history' )
254 );
255 # Link to deleted edits
256 if( $this->getUser()->isAllowed('undelete') ) {
257 $undelete = SpecialPage::getTitleFor( 'Undelete' );
258 $links[] = Linker::linkKnown(
259 $undelete,
260 $this->msg( 'deletedhist' )->escaped(),
261 array(),
262 array( 'target' => $this->targetObj->getPrefixedDBkey() )
263 );
264 }
265 }
266 # Logs themselves don't have histories or archived revisions
267 $this->getOutput()->addSubtitle( $this->getLanguage()->pipeList( $links ) );
268 }
269 }
270
271 /**
272 * Get the condition used for fetching log snippets
273 * @return array
274 */
275 protected function getLogQueryCond() {
276 $conds = array();
277 // Revision delete logs for these item
278 $conds['log_type'] = array( 'delete', 'suppress' );
279 $conds['log_action'] = $this->getList()->getLogAction();
280 $conds['ls_field'] = RevisionDeleter::getRelationType( $this->typeName );
281 $conds['ls_value'] = $this->ids;
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 */
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 return;
297 }
298 $user = $this->getUser();
299 if( !$oimage->userCan( File::DELETED_FILE, $user ) ) {
300 if( $oimage->isDeleted( File::DELETED_RESTRICTED ) ) {
301 throw new PermissionsError( 'suppressrevision' );
302 } else {
303 throw new PermissionsError( 'deletedtext' );
304 }
305 }
306 if ( !$user->matchEditToken( $this->token, $archiveName ) ) {
307 $lang = $this->getLanguage();
308 $this->getOutput()->addWikiMsg( 'revdelete-show-file-confirm',
309 $this->targetObj->getText(),
310 $lang->userDate( $oimage->getTimestamp(), $user ),
311 $lang->userTime( $oimage->getTimestamp(), $user ) );
312 $this->getOutput()->addHTML(
313 Xml::openElement( 'form', array(
314 'method' => 'POST',
315 'action' => $this->getTitle()->getLocalUrl(
316 'target=' . urlencode( $this->targetObj->getPrefixedDBkey() ) .
317 '&file=' . urlencode( $archiveName ) .
318 '&token=' . urlencode( $user->getEditToken( $archiveName ) ) )
319 )
320 ) .
321 Xml::submitButton( $this->msg( 'revdelete-show-file-submit' )->text() ) .
322 '</form>'
323 );
324 return;
325 }
326 $this->getOutput()->disable();
327 # We mustn't allow the output to be Squid cached, otherwise
328 # if an admin previews a deleted image, and it's cached, then
329 # a user without appropriate permissions can toddle off and
330 # nab the image, and Squid will serve it
331 $this->getRequest()->response()->header( 'Expires: ' . gmdate( 'D, d M Y H:i:s', 0 ) . ' GMT' );
332 $this->getRequest()->response()->header( 'Cache-Control: no-cache, no-store, max-age=0, must-revalidate' );
333 $this->getRequest()->response()->header( 'Pragma: no-cache' );
334
335 $key = $oimage->getStorageKey();
336 $path = $repo->getZonePath( 'deleted' ) . '/' . $repo->getDeletedHashPath( $key ) . $key;
337 $repo->streamFile( $path );
338 }
339
340 /**
341 * Get the list object for this request
342 */
343 protected function getList() {
344 if ( is_null( $this->list ) ) {
345 $class = $this->typeInfo['list-class'];
346 $this->list = new $class( $this->getContext(), $this->targetObj, $this->ids );
347 }
348 return $this->list;
349 }
350
351 /**
352 * Show a list of items that we will operate on, and show a form with checkboxes
353 * which will allow the user to choose new visibility settings.
354 */
355 protected function showForm() {
356 $UserAllowed = true;
357
358 if ( $this->typeName == 'logging' ) {
359 $this->getOutput()->addWikiMsg( 'logdelete-selected', $this->getLanguage()->formatNum( count($this->ids) ) );
360 } else {
361 $this->getOutput()->addWikiMsg( 'revdelete-selected',
362 $this->targetObj->getPrefixedText(), count( $this->ids ) );
363 }
364
365 $this->getOutput()->addHTML( "<ul>" );
366
367 $numRevisions = 0;
368 // Live revisions...
369 $list = $this->getList();
370 for ( $list->reset(); $list->current(); $list->next() ) {
371 $item = $list->current();
372 if ( !$item->canView() ) {
373 if( !$this->submitClicked ) {
374 throw new PermissionsError( 'suppressrevision' );
375 }
376 $UserAllowed = false;
377 }
378 $numRevisions++;
379 $this->getOutput()->addHTML( $item->getHTML() );
380 }
381
382 if( !$numRevisions ) {
383 throw new ErrorPageError( 'revdelete-nooldid-title', 'revdelete-nooldid-text' );
384 }
385
386 $this->getOutput()->addHTML( "</ul>" );
387 // Explanation text
388 $this->addUsageText();
389
390 // Normal sysops can always see what they did, but can't always change it
391 if( !$UserAllowed ) return;
392
393 // Show form if the user can submit
394 if( $this->mIsAllowed ) {
395 $out = Xml::openElement( 'form', array( 'method' => 'post',
396 'action' => $this->getTitle()->getLocalUrl( array( 'action' => 'submit' ) ),
397 'id' => 'mw-revdel-form-revisions' ) ) .
398 Xml::fieldset( $this->msg( 'revdelete-legend' )->text() ) .
399 $this->buildCheckBoxes() .
400 Xml::openElement( 'table' ) .
401 "<tr>\n" .
402 '<td class="mw-label">' .
403 Xml::label( $this->msg( 'revdelete-log' )->text(), 'wpRevDeleteReasonList' ) .
404 '</td>' .
405 '<td class="mw-input">' .
406 Xml::listDropDown( 'wpRevDeleteReasonList',
407 $this->msg( 'revdelete-reason-dropdown' )->inContentLanguage()->text(),
408 $this->msg( 'revdelete-reasonotherlist' )->inContentLanguage()->text(),
409 '', 'wpReasonDropDown', 1
410 ) .
411 '</td>' .
412 "</tr><tr>\n" .
413 '<td class="mw-label">' .
414 Xml::label( $this->msg( 'revdelete-otherreason' )->text(), 'wpReason' ) .
415 '</td>' .
416 '<td class="mw-input">' .
417 Xml::input( 'wpReason', 60, $this->otherReason, array( 'id' => 'wpReason', 'maxlength' => 100 ) ) .
418 '</td>' .
419 "</tr><tr>\n" .
420 '<td></td>' .
421 '<td class="mw-submit">' .
422 Xml::submitButton( $this->msg( 'revdelete-submit', $numRevisions )->text(),
423 array( 'name' => 'wpSubmit' ) ) .
424 '</td>' .
425 "</tr>\n" .
426 Xml::closeElement( 'table' ) .
427 Html::hidden( 'wpEditToken', $this->getUser()->getEditToken() ) .
428 Html::hidden( 'target', $this->targetObj->getPrefixedText() ) .
429 Html::hidden( 'type', $this->typeName ) .
430 Html::hidden( 'ids', implode( ',', $this->ids ) ) .
431 Xml::closeElement( 'fieldset' ) . "\n";
432 } else {
433 $out = '';
434 }
435 if( $this->mIsAllowed ) {
436 $out .= Xml::closeElement( 'form' ) . "\n";
437 // Show link to edit the dropdown reasons
438 if( $this->getUser()->isAllowed( 'editinterface' ) ) {
439 $title = Title::makeTitle( NS_MEDIAWIKI, 'Revdelete-reason-dropdown' );
440 $link = Linker::link(
441 $title,
442 $this->msg( 'revdelete-edit-reasonlist' )->escaped(),
443 array(),
444 array( 'action' => 'edit' )
445 );
446 $out .= Xml::tags( 'p', array( 'class' => 'mw-revdel-editreasons' ), $link ) . "\n";
447 }
448 }
449 $this->getOutput()->addHTML( $out );
450 }
451
452 /**
453 * Show some introductory text
454 * @todo FIXME: Wikimedia-specific policy text
455 */
456 protected function addUsageText() {
457 $this->getOutput()->addWikiMsg( 'revdelete-text' );
458 if( $this->getUser()->isAllowed( 'suppressrevision' ) ) {
459 $this->getOutput()->addWikiMsg( 'revdelete-suppress-text' );
460 }
461 if( $this->mIsAllowed ) {
462 $this->getOutput()->addWikiMsg( 'revdelete-confirm' );
463 }
464 }
465
466 /**
467 * @return String: HTML
468 */
469 protected function buildCheckBoxes() {
470 $html = '<table>';
471 // If there is just one item, use checkboxes
472 $list = $this->getList();
473 if( $list->length() == 1 ) {
474 $list->reset();
475 $bitfield = $list->current()->getBits(); // existing field
476 if( $this->submitClicked ) {
477 $bitfield = $this->extractBitfield( $this->extractBitParams(), $bitfield );
478 }
479 foreach( $this->checks as $item ) {
480 list( $message, $name, $field ) = $item;
481 $innerHTML = Xml::checkLabel( $this->msg( $message )->text(), $name, $name, $bitfield & $field );
482 if( $field == Revision::DELETED_RESTRICTED )
483 $innerHTML = "<b>$innerHTML</b>";
484 $line = Xml::tags( 'td', array( 'class' => 'mw-input' ), $innerHTML );
485 $html .= "<tr>$line</tr>\n";
486 }
487 // Otherwise, use tri-state radios
488 } else {
489 $html .= '<tr>';
490 $html .= '<th class="mw-revdel-checkbox">' . $this->msg( 'revdelete-radio-same' )->escaped() . '</th>';
491 $html .= '<th class="mw-revdel-checkbox">' . $this->msg( 'revdelete-radio-unset' )->escaped() . '</th>';
492 $html .= '<th class="mw-revdel-checkbox">' . $this->msg( 'revdelete-radio-set' )->escaped() . '</th>';
493 $html .= "<th></th></tr>\n";
494 foreach( $this->checks as $item ) {
495 list( $message, $name, $field ) = $item;
496 // If there are several items, use third state by default...
497 if( $this->submitClicked ) {
498 $selected = $this->getRequest()->getInt( $name, 0 /* unchecked */ );
499 } else {
500 $selected = -1; // use existing field
501 }
502 $line = '<td class="mw-revdel-checkbox">' . Xml::radio( $name, -1, $selected == -1 ) . '</td>';
503 $line .= '<td class="mw-revdel-checkbox">' . Xml::radio( $name, 0, $selected == 0 ) . '</td>';
504 $line .= '<td class="mw-revdel-checkbox">' . Xml::radio( $name, 1, $selected == 1 ) . '</td>';
505 $label = $this->msg( $message )->escaped();
506 if( $field == Revision::DELETED_RESTRICTED ) {
507 $label = "<b>$label</b>";
508 }
509 $line .= "<td>$label</td>";
510 $html .= "<tr>$line</tr>\n";
511 }
512 }
513
514 $html .= '</table>';
515 return $html;
516 }
517
518 /**
519 * UI entry point for form submission.
520 * @throws PermissionsError
521 * @return bool
522 */
523 protected function submit() {
524 # Check edit token on submission
525 $token = $this->getRequest()->getVal('wpEditToken');
526 if( $this->submitClicked && !$this->getUser()->matchEditToken( $token ) ) {
527 $this->getOutput()->addWikiMsg( 'sessionfailure' );
528 return false;
529 }
530 $bitParams = $this->extractBitParams();
531 $listReason = $this->getRequest()->getText( 'wpRevDeleteReasonList', 'other' ); // from dropdown
532 $comment = $listReason;
533 if( $comment != 'other' && $this->otherReason != '' ) {
534 // Entry from drop down menu + additional comment
535 $comment .= $this->msg( 'colon-separator' )->inContentLanguage()->text() . $this->otherReason;
536 } elseif( $comment == 'other' ) {
537 $comment = $this->otherReason;
538 }
539 # Can the user set this field?
540 if( $bitParams[Revision::DELETED_RESTRICTED]==1 && !$this->getUser()->isAllowed('suppressrevision') ) {
541 throw new PermissionsError( 'suppressrevision' );
542 }
543 # If the save went through, go to success message...
544 $status = $this->save( $bitParams, $comment, $this->targetObj );
545 if ( $status->isGood() ) {
546 $this->success();
547 return true;
548 # ...otherwise, bounce back to form...
549 } else {
550 $this->failure( $status );
551 }
552 return false;
553 }
554
555 /**
556 * Report that the submit operation succeeded
557 */
558 protected function success() {
559 $this->getOutput()->setPageTitle( $this->msg( 'actioncomplete' ) );
560 $this->getOutput()->wrapWikiMsg( "<span class=\"success\">\n$1\n</span>", $this->typeInfo['success'] );
561 $this->list->reloadFromMaster();
562 $this->showForm();
563 }
564
565 /**
566 * Report that the submit operation failed
567 */
568 protected function failure( $status ) {
569 $this->getOutput()->setPageTitle( $this->msg( 'actionfailed' ) );
570 $this->getOutput()->addWikiText( $status->getWikiText( $this->typeInfo['failure'] ) );
571 $this->showForm();
572 }
573
574 /**
575 * Put together an array that contains -1, 0, or the *_deleted const for each bit
576 *
577 * @return array
578 */
579 protected function extractBitParams() {
580 $bitfield = array();
581 foreach( $this->checks as $item ) {
582 list( /* message */ , $name, $field ) = $item;
583 $val = $this->getRequest()->getInt( $name, 0 /* unchecked */ );
584 if( $val < -1 || $val > 1) {
585 $val = -1; // -1 for existing value
586 }
587 $bitfield[$field] = $val;
588 }
589 if( !isset($bitfield[Revision::DELETED_RESTRICTED]) ) {
590 $bitfield[Revision::DELETED_RESTRICTED] = 0;
591 }
592 return $bitfield;
593 }
594
595 /**
596 * Put together a rev_deleted bitfield
597 * @param $bitPars array extractBitParams() params
598 * @param $oldfield int current bitfield
599 * @return array
600 */
601 public static function extractBitfield( $bitPars, $oldfield ) {
602 // Build the actual new rev_deleted bitfield
603 $newBits = 0;
604 foreach( $bitPars as $const => $val ) {
605 if( $val == 1 ) {
606 $newBits |= $const; // $const is the *_deleted const
607 } elseif( $val == -1 ) {
608 $newBits |= ($oldfield & $const); // use existing
609 }
610 }
611 return $newBits;
612 }
613
614 /**
615 * Do the write operations. Simple wrapper for RevDel_*List::setVisibility().
616 * @param $bitfield
617 * @param $reason
618 * @param $title
619 * @return
620 */
621 protected function save( $bitfield, $reason, $title ) {
622 return $this->getList()->setVisibility(
623 array( 'value' => $bitfield, 'comment' => $reason )
624 );
625 }
626 }
627