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  # Show relevant lines from the deletion log
239  $deleteLogPage = new LogPage( 'delete' );
240  $output->addHTML( "<h2>" . $deleteLogPage->getName()->escaped() . "</h2>\n" );
242  $output,
243  'delete',
244  $this->targetObj,
245  '', /* user */
246  [ 'lim' => 25, 'conds' => $this->getLogQueryCond(), 'useMaster' => $this->wasSaved ]
247  );
248  }
249  # Show relevant lines from the suppression log
250  if ( $this->permissionManager->userHasRight( $user, 'suppressionlog' ) ) {
251  $suppressLogPage = new LogPage( 'suppress' );
252  $output->addHTML( "<h2>" . $suppressLogPage->getName()->escaped() . "</h2>\n" );
254  $output,
255  'suppress',
256  $this->targetObj,
257  '',
258  [ 'lim' => 25, 'conds' => $this->getLogQueryCond(), 'useMaster' => $this->wasSaved ]
259  );
260  }
261  }
262 
266  protected function showConvenienceLinks() {
267  $linkRenderer = $this->getLinkRenderer();
268  # Give a link to the logs/hist for this page
269  if ( $this->targetObj ) {
270  // Also set header tabs to be for the target.
271  $this->getSkin()->setRelevantTitle( $this->targetObj );
272 
273  $links = [];
274  $links[] = $linkRenderer->makeKnownLink(
275  SpecialPage::getTitleFor( 'Log' ),
276  $this->msg( 'viewpagelogs' )->text(),
277  [],
278  [ 'page' => $this->targetObj->getPrefixedText() ]
279  );
280  if ( !$this->targetObj->isSpecialPage() ) {
281  # Give a link to the page history
282  $links[] = $linkRenderer->makeKnownLink(
283  $this->targetObj,
284  $this->msg( 'pagehist' )->text(),
285  [],
286  [ 'action' => 'history' ]
287  );
288  # Link to deleted edits
289  if ( $this->permissionManager->userHasRight( $this->getUser(), 'undelete' ) ) {
290  $undelete = SpecialPage::getTitleFor( 'Undelete' );
291  $links[] = $linkRenderer->makeKnownLink(
292  $undelete,
293  $this->msg( 'deletedhist' )->text(),
294  [],
295  [ 'target' => $this->targetObj->getPrefixedDBkey() ]
296  );
297  }
298  }
299  # Logs themselves don't have histories or archived revisions
300  $this->getOutput()->addSubtitle( $this->getLanguage()->pipeList( $links ) );
301  }
302  }
303 
308  protected function getLogQueryCond() {
309  $conds = [];
310  // Revision delete logs for these item
311  $conds['log_type'] = [ 'delete', 'suppress' ];
312  $conds['log_action'] = $this->getList()->getLogAction();
313  $conds['ls_field'] = RevisionDeleter::getRelationType( $this->typeName );
314  // Convert IDs to strings, since ls_value is a text field. This avoids
315  // a fatal error in PostgreSQL: "operator does not exist: text = integer".
316  $conds['ls_value'] = array_map( 'strval', $this->ids );
317 
318  return $conds;
319  }
320 
328  protected function tryShowFile( $archiveName ) {
329  $repo = $this->repoGroup->getLocalRepo();
330  $oimage = $repo->newFromArchiveName( $this->targetObj, $archiveName );
331  $oimage->load();
332  // Check if user is allowed to see this file
333  if ( !$oimage->exists() ) {
334  $this->getOutput()->addWikiMsg( 'revdelete-no-file' );
335 
336  return;
337  }
338  $user = $this->getUser();
339  if ( !$oimage->userCan( File::DELETED_FILE, $user ) ) {
340  if ( $oimage->isDeleted( File::DELETED_RESTRICTED ) ) {
341  throw new PermissionsError( 'suppressrevision' );
342  } else {
343  throw new PermissionsError( 'deletedtext' );
344  }
345  }
346  if ( !$user->matchEditToken( $this->token, $archiveName ) ) {
347  $lang = $this->getLanguage();
348  $this->getOutput()->addWikiMsg( 'revdelete-show-file-confirm',
349  $this->targetObj->getText(),
350  $lang->userDate( $oimage->getTimestamp(), $user ),
351  $lang->userTime( $oimage->getTimestamp(), $user ) );
352  $this->getOutput()->addHTML(
353  Xml::openElement( 'form', [
354  'method' => 'POST',
355  'action' => $this->getPageTitle()->getLocalURL( [
356  'target' => $this->targetObj->getPrefixedDBkey(),
357  'file' => $archiveName,
358  'token' => $user->getEditToken( $archiveName ),
359  ] )
360  ]
361  ) .
362  Xml::submitButton( $this->msg( 'revdelete-show-file-submit' )->text() ) .
363  '</form>'
364  );
365 
366  return;
367  }
368  $this->getOutput()->disable();
369  # We mustn't allow the output to be CDN cached, otherwise
370  # if an admin previews a deleted image, and it's cached, then
371  # a user without appropriate permissions can toddle off and
372  # nab the image, and CDN will serve it
373  $this->getRequest()->response()->header( 'Expires: ' . gmdate( 'D, d M Y H:i:s', 0 ) . ' GMT' );
374  $this->getRequest()->response()->header(
375  'Cache-Control: no-cache, no-store, max-age=0, must-revalidate'
376  );
377  $this->getRequest()->response()->header( 'Pragma: no-cache' );
378 
379  $key = $oimage->getStorageKey();
380  $path = $repo->getZonePath( 'deleted' ) . '/' . $repo->getDeletedHashPath( $key ) . $key;
381  $repo->streamFileWithStatus( $path );
382  }
383 
388  protected function getList() {
389  if ( $this->revDelList === null ) {
390  $this->revDelList = RevisionDeleter::createList(
391  $this->typeName, $this->getContext(), $this->targetObj, $this->ids
392  );
393  }
394 
395  return $this->revDelList;
396  }
397 
402  protected function showForm() {
403  $userAllowed = true;
404 
405  // Messages: revdelete-selected-text, revdelete-selected-file, logdelete-selected
406  $out = $this->getOutput();
407  $out->wrapWikiMsg( "<strong>$1</strong>", [ $this->typeLabels['selected'],
408  $this->getLanguage()->formatNum( count( $this->ids ) ), $this->targetObj->getPrefixedText() ] );
409 
410  $this->addHelpLink( 'Help:RevisionDelete' );
411  $out->addHTML( "<ul>" );
412 
413  $numRevisions = 0;
414  // Live revisions...
415  $list = $this->getList();
416  for ( $list->reset(); $list->current(); $list->next() ) {
417  $item = $list->current();
418 
419  if ( !$item->canView() ) {
420  if ( !$this->submitClicked ) {
421  throw new PermissionsError( 'suppressrevision' );
422  }
423  $userAllowed = false;
424  }
425 
426  $numRevisions++;
427  $out->addHTML( $item->getHTML() );
428  }
429 
430  if ( !$numRevisions ) {
431  throw new ErrorPageError( 'revdelete-nooldid-title', 'revdelete-nooldid-text' );
432  }
433 
434  $out->addHTML( "</ul>" );
435  // Explanation text
436  $this->addUsageText();
437 
438  // Normal sysops can always see what they did, but can't always change it
439  if ( !$userAllowed ) {
440  return;
441  }
442 
443  // Show form if the user can submit
444  if ( $this->mIsAllowed ) {
445  $suppressAllowed = $this->permissionManager
446  ->userHasRight( $this->getUser(), 'suppressrevision' );
447  $out->addModules( [ 'mediawiki.special.revisionDelete' ] );
448  $out->addModuleStyles( [ 'mediawiki.special',
449  'mediawiki.interface.helpers.styles' ] );
450 
451  $dropDownReason = $this->msg( 'revdelete-reason-dropdown' )->inContentLanguage()->text();
452  // Add additional specific reasons for suppress
453  if ( $suppressAllowed ) {
454  $dropDownReason .= "\n" . $this->msg( 'revdelete-reason-dropdown-suppress' )
455  ->inContentLanguage()->text();
456  }
457 
458  $form = Xml::openElement( 'form', [ 'method' => 'post',
459  'action' => $this->getPageTitle()->getLocalURL( [ 'action' => 'submit' ] ),
460  'id' => 'mw-revdel-form-revisions' ] ) .
461  Xml::fieldset( $this->msg( 'revdelete-legend' )->text() ) .
462  $this->buildCheckBoxes() .
463  Xml::openElement( 'table' ) .
464  "<tr>\n" .
465  '<td class="mw-label">' .
466  Xml::label( $this->msg( 'revdelete-log' )->text(), 'wpRevDeleteReasonList' ) .
467  '</td>' .
468  '<td class="mw-input">' .
469  Xml::listDropDown( 'wpRevDeleteReasonList',
470  $dropDownReason,
471  $this->msg( 'revdelete-reasonotherlist' )->inContentLanguage()->text(),
472  $this->getRequest()->getText( 'wpRevDeleteReasonList', 'other' ), 'wpReasonDropDown'
473  ) .
474  '</td>' .
475  "</tr><tr>\n" .
476  '<td class="mw-label">' .
477  Xml::label( $this->msg( 'revdelete-otherreason' )->text(), 'wpReason' ) .
478  '</td>' .
479  '<td class="mw-input">' .
480  Xml::input( 'wpReason', 60, $this->otherReason, [
481  'id' => 'wpReason',
482  // HTML maxlength uses "UTF-16 code units", which means that characters outside BMP
483  // (e.g. emojis) count for two each. This limit is overridden in JS to instead count
484  // Unicode codepoints.
485  // "- 155" is to leave room for the 'wpRevDeleteReasonList' value.
486  'maxlength' => CommentStore::COMMENT_CHARACTER_LIMIT - 155,
487  ] ) .
488  '</td>' .
489  "</tr><tr>\n" .
490  '<td></td>' .
491  '<td class="mw-submit">' .
492  Xml::submitButton( $this->msg( 'revdelete-submit', $numRevisions )->text(),
493  [ 'name' => 'wpSubmit' ] ) .
494  '</td>' .
495  "</tr>\n" .
496  Xml::closeElement( 'table' ) .
497  Html::hidden( 'wpEditToken', $this->getUser()->getEditToken() ) .
498  Html::hidden( 'target', $this->targetObj->getPrefixedText() ) .
499  Html::hidden( 'type', $this->typeName ) .
500  Html::hidden( 'ids', implode( ',', $this->ids ) ) .
501  Xml::closeElement( 'fieldset' ) . "\n" .
502  Xml::closeElement( 'form' ) . "\n";
503  // Show link to edit the dropdown reasons
504  if ( $this->permissionManager->userHasRight( $this->getUser(), 'editinterface' ) ) {
505  $link = '';
506  $linkRenderer = $this->getLinkRenderer();
507  if ( $suppressAllowed ) {
508  $link .= $linkRenderer->makeKnownLink(
509  $this->msg( 'revdelete-reason-dropdown-suppress' )->inContentLanguage()->getTitle(),
510  $this->msg( 'revdelete-edit-reasonlist-suppress' )->text(),
511  [],
512  [ 'action' => 'edit' ]
513  );
514  $link .= $this->msg( 'pipe-separator' )->escaped();
515  }
516  $link .= $linkRenderer->makeKnownLink(
517  $this->msg( 'revdelete-reason-dropdown' )->inContentLanguage()->getTitle(),
518  $this->msg( 'revdelete-edit-reasonlist' )->text(),
519  [],
520  [ 'action' => 'edit' ]
521  );
522  $form .= Xml::tags( 'p', [ 'class' => 'mw-revdel-editreasons' ], $link ) . "\n";
523  }
524  } else {
525  $form = '';
526  }
527  $out->addHTML( $form );
528  }
529 
534  protected function addUsageText() {
535  // Messages: revdelete-text-text, revdelete-text-file, logdelete-text
536  $this->getOutput()->wrapWikiMsg(
537  "<strong>$1</strong>\n$2", $this->typeLabels['text'],
538  'revdelete-text-others'
539  );
540 
541  if ( $this->permissionManager->userHasRight( $this->getUser(), 'suppressrevision' ) ) {
542  $this->getOutput()->addWikiMsg( 'revdelete-suppress-text' );
543  }
544 
545  if ( $this->mIsAllowed ) {
546  $this->getOutput()->addWikiMsg( 'revdelete-confirm' );
547  }
548  }
549 
553  protected function buildCheckBoxes() {
554  $html = '<table>';
555  // If there is just one item, use checkboxes
556  $list = $this->getList();
557  if ( $list->length() == 1 ) {
558  $list->reset();
559  $bitfield = $list->current()->getBits(); // existing field
560 
561  if ( $this->submitClicked ) {
562  $bitfield = RevisionDeleter::extractBitfield( $this->extractBitParams(), $bitfield );
563  }
564 
565  foreach ( $this->checks as $item ) {
566  // Messages: revdelete-hide-text, revdelete-hide-image, revdelete-hide-name,
567  // revdelete-hide-comment, revdelete-hide-user, revdelete-hide-restricted
568  list( $message, $name, $field ) = $item;
569  $innerHTML = Xml::checkLabel(
570  $this->msg( $message )->text(),
571  $name,
572  $name,
573  $bitfield & $field
574  );
575 
576  if ( $field == RevisionRecord::DELETED_RESTRICTED ) {
577  $innerHTML = "<b>$innerHTML</b>";
578  }
579 
580  $line = Xml::tags( 'td', [ 'class' => 'mw-input' ], $innerHTML );
581  $html .= "<tr>$line</tr>\n";
582  }
583  } else {
584  // Otherwise, use tri-state radios
585  $html .= '<tr>';
586  $html .= '<th class="mw-revdel-checkbox">'
587  . $this->msg( 'revdelete-radio-same' )->escaped() . '</th>';
588  $html .= '<th class="mw-revdel-checkbox">'
589  . $this->msg( 'revdelete-radio-unset' )->escaped() . '</th>';
590  $html .= '<th class="mw-revdel-checkbox">'
591  . $this->msg( 'revdelete-radio-set' )->escaped() . '</th>';
592  $html .= "<th></th></tr>\n";
593  foreach ( $this->checks as $item ) {
594  // Messages: revdelete-hide-text, revdelete-hide-image, revdelete-hide-name,
595  // revdelete-hide-comment, revdelete-hide-user, revdelete-hide-restricted
596  list( $message, $name, $field ) = $item;
597  // If there are several items, use third state by default...
598  if ( $this->submitClicked ) {
599  $selected = $this->getRequest()->getInt( $name, 0 /* unchecked */ );
600  } else {
601  $selected = -1; // use existing field
602  }
603  $line = '<td class="mw-revdel-checkbox">' . Xml::radio( $name, -1, $selected == -1 ) . '</td>';
604  $line .= '<td class="mw-revdel-checkbox">' . Xml::radio( $name, 0, $selected == 0 ) . '</td>';
605  $line .= '<td class="mw-revdel-checkbox">' . Xml::radio( $name, 1, $selected == 1 ) . '</td>';
606  $label = $this->msg( $message )->escaped();
607  if ( $field == RevisionRecord::DELETED_RESTRICTED ) {
608  $label = "<b>$label</b>";
609  }
610  $line .= "<td>$label</td>";
611  $html .= "<tr>$line</tr>\n";
612  }
613  }
614 
615  $html .= '</table>';
616 
617  return $html;
618  }
619 
625  protected function submit() {
626  # Check edit token on submission
627  $token = $this->getRequest()->getVal( 'wpEditToken' );
628  if ( $this->submitClicked && !$this->getUser()->matchEditToken( $token ) ) {
629  $this->getOutput()->addWikiMsg( 'sessionfailure' );
630 
631  return false;
632  }
633  $bitParams = $this->extractBitParams();
634  // from dropdown
635  $listReason = $this->getRequest()->getText( 'wpRevDeleteReasonList', 'other' );
636  $comment = $listReason;
637  if ( $comment === 'other' ) {
638  $comment = $this->otherReason;
639  } elseif ( $this->otherReason !== '' ) {
640  // Entry from drop down menu + additional comment
641  $comment .= $this->msg( 'colon-separator' )->inContentLanguage()->text()
643  }
644  # Can the user set this field?
645  if ( $bitParams[RevisionRecord::DELETED_RESTRICTED] == 1
646  && !$this->permissionManager->userHasRight( $this->getUser(), 'suppressrevision' )
647  ) {
648  throw new PermissionsError( 'suppressrevision' );
649  }
650  # If the save went through, go to success message...
651  $status = $this->save( $bitParams, $comment );
652  if ( $status->isGood() ) {
653  $this->success();
654 
655  return true;
656  } else {
657  # ...otherwise, bounce back to form...
658  $this->failure( $status );
659  }
660 
661  return false;
662  }
663 
667  protected function success() {
668  // Messages: revdelete-success, logdelete-success
669  $this->getOutput()->setPageTitle( $this->msg( 'actioncomplete' ) );
670  $this->getOutput()->wrapWikiMsg(
671  "<div class=\"successbox\">\n$1\n</div>",
672  $this->typeLabels['success']
673  );
674  $this->wasSaved = true;
675  $this->revDelList->reloadFromMaster();
676  $this->showForm();
677  }
678 
683  protected function failure( $status ) {
684  // Messages: revdelete-failure, logdelete-failure
685  $this->getOutput()->setPageTitle( $this->msg( 'actionfailed' ) );
686  $this->getOutput()->wrapWikiTextAsInterface(
687  'errorbox',
688  $status->getWikiText( $this->typeLabels['failure'], false, $this->getLanguage() )
689  );
690  $this->showForm();
691  }
692 
698  protected function extractBitParams() {
699  $bitfield = [];
700  foreach ( $this->checks as $item ) {
701  list( /* message */, $name, $field ) = $item;
702  $val = $this->getRequest()->getInt( $name, 0 /* unchecked */ );
703  if ( $val < -1 || $val > 1 ) {
704  $val = -1; // -1 for existing value
705  }
706  $bitfield[$field] = $val;
707  }
708  if ( !isset( $bitfield[RevisionRecord::DELETED_RESTRICTED] ) ) {
709  $bitfield[RevisionRecord::DELETED_RESTRICTED] = 0;
710  }
711 
712  return $bitfield;
713  }
714 
721  protected function save( array $bitPars, $reason ) {
722  return $this->getList()->setVisibility(
723  [ 'value' => $bitPars, 'comment' => $reason ]
724  );
725  }
726 
727  protected function getGroupName() {
728  return 'pagetools';
729  }
730 }
SpecialPage\getPageTitle
getPageTitle( $subpage=false)
Get a self-referential title object.
Definition: SpecialPage.php:697
SpecialPage\msg
msg( $key,... $params)
Wrapper around wfMessage that sets the current context.
Definition: SpecialPage.php:828
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:328
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:31
SpecialPage\getOutput
getOutput()
Get the OutputPage being used for this instance.
Definition: SpecialPage.php:744
File\DELETED_RESTRICTED
const DELETED_RESTRICTED
Definition: File.php:70
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:31
Xml\label
static label( $label, $id, $attribs=[])
Convenience function to build an HTML form label.
Definition: Xml.php:362
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:345
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:343
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:92
SpecialPage\getSkin
getSkin()
Shortcut to get the skin being used for this instance.
Definition: SpecialPage.php:764
SpecialPage\useTransactionalTimeLimit
useTransactionalTimeLimit()
Call wfTransactionalTimeLimit() if this request was POSTed.
Definition: SpecialPage.php:935
PermissionsError
Show an error when a user tries to do something they do not have the necessary permissions for.
Definition: PermissionsError.php:31
SpecialPage\getLanguage
getLanguage()
Shortcut to get user's language.
Definition: SpecialPage.php:774
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:388
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:266
SpecialRevisionDelete\save
save(array $bitPars, $reason)
Do the write operations.
Definition: SpecialRevisionDelete.php:721
Xml\fieldset
static fieldset( $legend=false, $content=false, $attribs=[])
Shortcut for creating fieldsets.
Definition: Xml.php:616
SpecialRevisionDelete\getLogQueryCond
getLogQueryCond()
Get the condition used for fetching log snippets.
Definition: SpecialRevisionDelete.php:308
SpecialRevisionDelete\getGroupName
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
Definition: SpecialRevisionDelete.php:727
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:864
SpecialRevisionDelete\failure
failure( $status)
Report that the submit operation failed.
Definition: SpecialRevisionDelete.php:683
LogPage
Class to simplify the use of log pages.
Definition: LogPage.php:37
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:571
SpecialPage\getUser
getUser()
Shortcut to get the User executing this instance.
Definition: SpecialPage.php:754
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:609
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:698
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:717
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:402
SpecialRevisionDelete\doesWrites
doesWrites()
Indicates whether this special page may perform database writes.
Definition: SpecialRevisionDelete.php:130
Html\hidden
static hidden( $name, $value, array $attribs=[])
Convenience function to produce an input element with type=hidden.
Definition: Html.php:802
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:49
SpecialRevisionDelete\success
success()
Report that the submit operation succeeded.
Definition: SpecialRevisionDelete.php:667
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:328
SpecialPage\getRequest
getRequest()
Get the WebRequest being used for this instance.
Definition: SpecialPage.php:734
SpecialRevisionDelete\addUsageText
addUsageText()
Show some introductory text.
Definition: SpecialRevisionDelete.php:534
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:48
SpecialPage\getLinkRenderer
getLinkRenderer()
Definition: SpecialPage.php:945
Title
Represents a title within MediaWiki.
Definition: Title.php:41
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:512
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:81
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:67
Xml\input
static input( $name, $size=false, $value=false, $attribs=[])
Convenience function to build an HTML text input field.
Definition: Xml.php:278
SpecialPage\checkReadOnly
checkReadOnly()
If the wiki is currently in readonly mode, throws a ReadOnlyError.
Definition: SpecialPage.php:356
SpecialPage\$linkRenderer
MediaWiki Linker LinkRenderer null $linkRenderer
Definition: SpecialPage.php:71
SpecialRevisionDelete\buildCheckBoxes
buildCheckBoxes()
Definition: SpecialRevisionDelete.php:553
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:30
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:625
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:662
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:463
Xml\checkLabel
static checkLabel( $label, $name, $id, $checked=false, $attribs=[])
Convenience function to build an HTML checkbox with a label.
Definition: Xml.php:423