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 const UI_LABELS = [
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(
190  $user->getBlock(),
191  $user,
192  $this->getLanguage(),
193  $request->getIP()
194  );
195  }
196 
197  $this->typeLabels = self::UI_LABELS[$this->typeName];
198  $list = $this->getList();
199  $list->reset();
200  $this->mIsAllowed = $this->permissionManager->userHasRight( $user,
201  RevisionDeleter::getRestriction( $this->typeName ) );
202  $canViewSuppressedOnly = $this->permissionManager->userHasRight( $user, 'viewsuppressed' ) &&
203  !$this->permissionManager->userHasRight( $user, 'suppressrevision' );
204  $pageIsSuppressed = $list->areAnySuppressed();
205  $this->mIsAllowed = $this->mIsAllowed && !( $canViewSuppressedOnly && $pageIsSuppressed );
206 
207  $this->otherReason = $request->getVal( 'wpReason' );
208  # Give a link to the logs/hist for this page
209  $this->showConvenienceLinks();
210 
211  # Initialise checkboxes
212  $this->checks = [
213  # Messages: revdelete-hide-text, revdelete-hide-image, revdelete-hide-name
214  [ $this->typeLabels['check-label'], 'wpHidePrimary',
215  RevisionDeleter::getRevdelConstant( $this->typeName )
216  ],
217  [ 'revdelete-hide-comment', 'wpHideComment', RevisionRecord::DELETED_COMMENT ],
218  [ 'revdelete-hide-user', 'wpHideUser', RevisionRecord::DELETED_USER ]
219  ];
220  if ( $this->permissionManager->userHasRight( $user, 'suppressrevision' ) ) {
221  $this->checks[] = [ 'revdelete-hide-restricted',
222  'wpHideRestricted', RevisionRecord::DELETED_RESTRICTED ];
223  }
224 
225  # Either submit or create our form
226  if ( $this->mIsAllowed && $this->submitClicked ) {
227  $this->submit();
228  } else {
229  $this->showForm();
230  }
231 
232  if ( $this->permissionManager->userHasRight( $user, 'deletedhistory' ) ) {
233  $qc = $this->getLogQueryCond();
234  # Show relevant lines from the deletion log
235  $deleteLogPage = new LogPage( 'delete' );
236  $output->addHTML( "<h2>" . $deleteLogPage->getName()->escaped() . "</h2>\n" );
238  $output,
239  'delete',
240  $this->targetObj,
241  '', /* user */
242  [ 'lim' => 25, 'conds' => $qc, 'useMaster' => $this->wasSaved ]
243  );
244  }
245  # Show relevant lines from the suppression log
246  if ( $this->permissionManager->userHasRight( $user, 'suppressionlog' ) ) {
247  $suppressLogPage = new LogPage( 'suppress' );
248  $output->addHTML( "<h2>" . $suppressLogPage->getName()->escaped() . "</h2>\n" );
250  $output,
251  'suppress',
252  $this->targetObj,
253  '',
254  [ 'lim' => 25, 'conds' => $qc, 'useMaster' => $this->wasSaved ]
255  );
256  }
257  }
258 
262  protected function showConvenienceLinks() {
263  $linkRenderer = $this->getLinkRenderer();
264  # Give a link to the logs/hist for this page
265  if ( $this->targetObj ) {
266  // Also set header tabs to be for the target.
267  $this->getSkin()->setRelevantTitle( $this->targetObj );
268 
269  $links = [];
270  $links[] = $linkRenderer->makeKnownLink(
271  SpecialPage::getTitleFor( 'Log' ),
272  $this->msg( 'viewpagelogs' )->text(),
273  [],
274  [ 'page' => $this->targetObj->getPrefixedText() ]
275  );
276  if ( !$this->targetObj->isSpecialPage() ) {
277  # Give a link to the page history
278  $links[] = $linkRenderer->makeKnownLink(
279  $this->targetObj,
280  $this->msg( 'pagehist' )->text(),
281  [],
282  [ 'action' => 'history' ]
283  );
284  # Link to deleted edits
285  if ( $this->permissionManager->userHasRight( $this->getUser(), 'undelete' ) ) {
286  $undelete = SpecialPage::getTitleFor( 'Undelete' );
287  $links[] = $linkRenderer->makeKnownLink(
288  $undelete,
289  $this->msg( 'deletedhist' )->text(),
290  [],
291  [ 'target' => $this->targetObj->getPrefixedDBkey() ]
292  );
293  }
294  }
295  # Logs themselves don't have histories or archived revisions
296  $this->getOutput()->addSubtitle( $this->getLanguage()->pipeList( $links ) );
297  }
298  }
299 
304  protected function getLogQueryCond() {
305  $conds = [];
306  // Revision delete logs for these item
307  $conds['log_type'] = [ 'delete', 'suppress' ];
308  $conds['log_action'] = $this->getList()->getLogAction();
309  $conds['ls_field'] = RevisionDeleter::getRelationType( $this->typeName );
310  // Convert IDs to strings, since ls_value is a text field. This avoids
311  // a fatal error in PostgreSQL: "operator does not exist: text = integer".
312  $conds['ls_value'] = array_map( 'strval', $this->ids );
313 
314  return $conds;
315  }
316 
324  protected function tryShowFile( $archiveName ) {
325  $repo = RepoGroup::singleton()->getLocalRepo();
326  $oimage = $repo->newFromArchiveName( $this->targetObj, $archiveName );
327  $oimage->load();
328  // Check if user is allowed to see this file
329  if ( !$oimage->exists() ) {
330  $this->getOutput()->addWikiMsg( 'revdelete-no-file' );
331 
332  return;
333  }
334  $user = $this->getUser();
335  if ( !$oimage->userCan( File::DELETED_FILE, $user ) ) {
336  if ( $oimage->isDeleted( File::DELETED_RESTRICTED ) ) {
337  throw new PermissionsError( 'suppressrevision' );
338  } else {
339  throw new PermissionsError( 'deletedtext' );
340  }
341  }
342  if ( !$user->matchEditToken( $this->token, $archiveName ) ) {
343  $lang = $this->getLanguage();
344  $this->getOutput()->addWikiMsg( 'revdelete-show-file-confirm',
345  $this->targetObj->getText(),
346  $lang->userDate( $oimage->getTimestamp(), $user ),
347  $lang->userTime( $oimage->getTimestamp(), $user ) );
348  $this->getOutput()->addHTML(
349  Xml::openElement( 'form', [
350  'method' => 'POST',
351  'action' => $this->getPageTitle()->getLocalURL( [
352  'target' => $this->targetObj->getPrefixedDBkey(),
353  'file' => $archiveName,
354  'token' => $user->getEditToken( $archiveName ),
355  ] )
356  ]
357  ) .
358  Xml::submitButton( $this->msg( 'revdelete-show-file-submit' )->text() ) .
359  '</form>'
360  );
361 
362  return;
363  }
364  $this->getOutput()->disable();
365  # We mustn't allow the output to be CDN cached, otherwise
366  # if an admin previews a deleted image, and it's cached, then
367  # a user without appropriate permissions can toddle off and
368  # nab the image, and CDN will serve it
369  $this->getRequest()->response()->header( 'Expires: ' . gmdate( 'D, d M Y H:i:s', 0 ) . ' GMT' );
370  $this->getRequest()->response()->header(
371  'Cache-Control: no-cache, no-store, max-age=0, must-revalidate'
372  );
373  $this->getRequest()->response()->header( 'Pragma: no-cache' );
374 
375  $key = $oimage->getStorageKey();
376  $path = $repo->getZonePath( 'deleted' ) . '/' . $repo->getDeletedHashPath( $key ) . $key;
377  $repo->streamFileWithStatus( $path );
378  }
379 
384  protected function getList() {
385  if ( is_null( $this->revDelList ) ) {
386  $this->revDelList = RevisionDeleter::createList(
387  $this->typeName, $this->getContext(), $this->targetObj, $this->ids
388  );
389  }
390 
391  return $this->revDelList;
392  }
393 
398  protected function showForm() {
399  $userAllowed = true;
400 
401  // Messages: revdelete-selected-text, revdelete-selected-file, logdelete-selected
402  $out = $this->getOutput();
403  $out->wrapWikiMsg( "<strong>$1</strong>", [ $this->typeLabels['selected'],
404  $this->getLanguage()->formatNum( count( $this->ids ) ), $this->targetObj->getPrefixedText() ] );
405 
406  $this->addHelpLink( 'Help:RevisionDelete' );
407  $out->addHTML( "<ul>" );
408 
409  $numRevisions = 0;
410  // Live revisions...
411  $list = $this->getList();
412  for ( $list->reset(); $list->current(); $list->next() ) {
413  $item = $list->current();
414 
415  if ( !$item->canView() ) {
416  if ( !$this->submitClicked ) {
417  throw new PermissionsError( 'suppressrevision' );
418  }
419  $userAllowed = false;
420  }
421 
422  $numRevisions++;
423  $out->addHTML( $item->getHTML() );
424  }
425 
426  if ( !$numRevisions ) {
427  throw new ErrorPageError( 'revdelete-nooldid-title', 'revdelete-nooldid-text' );
428  }
429 
430  $out->addHTML( "</ul>" );
431  // Explanation text
432  $this->addUsageText();
433 
434  // Normal sysops can always see what they did, but can't always change it
435  if ( !$userAllowed ) {
436  return;
437  }
438 
439  // Show form if the user can submit
440  if ( $this->mIsAllowed ) {
441  $suppressAllowed = $this->permissionManager
442  ->userHasRight( $this->getUser(), 'suppressrevision' );
443  $out->addModules( [ 'mediawiki.special.revisionDelete' ] );
444  $out->addModuleStyles( [ 'mediawiki.special',
445  'mediawiki.interface.helpers.styles' ] );
446 
447  $dropDownReason = $this->msg( 'revdelete-reason-dropdown' )->inContentLanguage()->text();
448  // Add additional specific reasons for suppress
449  if ( $suppressAllowed ) {
450  $dropDownReason .= "\n" . $this->msg( 'revdelete-reason-dropdown-suppress' )
451  ->inContentLanguage()->text();
452  }
453 
454  $form = Xml::openElement( 'form', [ 'method' => 'post',
455  'action' => $this->getPageTitle()->getLocalURL( [ 'action' => 'submit' ] ),
456  'id' => 'mw-revdel-form-revisions' ] ) .
457  Xml::fieldset( $this->msg( 'revdelete-legend' )->text() ) .
458  $this->buildCheckBoxes() .
459  Xml::openElement( 'table' ) .
460  "<tr>\n" .
461  '<td class="mw-label">' .
462  Xml::label( $this->msg( 'revdelete-log' )->text(), 'wpRevDeleteReasonList' ) .
463  '</td>' .
464  '<td class="mw-input">' .
465  Xml::listDropDown( 'wpRevDeleteReasonList',
466  $dropDownReason,
467  $this->msg( 'revdelete-reasonotherlist' )->inContentLanguage()->text(),
468  $this->getRequest()->getText( 'wpRevDeleteReasonList', 'other' ), 'wpReasonDropDown'
469  ) .
470  '</td>' .
471  "</tr><tr>\n" .
472  '<td class="mw-label">' .
473  Xml::label( $this->msg( 'revdelete-otherreason' )->text(), 'wpReason' ) .
474  '</td>' .
475  '<td class="mw-input">' .
476  Xml::input( 'wpReason', 60, $this->otherReason, [
477  'id' => 'wpReason',
478  // HTML maxlength uses "UTF-16 code units", which means that characters outside BMP
479  // (e.g. emojis) count for two each. This limit is overridden in JS to instead count
480  // Unicode codepoints.
481  // "- 155" is to leave room for the 'wpRevDeleteReasonList' value.
482  'maxlength' => CommentStore::COMMENT_CHARACTER_LIMIT - 155,
483  ] ) .
484  '</td>' .
485  "</tr><tr>\n" .
486  '<td></td>' .
487  '<td class="mw-submit">' .
488  Xml::submitButton( $this->msg( 'revdelete-submit', $numRevisions )->text(),
489  [ 'name' => 'wpSubmit' ] ) .
490  '</td>' .
491  "</tr>\n" .
492  Xml::closeElement( 'table' ) .
493  Html::hidden( 'wpEditToken', $this->getUser()->getEditToken() ) .
494  Html::hidden( 'target', $this->targetObj->getPrefixedText() ) .
495  Html::hidden( 'type', $this->typeName ) .
496  Html::hidden( 'ids', implode( ',', $this->ids ) ) .
497  Xml::closeElement( 'fieldset' ) . "\n" .
498  Xml::closeElement( 'form' ) . "\n";
499  // Show link to edit the dropdown reasons
500  if ( $this->permissionManager->userHasRight( $this->getUser(), 'editinterface' ) ) {
501  $link = '';
502  $linkRenderer = $this->getLinkRenderer();
503  if ( $suppressAllowed ) {
504  $link .= $linkRenderer->makeKnownLink(
505  $this->msg( 'revdelete-reason-dropdown-suppress' )->inContentLanguage()->getTitle(),
506  $this->msg( 'revdelete-edit-reasonlist-suppress' )->text(),
507  [],
508  [ 'action' => 'edit' ]
509  );
510  $link .= $this->msg( 'pipe-separator' )->escaped();
511  }
512  $link .= $linkRenderer->makeKnownLink(
513  $this->msg( 'revdelete-reason-dropdown' )->inContentLanguage()->getTitle(),
514  $this->msg( 'revdelete-edit-reasonlist' )->text(),
515  [],
516  [ 'action' => 'edit' ]
517  );
518  $form .= Xml::tags( 'p', [ 'class' => 'mw-revdel-editreasons' ], $link ) . "\n";
519  }
520  } else {
521  $form = '';
522  }
523  $out->addHTML( $form );
524  }
525 
530  protected function addUsageText() {
531  // Messages: revdelete-text-text, revdelete-text-file, logdelete-text
532  $this->getOutput()->wrapWikiMsg(
533  "<strong>$1</strong>\n$2", $this->typeLabels['text'],
534  'revdelete-text-others'
535  );
536 
537  if ( $this->permissionManager->userHasRight( $this->getUser(), 'suppressrevision' ) ) {
538  $this->getOutput()->addWikiMsg( 'revdelete-suppress-text' );
539  }
540 
541  if ( $this->mIsAllowed ) {
542  $this->getOutput()->addWikiMsg( 'revdelete-confirm' );
543  }
544  }
545 
549  protected function buildCheckBoxes() {
550  $html = '<table>';
551  // If there is just one item, use checkboxes
552  $list = $this->getList();
553  if ( $list->length() == 1 ) {
554  $list->reset();
555  $bitfield = $list->current()->getBits(); // existing field
556 
557  if ( $this->submitClicked ) {
558  $bitfield = RevisionDeleter::extractBitfield( $this->extractBitParams(), $bitfield );
559  }
560 
561  foreach ( $this->checks as $item ) {
562  // Messages: revdelete-hide-text, revdelete-hide-image, revdelete-hide-name,
563  // revdelete-hide-comment, revdelete-hide-user, revdelete-hide-restricted
564  list( $message, $name, $field ) = $item;
565  $innerHTML = Xml::checkLabel(
566  $this->msg( $message )->text(),
567  $name,
568  $name,
569  $bitfield & $field
570  );
571 
572  if ( $field == RevisionRecord::DELETED_RESTRICTED ) {
573  $innerHTML = "<b>$innerHTML</b>";
574  }
575 
576  $line = Xml::tags( 'td', [ 'class' => 'mw-input' ], $innerHTML );
577  $html .= "<tr>$line</tr>\n";
578  }
579  } else {
580  // Otherwise, use tri-state radios
581  $html .= '<tr>';
582  $html .= '<th class="mw-revdel-checkbox">'
583  . $this->msg( 'revdelete-radio-same' )->escaped() . '</th>';
584  $html .= '<th class="mw-revdel-checkbox">'
585  . $this->msg( 'revdelete-radio-unset' )->escaped() . '</th>';
586  $html .= '<th class="mw-revdel-checkbox">'
587  . $this->msg( 'revdelete-radio-set' )->escaped() . '</th>';
588  $html .= "<th></th></tr>\n";
589  foreach ( $this->checks as $item ) {
590  // Messages: revdelete-hide-text, revdelete-hide-image, revdelete-hide-name,
591  // revdelete-hide-comment, revdelete-hide-user, revdelete-hide-restricted
592  list( $message, $name, $field ) = $item;
593  // If there are several items, use third state by default...
594  if ( $this->submitClicked ) {
595  $selected = $this->getRequest()->getInt( $name, 0 /* unchecked */ );
596  } else {
597  $selected = -1; // use existing field
598  }
599  $line = '<td class="mw-revdel-checkbox">' . Xml::radio( $name, -1, $selected == -1 ) . '</td>';
600  $line .= '<td class="mw-revdel-checkbox">' . Xml::radio( $name, 0, $selected == 0 ) . '</td>';
601  $line .= '<td class="mw-revdel-checkbox">' . Xml::radio( $name, 1, $selected == 1 ) . '</td>';
602  $label = $this->msg( $message )->escaped();
603  if ( $field == RevisionRecord::DELETED_RESTRICTED ) {
604  $label = "<b>$label</b>";
605  }
606  $line .= "<td>$label</td>";
607  $html .= "<tr>$line</tr>\n";
608  }
609  }
610 
611  $html .= '</table>';
612 
613  return $html;
614  }
615 
621  protected function submit() {
622  # Check edit token on submission
623  $token = $this->getRequest()->getVal( 'wpEditToken' );
624  if ( $this->submitClicked && !$this->getUser()->matchEditToken( $token ) ) {
625  $this->getOutput()->addWikiMsg( 'sessionfailure' );
626 
627  return false;
628  }
629  $bitParams = $this->extractBitParams();
630  // from dropdown
631  $listReason = $this->getRequest()->getText( 'wpRevDeleteReasonList', 'other' );
632  $comment = $listReason;
633  if ( $comment === 'other' ) {
634  $comment = $this->otherReason;
635  } elseif ( $this->otherReason !== '' ) {
636  // Entry from drop down menu + additional comment
637  $comment .= $this->msg( 'colon-separator' )->inContentLanguage()->text()
639  }
640  # Can the user set this field?
641  if ( $bitParams[RevisionRecord::DELETED_RESTRICTED] == 1
642  && !$this->permissionManager->userHasRight( $this->getUser(), 'suppressrevision' )
643  ) {
644  throw new PermissionsError( 'suppressrevision' );
645  }
646  # If the save went through, go to success message...
647  $status = $this->save( $bitParams, $comment );
648  if ( $status->isGood() ) {
649  $this->success();
650 
651  return true;
652  } else {
653  # ...otherwise, bounce back to form...
654  $this->failure( $status );
655  }
656 
657  return false;
658  }
659 
663  protected function success() {
664  // Messages: revdelete-success, logdelete-success
665  $this->getOutput()->setPageTitle( $this->msg( 'actioncomplete' ) );
666  $this->getOutput()->wrapWikiMsg(
667  "<div class=\"successbox\">\n$1\n</div>",
668  $this->typeLabels['success']
669  );
670  $this->wasSaved = true;
671  $this->revDelList->reloadFromMaster();
672  $this->showForm();
673  }
674 
679  protected function failure( $status ) {
680  // Messages: revdelete-failure, logdelete-failure
681  $this->getOutput()->setPageTitle( $this->msg( 'actionfailed' ) );
682  $this->getOutput()->wrapWikiTextAsInterface(
683  'errorbox',
684  $status->getWikiText( $this->typeLabels['failure'], false, $this->getLanguage() )
685  );
686  $this->showForm();
687  }
688 
694  protected function extractBitParams() {
695  $bitfield = [];
696  foreach ( $this->checks as $item ) {
697  list( /* message */, $name, $field ) = $item;
698  $val = $this->getRequest()->getInt( $name, 0 /* unchecked */ );
699  if ( $val < -1 || $val > 1 ) {
700  $val = -1; // -1 for existing value
701  }
702  $bitfield[$field] = $val;
703  }
704  if ( !isset( $bitfield[RevisionRecord::DELETED_RESTRICTED] ) ) {
705  $bitfield[RevisionRecord::DELETED_RESTRICTED] = 0;
706  }
707 
708  return $bitfield;
709  }
710 
717  protected function save( array $bitPars, $reason ) {
718  return $this->getList()->setVisibility(
719  [ 'value' => $bitPars, 'comment' => $reason ]
720  );
721  }
722 
723  protected function getGroupName() {
724  return 'pagetools';
725  }
726 }
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
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
const UI_LABELS
UI labels for each type.
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
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
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.
$line
Definition: mcc.php:119
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.
const __construct(PermissionManager $permissionManager)
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:317
submit()
UI entry point for form submission.