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