MediaWiki  master
SpecialRevisionDelete.php
Go to the documentation of this file.
1 <?php
26 
35  protected $wasSaved = false;
36 
38  private $submitClicked;
39 
41  private $ids;
42 
44  private $archiveName;
45 
47  private $token;
48 
50  private $targetObj;
51 
53  private $typeName;
54 
56  private $checks;
57 
59  private $typeLabels;
60 
62  private $revDelList;
63 
65  private $mIsAllowed;
66 
68  private $otherReason;
69 
72 
76  private static $UILabels = [
77  'revision' => [
78  'check-label' => 'revdelete-hide-text',
79  'success' => 'revdelete-success',
80  'failure' => 'revdelete-failure',
81  'text' => 'revdelete-text-text',
82  'selected' => 'revdelete-selected-text',
83  ],
84  'archive' => [
85  'check-label' => 'revdelete-hide-text',
86  'success' => 'revdelete-success',
87  'failure' => 'revdelete-failure',
88  'text' => 'revdelete-text-text',
89  'selected' => 'revdelete-selected-text',
90  ],
91  'oldimage' => [
92  'check-label' => 'revdelete-hide-image',
93  'success' => 'revdelete-success',
94  'failure' => 'revdelete-failure',
95  'text' => 'revdelete-text-file',
96  'selected' => 'revdelete-selected-file',
97  ],
98  'filearchive' => [
99  'check-label' => 'revdelete-hide-image',
100  'success' => 'revdelete-success',
101  'failure' => 'revdelete-failure',
102  'text' => 'revdelete-text-file',
103  'selected' => 'revdelete-selected-file',
104  ],
105  'logging' => [
106  'check-label' => 'revdelete-hide-name',
107  'success' => 'logdelete-success',
108  'failure' => 'logdelete-failure',
109  'text' => 'logdelete-text',
110  'selected' => 'logdelete-selected',
111  ],
112  ];
113 
120  parent::__construct( 'Revisiondelete', 'deleterevision' );
121 
122  $this->permissionManager = $permissionManager;
123  }
124 
125  public function doesWrites() {
126  return true;
127  }
128 
129  public function execute( $par ) {
130  $this->useTransactionalTimeLimit();
131 
132  $this->checkPermissions();
133  $this->checkReadOnly();
134 
135  $output = $this->getOutput();
136  $user = $this->getUser();
137 
138  $this->setHeaders();
139  $this->outputHeader();
140  $request = $this->getRequest();
141  $this->submitClicked = $request->wasPosted() && $request->getBool( 'wpSubmit' );
142  # Handle our many different possible input types.
143  $ids = $request->getVal( 'ids' );
144  if ( !is_null( $ids ) ) {
145  # Allow CSV, for backwards compatibility, or a single ID for show/hide links
146  $this->ids = explode( ',', $ids );
147  } else {
148  # Array input
149  $this->ids = array_keys( $request->getArray( 'ids', [] ) );
150  }
151  // $this->ids = array_map( 'intval', $this->ids );
152  $this->ids = array_unique( array_filter( $this->ids ) );
153 
154  $this->typeName = $request->getVal( 'type' );
155  $this->targetObj = Title::newFromText( $request->getText( 'target' ) );
156 
157  # For reviewing deleted files...
158  $this->archiveName = $request->getVal( 'file' );
159  $this->token = $request->getVal( 'token' );
160  if ( $this->archiveName && $this->targetObj ) {
161  $this->tryShowFile( $this->archiveName );
162 
163  return;
164  }
165 
166  $this->typeName = RevisionDeleter::getCanonicalTypeName( $this->typeName );
167 
168  # No targets?
169  if ( !$this->typeName || count( $this->ids ) == 0 ) {
170  throw new ErrorPageError( 'revdelete-nooldid-title', 'revdelete-nooldid-text' );
171  }
172 
173  # Allow the list type to adjust the passed target
174  $this->targetObj = RevisionDeleter::suggestTarget(
175  $this->typeName,
176  $this->targetObj,
177  $this->ids
178  );
179 
180  # We need a target page!
181  if ( $this->targetObj === null ) {
182  $output->addWikiMsg( 'undelete-header' );
183 
184  return;
185  }
186 
187  // Check blocks
188  if ( $this->permissionManager->isBlockedFrom( $user, $this->targetObj ) ) {
189  throw new UserBlockedError( $user->getBlock() );
190  }
191 
192  $this->typeLabels = self::$UILabels[$this->typeName];
193  $list = $this->getList();
194  $list->reset();
195  $this->mIsAllowed = $this->permissionManager->userHasRight( $user,
196  RevisionDeleter::getRestriction( $this->typeName ) );
197  $canViewSuppressedOnly = $this->permissionManager->userHasRight( $user, 'viewsuppressed' ) &&
198  !$this->permissionManager->userHasRight( $user, 'suppressrevision' );
199  $pageIsSuppressed = $list->areAnySuppressed();
200  $this->mIsAllowed = $this->mIsAllowed && !( $canViewSuppressedOnly && $pageIsSuppressed );
201 
202  $this->otherReason = $request->getVal( 'wpReason' );
203  # Give a link to the logs/hist for this page
204  $this->showConvenienceLinks();
205 
206  # Initialise checkboxes
207  $this->checks = [
208  # Messages: revdelete-hide-text, revdelete-hide-image, revdelete-hide-name
209  [ $this->typeLabels['check-label'], 'wpHidePrimary',
210  RevisionDeleter::getRevdelConstant( $this->typeName )
211  ],
212  [ 'revdelete-hide-comment', 'wpHideComment', RevisionRecord::DELETED_COMMENT ],
213  [ 'revdelete-hide-user', 'wpHideUser', RevisionRecord::DELETED_USER ]
214  ];
215  if ( $this->permissionManager->userHasRight( $user, 'suppressrevision' ) ) {
216  $this->checks[] = [ 'revdelete-hide-restricted',
217  'wpHideRestricted', RevisionRecord::DELETED_RESTRICTED ];
218  }
219 
220  # Either submit or create our form
221  if ( $this->mIsAllowed && $this->submitClicked ) {
222  $this->submit();
223  } else {
224  $this->showForm();
225  }
226 
227  if ( $this->permissionManager->userHasRight( $user, 'deletedhistory' ) ) {
228  $qc = $this->getLogQueryCond();
229  # Show relevant lines from the deletion log
230  $deleteLogPage = new LogPage( 'delete' );
231  $output->addHTML( "<h2>" . $deleteLogPage->getName()->escaped() . "</h2>\n" );
233  $output,
234  'delete',
235  $this->targetObj,
236  '', /* user */
237  [ 'lim' => 25, 'conds' => $qc, 'useMaster' => $this->wasSaved ]
238  );
239  }
240  # Show relevant lines from the suppression log
241  if ( $this->permissionManager->userHasRight( $user, 'suppressionlog' ) ) {
242  $suppressLogPage = new LogPage( 'suppress' );
243  $output->addHTML( "<h2>" . $suppressLogPage->getName()->escaped() . "</h2>\n" );
245  $output,
246  'suppress',
247  $this->targetObj,
248  '',
249  [ 'lim' => 25, 'conds' => $qc, 'useMaster' => $this->wasSaved ]
250  );
251  }
252  }
253 
257  protected function showConvenienceLinks() {
258  $linkRenderer = $this->getLinkRenderer();
259  # Give a link to the logs/hist for this page
260  if ( $this->targetObj ) {
261  // Also set header tabs to be for the target.
262  $this->getSkin()->setRelevantTitle( $this->targetObj );
263 
264  $links = [];
265  $links[] = $linkRenderer->makeKnownLink(
266  SpecialPage::getTitleFor( 'Log' ),
267  $this->msg( 'viewpagelogs' )->text(),
268  [],
269  [ 'page' => $this->targetObj->getPrefixedText() ]
270  );
271  if ( !$this->targetObj->isSpecialPage() ) {
272  # Give a link to the page history
273  $links[] = $linkRenderer->makeKnownLink(
274  $this->targetObj,
275  $this->msg( 'pagehist' )->text(),
276  [],
277  [ 'action' => 'history' ]
278  );
279  # Link to deleted edits
280  if ( $this->permissionManager->userHasRight( $this->getUser(), 'undelete' ) ) {
281  $undelete = SpecialPage::getTitleFor( 'Undelete' );
282  $links[] = $linkRenderer->makeKnownLink(
283  $undelete,
284  $this->msg( 'deletedhist' )->text(),
285  [],
286  [ 'target' => $this->targetObj->getPrefixedDBkey() ]
287  );
288  }
289  }
290  # Logs themselves don't have histories or archived revisions
291  $this->getOutput()->addSubtitle( $this->getLanguage()->pipeList( $links ) );
292  }
293  }
294 
299  protected function getLogQueryCond() {
300  $conds = [];
301  // Revision delete logs for these item
302  $conds['log_type'] = [ 'delete', 'suppress' ];
303  $conds['log_action'] = $this->getList()->getLogAction();
304  $conds['ls_field'] = RevisionDeleter::getRelationType( $this->typeName );
305  $conds['ls_value'] = $this->ids;
306 
307  return $conds;
308  }
309 
317  protected function tryShowFile( $archiveName ) {
318  $repo = RepoGroup::singleton()->getLocalRepo();
319  $oimage = $repo->newFromArchiveName( $this->targetObj, $archiveName );
320  $oimage->load();
321  // Check if user is allowed to see this file
322  if ( !$oimage->exists() ) {
323  $this->getOutput()->addWikiMsg( 'revdelete-no-file' );
324 
325  return;
326  }
327  $user = $this->getUser();
328  if ( !$oimage->userCan( File::DELETED_FILE, $user ) ) {
329  if ( $oimage->isDeleted( File::DELETED_RESTRICTED ) ) {
330  throw new PermissionsError( 'suppressrevision' );
331  } else {
332  throw new PermissionsError( 'deletedtext' );
333  }
334  }
335  if ( !$user->matchEditToken( $this->token, $archiveName ) ) {
336  $lang = $this->getLanguage();
337  $this->getOutput()->addWikiMsg( 'revdelete-show-file-confirm',
338  $this->targetObj->getText(),
339  $lang->userDate( $oimage->getTimestamp(), $user ),
340  $lang->userTime( $oimage->getTimestamp(), $user ) );
341  $this->getOutput()->addHTML(
342  Xml::openElement( 'form', [
343  'method' => 'POST',
344  'action' => $this->getPageTitle()->getLocalURL( [
345  'target' => $this->targetObj->getPrefixedDBkey(),
346  'file' => $archiveName,
347  'token' => $user->getEditToken( $archiveName ),
348  ] )
349  ]
350  ) .
351  Xml::submitButton( $this->msg( 'revdelete-show-file-submit' )->text() ) .
352  '</form>'
353  );
354 
355  return;
356  }
357  $this->getOutput()->disable();
358  # We mustn't allow the output to be CDN cached, otherwise
359  # if an admin previews a deleted image, and it's cached, then
360  # a user without appropriate permissions can toddle off and
361  # nab the image, and CDN will serve it
362  $this->getRequest()->response()->header( 'Expires: ' . gmdate( 'D, d M Y H:i:s', 0 ) . ' GMT' );
363  $this->getRequest()->response()->header(
364  'Cache-Control: no-cache, no-store, max-age=0, must-revalidate'
365  );
366  $this->getRequest()->response()->header( 'Pragma: no-cache' );
367 
368  $key = $oimage->getStorageKey();
369  $path = $repo->getZonePath( 'deleted' ) . '/' . $repo->getDeletedHashPath( $key ) . $key;
370  $repo->streamFileWithStatus( $path );
371  }
372 
377  protected function getList() {
378  if ( is_null( $this->revDelList ) ) {
379  $this->revDelList = RevisionDeleter::createList(
380  $this->typeName, $this->getContext(), $this->targetObj, $this->ids
381  );
382  }
383 
384  return $this->revDelList;
385  }
386 
391  protected function showForm() {
392  $userAllowed = true;
393 
394  // Messages: revdelete-selected-text, revdelete-selected-file, logdelete-selected
395  $out = $this->getOutput();
396  $out->wrapWikiMsg( "<strong>$1</strong>", [ $this->typeLabels['selected'],
397  $this->getLanguage()->formatNum( count( $this->ids ) ), $this->targetObj->getPrefixedText() ] );
398 
399  $this->addHelpLink( 'Help:RevisionDelete' );
400  $out->addHTML( "<ul>" );
401 
402  $numRevisions = 0;
403  // Live revisions...
404  $list = $this->getList();
405  for ( $list->reset(); $list->current(); $list->next() ) {
406  $item = $list->current();
407 
408  if ( !$item->canView() ) {
409  if ( !$this->submitClicked ) {
410  throw new PermissionsError( 'suppressrevision' );
411  }
412  $userAllowed = false;
413  }
414 
415  $numRevisions++;
416  $out->addHTML( $item->getHTML() );
417  }
418 
419  if ( !$numRevisions ) {
420  throw new ErrorPageError( 'revdelete-nooldid-title', 'revdelete-nooldid-text' );
421  }
422 
423  $out->addHTML( "</ul>" );
424  // Explanation text
425  $this->addUsageText();
426 
427  // Normal sysops can always see what they did, but can't always change it
428  if ( !$userAllowed ) {
429  return;
430  }
431 
432  // Show form if the user can submit
433  if ( $this->mIsAllowed ) {
434  $suppressAllowed = $this->permissionManager
435  ->userHasRight( $this->getUser(), 'suppressrevision' );
436  $out->addModules( [ 'mediawiki.special.revisionDelete' ] );
437  $out->addModuleStyles( [ 'mediawiki.special',
438  'mediawiki.interface.helpers.styles' ] );
439 
440  $dropDownReason = $this->msg( 'revdelete-reason-dropdown' )->inContentLanguage()->text();
441  // Add additional specific reasons for suppress
442  if ( $suppressAllowed ) {
443  $dropDownReason .= "\n" . $this->msg( 'revdelete-reason-dropdown-suppress' )
444  ->inContentLanguage()->text();
445  }
446 
447  $form = Xml::openElement( 'form', [ 'method' => 'post',
448  'action' => $this->getPageTitle()->getLocalURL( [ 'action' => 'submit' ] ),
449  'id' => 'mw-revdel-form-revisions' ] ) .
450  Xml::fieldset( $this->msg( 'revdelete-legend' )->text() ) .
451  $this->buildCheckBoxes() .
452  Xml::openElement( 'table' ) .
453  "<tr>\n" .
454  '<td class="mw-label">' .
455  Xml::label( $this->msg( 'revdelete-log' )->text(), 'wpRevDeleteReasonList' ) .
456  '</td>' .
457  '<td class="mw-input">' .
458  Xml::listDropDown( 'wpRevDeleteReasonList',
459  $dropDownReason,
460  $this->msg( 'revdelete-reasonotherlist' )->inContentLanguage()->text(),
461  $this->getRequest()->getText( 'wpRevDeleteReasonList', 'other' ), 'wpReasonDropDown'
462  ) .
463  '</td>' .
464  "</tr><tr>\n" .
465  '<td class="mw-label">' .
466  Xml::label( $this->msg( 'revdelete-otherreason' )->text(), 'wpReason' ) .
467  '</td>' .
468  '<td class="mw-input">' .
469  Xml::input( 'wpReason', 60, $this->otherReason, [
470  'id' => 'wpReason',
471  // HTML maxlength uses "UTF-16 code units", which means that characters outside BMP
472  // (e.g. emojis) count for two each. This limit is overridden in JS to instead count
473  // Unicode codepoints.
474  // "- 155" is to leave room for the 'wpRevDeleteReasonList' value.
475  'maxlength' => CommentStore::COMMENT_CHARACTER_LIMIT - 155,
476  ] ) .
477  '</td>' .
478  "</tr><tr>\n" .
479  '<td></td>' .
480  '<td class="mw-submit">' .
481  Xml::submitButton( $this->msg( 'revdelete-submit', $numRevisions )->text(),
482  [ 'name' => 'wpSubmit' ] ) .
483  '</td>' .
484  "</tr>\n" .
485  Xml::closeElement( 'table' ) .
486  Html::hidden( 'wpEditToken', $this->getUser()->getEditToken() ) .
487  Html::hidden( 'target', $this->targetObj->getPrefixedText() ) .
488  Html::hidden( 'type', $this->typeName ) .
489  Html::hidden( 'ids', implode( ',', $this->ids ) ) .
490  Xml::closeElement( 'fieldset' ) . "\n" .
491  Xml::closeElement( 'form' ) . "\n";
492  // Show link to edit the dropdown reasons
493  if ( $this->permissionManager->userHasRight( $this->getUser(), 'editinterface' ) ) {
494  $link = '';
495  $linkRenderer = $this->getLinkRenderer();
496  if ( $suppressAllowed ) {
497  $link .= $linkRenderer->makeKnownLink(
498  $this->msg( 'revdelete-reason-dropdown-suppress' )->inContentLanguage()->getTitle(),
499  $this->msg( 'revdelete-edit-reasonlist-suppress' )->text(),
500  [],
501  [ 'action' => 'edit' ]
502  );
503  $link .= $this->msg( 'pipe-separator' )->escaped();
504  }
505  $link .= $linkRenderer->makeKnownLink(
506  $this->msg( 'revdelete-reason-dropdown' )->inContentLanguage()->getTitle(),
507  $this->msg( 'revdelete-edit-reasonlist' )->text(),
508  [],
509  [ 'action' => 'edit' ]
510  );
511  $form .= Xml::tags( 'p', [ 'class' => 'mw-revdel-editreasons' ], $link ) . "\n";
512  }
513  } else {
514  $form = '';
515  }
516  $out->addHTML( $form );
517  }
518 
523  protected function addUsageText() {
524  // Messages: revdelete-text-text, revdelete-text-file, logdelete-text
525  $this->getOutput()->wrapWikiMsg(
526  "<strong>$1</strong>\n$2", $this->typeLabels['text'],
527  'revdelete-text-others'
528  );
529 
530  if ( $this->permissionManager->userHasRight( $this->getUser(), 'suppressrevision' ) ) {
531  $this->getOutput()->addWikiMsg( 'revdelete-suppress-text' );
532  }
533 
534  if ( $this->mIsAllowed ) {
535  $this->getOutput()->addWikiMsg( 'revdelete-confirm' );
536  }
537  }
538 
542  protected function buildCheckBoxes() {
543  $html = '<table>';
544  // If there is just one item, use checkboxes
545  $list = $this->getList();
546  if ( $list->length() == 1 ) {
547  $list->reset();
548  $bitfield = $list->current()->getBits(); // existing field
549 
550  if ( $this->submitClicked ) {
551  $bitfield = RevisionDeleter::extractBitfield( $this->extractBitParams(), $bitfield );
552  }
553 
554  foreach ( $this->checks as $item ) {
555  // Messages: revdelete-hide-text, revdelete-hide-image, revdelete-hide-name,
556  // revdelete-hide-comment, revdelete-hide-user, revdelete-hide-restricted
557  list( $message, $name, $field ) = $item;
558  $innerHTML = Xml::checkLabel(
559  $this->msg( $message )->text(),
560  $name,
561  $name,
562  $bitfield & $field
563  );
564 
565  if ( $field == RevisionRecord::DELETED_RESTRICTED ) {
566  $innerHTML = "<b>$innerHTML</b>";
567  }
568 
569  $line = Xml::tags( 'td', [ 'class' => 'mw-input' ], $innerHTML );
570  $html .= "<tr>$line</tr>\n";
571  }
572  } else {
573  // Otherwise, use tri-state radios
574  $html .= '<tr>';
575  $html .= '<th class="mw-revdel-checkbox">'
576  . $this->msg( 'revdelete-radio-same' )->escaped() . '</th>';
577  $html .= '<th class="mw-revdel-checkbox">'
578  . $this->msg( 'revdelete-radio-unset' )->escaped() . '</th>';
579  $html .= '<th class="mw-revdel-checkbox">'
580  . $this->msg( 'revdelete-radio-set' )->escaped() . '</th>';
581  $html .= "<th></th></tr>\n";
582  foreach ( $this->checks as $item ) {
583  // Messages: revdelete-hide-text, revdelete-hide-image, revdelete-hide-name,
584  // revdelete-hide-comment, revdelete-hide-user, revdelete-hide-restricted
585  list( $message, $name, $field ) = $item;
586  // If there are several items, use third state by default...
587  if ( $this->submitClicked ) {
588  $selected = $this->getRequest()->getInt( $name, 0 /* unchecked */ );
589  } else {
590  $selected = -1; // use existing field
591  }
592  $line = '<td class="mw-revdel-checkbox">' . Xml::radio( $name, -1, $selected == -1 ) . '</td>';
593  $line .= '<td class="mw-revdel-checkbox">' . Xml::radio( $name, 0, $selected == 0 ) . '</td>';
594  $line .= '<td class="mw-revdel-checkbox">' . Xml::radio( $name, 1, $selected == 1 ) . '</td>';
595  $label = $this->msg( $message )->escaped();
596  if ( $field == RevisionRecord::DELETED_RESTRICTED ) {
597  $label = "<b>$label</b>";
598  }
599  $line .= "<td>$label</td>";
600  $html .= "<tr>$line</tr>\n";
601  }
602  }
603 
604  $html .= '</table>';
605 
606  return $html;
607  }
608 
614  protected function submit() {
615  # Check edit token on submission
616  $token = $this->getRequest()->getVal( 'wpEditToken' );
617  if ( $this->submitClicked && !$this->getUser()->matchEditToken( $token ) ) {
618  $this->getOutput()->addWikiMsg( 'sessionfailure' );
619 
620  return false;
621  }
622  $bitParams = $this->extractBitParams();
623  // from dropdown
624  $listReason = $this->getRequest()->getText( 'wpRevDeleteReasonList', 'other' );
625  $comment = $listReason;
626  if ( $comment === 'other' ) {
627  $comment = $this->otherReason;
628  } elseif ( $this->otherReason !== '' ) {
629  // Entry from drop down menu + additional comment
630  $comment .= $this->msg( 'colon-separator' )->inContentLanguage()->text()
632  }
633  # Can the user set this field?
634  if ( $bitParams[RevisionRecord::DELETED_RESTRICTED] == 1
635  && !$this->permissionManager->userHasRight( $this->getUser(), 'suppressrevision' )
636  ) {
637  throw new PermissionsError( 'suppressrevision' );
638  }
639  # If the save went through, go to success message...
640  $status = $this->save( $bitParams, $comment );
641  if ( $status->isGood() ) {
642  $this->success();
643 
644  return true;
645  } else {
646  # ...otherwise, bounce back to form...
647  $this->failure( $status );
648  }
649 
650  return false;
651  }
652 
656  protected function success() {
657  // Messages: revdelete-success, logdelete-success
658  $this->getOutput()->setPageTitle( $this->msg( 'actioncomplete' ) );
659  $this->getOutput()->wrapWikiMsg(
660  "<div class=\"successbox\">\n$1\n</div>",
661  $this->typeLabels['success']
662  );
663  $this->wasSaved = true;
664  $this->revDelList->reloadFromMaster();
665  $this->showForm();
666  }
667 
672  protected function failure( $status ) {
673  // Messages: revdelete-failure, logdelete-failure
674  $this->getOutput()->setPageTitle( $this->msg( 'actionfailed' ) );
675  $this->getOutput()->wrapWikiTextAsInterface(
676  'errorbox',
677  $status->getWikiText( $this->typeLabels['failure'], false, $this->getLanguage() )
678  );
679  $this->showForm();
680  }
681 
687  protected function extractBitParams() {
688  $bitfield = [];
689  foreach ( $this->checks as $item ) {
690  list( /* message */, $name, $field ) = $item;
691  $val = $this->getRequest()->getInt( $name, 0 /* unchecked */ );
692  if ( $val < -1 || $val > 1 ) {
693  $val = -1; // -1 for existing value
694  }
695  $bitfield[$field] = $val;
696  }
697  if ( !isset( $bitfield[RevisionRecord::DELETED_RESTRICTED] ) ) {
698  $bitfield[RevisionRecord::DELETED_RESTRICTED] = 0;
699  }
700 
701  return $bitfield;
702  }
703 
710  protected function save( array $bitPars, $reason ) {
711  return $this->getList()->setVisibility(
712  [ 'value' => $bitPars, 'comment' => $reason ]
713  );
714  }
715 
716  protected function getGroupName() {
717  return 'pagetools';
718  }
719 }
string $archiveName
Archive name, for reviewing deleted files.
static getRelationType( $typeName)
Get DB field name for URL param...
showConvenienceLinks()
Show some useful links in the subtitle.
static getRestriction( $typeName)
Get the user right required for the RevDel type.
string $typeName
Deletion type, may be revision, archive, oldimage, filearchive, logging.
Shortcut to construct a special page which is unlisted by default.
bool $mIsAllowed
Whether user is allowed to perform the action.
static getCanonicalTypeName( $typeName)
Gets the canonical type name, if any.
getContext()
Gets the context this SpecialPage is executed in.
if(!isset( $args[0])) $lang
static input( $name, $size=false, $value=false, $attribs=[])
Convenience function to build an HTML text input field.
Definition: Xml.php:274
static $UILabels
UI labels for each type.
addHelpLink( $to, $overrideBaseUrl=false)
Adds help link with an icon via page indicators.
PermissionManager $permissionManager
getOutput()
Get the OutputPage being used for this instance.
const COMMENT_CHARACTER_LIMIT
Maximum length of a comment in UTF-8 characters.
Title $targetObj
Title object for target parameter.
showForm()
Show a list of items that we will operate on, and show a form with checkboxes which will allow the us...
const DELETED_FILE
Definition: File.php:63
Class to simplify the use of log pages.
Definition: LogPage.php:33
msg( $key,... $params)
Wrapper around wfMessage that sets the current context.
Special page allowing users with the appropriate permissions to view and hide revisions.
static openElement( $element, $attribs=null)
This opens an XML element.
Definition: Xml.php:108
bool $wasSaved
Was the DB modified in this request.
bool $submitClicked
True if the submit button was clicked, and the form was posted.
An error page which can definitely be safely rendered using the OutputPage.
static fieldset( $legend=false, $content=false, $attribs=[])
Shortcut for creating fieldsets.
Definition: Xml.php:609
getLogQueryCond()
Get the condition used for fetching log snippets.
static singleton()
Definition: RepoGroup.php:60
static createList( $typeName, IContextSource $context, Title $title, array $ids)
Instantiate the appropriate list class for a given list of IDs.
static submitButton( $value, $attribs=[])
Convenience function to build an HTML submit button When $wgUseMediaWikiUIEverywhere is true it will ...
Definition: Xml.php:459
array $typeLabels
UI Labels about the current type.
getSkin()
Shortcut to get the skin being used for this instance.
static tags( $element, $attribs, $contents)
Same as Xml::element(), but does not escape contents.
Definition: Xml.php:130
static extractBitfield(array $bitPars, $oldfield)
Put together a rev_deleted bitfield.
static getRevdelConstant( $typeName)
Get the revision deletion constant for the RevDel type.
setHeaders()
Sets headers - this should be called from the execute() method of all derived classes! ...
static getTitleFor( $name, $subpage=false, $fragment='')
Get a localised Title object for a specified special page name If you don&#39;t need a full Title object...
Definition: SpecialPage.php:83
Show an error when the user tries to do something whilst blocked.
array $checks
Array of checkbox specs (message, name, deletion bits)
static label( $label, $id, $attribs=[])
Convenience function to build an HTML form label.
Definition: Xml.php:358
static __construct(PermissionManager $permissionManager)
const DELETED_RESTRICTED
Definition: File.php:66
extractBitParams()
Put together an array that contains -1, 0, or the *_deleted const for each bit.
string $token
Edit token for securing image views against XSS.
array $ids
Target ID list.
static closeElement( $element)
Shortcut to close an XML element.
Definition: Xml.php:117
static listDropDown( $name='', $list='', $other='', $selected='', $class='', $tabindex=null)
Build a drop-down box from a textual list.
Definition: Xml.php:508
static suggestTarget( $typeName, $target, array $ids)
Suggest a target for the revision deletion.
useTransactionalTimeLimit()
Call wfTransactionalTimeLimit() if this request was POSTed.
getUser()
Shortcut to get the User executing this instance.
static hidden( $name, $value, array $attribs=[])
Convenience function to produce an input element with type=hidden.
Definition: Html.php:802
$line
Definition: cdb.php:59
addUsageText()
Show some introductory text.
Show an error when a user tries to do something they do not have the necessary permissions for...
getLanguage()
Shortcut to get user&#39;s language.
save(array $bitPars, $reason)
Do the write operations.
getList()
Get the list object for this request.
checkPermissions()
Checks if userCanExecute, and if not throws a PermissionsError.
static checkLabel( $label, $name, $id, $checked=false, $attribs=[])
Convenience function to build an HTML checkbox with a label.
Definition: Xml.php:419
getRequest()
Get the WebRequest being used for this instance.
RevDelList $revDelList
RevDelList object, storing the list of items to be deleted/undeleted.
static radio( $name, $value, $checked=false, $attribs=[])
Convenience function to build an HTML radio button.
Definition: Xml.php:341
checkReadOnly()
If the wiki is currently in readonly mode, throws a ReadOnlyError.
failure( $status)
Report that the submit operation failed.
success()
Report that the submit operation succeeded.
outputHeader( $summaryMessageKey='')
Outputs a summary message on top of special pages Per default the message key is the canonical name o...
getPageTitle( $subpage=false)
Get a self-referential title object.
A service class for checking permissions To obtain an instance, use MediaWikiServices::getInstance()-...
tryShowFile( $archiveName)
Show a deleted file version requested by the visitor.
static showLogExtract(&$out, $types=[], $page='', $user='', $param=[])
Show log extract.
MediaWiki Linker LinkRenderer null $linkRenderer
Definition: SpecialPage.php:67
static newFromText( $text, $defaultNamespace=NS_MAIN)
Create a new Title from text, such as what one would find in a link.
Definition: Title.php:319
submit()
UI entry point for form submission.