MediaWiki  1.28.1
SpecialRevisiondelete.php
Go to the documentation of this file.
1 <?php
32  protected $wasSaved = false;
33 
35  private $submitClicked;
36 
38  private $ids;
39 
41  private $archiveName;
42 
44  private $token;
45 
47  private $targetObj;
48 
50  private $typeName;
51 
53  private $checks;
54 
56  private $typeLabels;
57 
59  private $revDelList;
60 
62  private $mIsAllowed;
63 
65  private $otherReason;
66 
70  private static $UILabels = [
71  'revision' => [
72  'check-label' => 'revdelete-hide-text',
73  'success' => 'revdelete-success',
74  'failure' => 'revdelete-failure',
75  'text' => 'revdelete-text-text',
76  'selected'=> 'revdelete-selected-text',
77  ],
78  'archive' => [
79  'check-label' => 'revdelete-hide-text',
80  'success' => 'revdelete-success',
81  'failure' => 'revdelete-failure',
82  'text' => 'revdelete-text-text',
83  'selected'=> 'revdelete-selected-text',
84  ],
85  'oldimage' => [
86  'check-label' => 'revdelete-hide-image',
87  'success' => 'revdelete-success',
88  'failure' => 'revdelete-failure',
89  'text' => 'revdelete-text-file',
90  'selected'=> 'revdelete-selected-file',
91  ],
92  'filearchive' => [
93  'check-label' => 'revdelete-hide-image',
94  'success' => 'revdelete-success',
95  'failure' => 'revdelete-failure',
96  'text' => 'revdelete-text-file',
97  'selected'=> 'revdelete-selected-file',
98  ],
99  'logging' => [
100  'check-label' => 'revdelete-hide-name',
101  'success' => 'logdelete-success',
102  'failure' => 'logdelete-failure',
103  'text' => 'logdelete-text',
104  'selected' => 'logdelete-selected',
105  ],
106  ];
107 
108  public function __construct() {
109  parent::__construct( 'Revisiondelete', 'deleterevision' );
110  }
111 
112  public function doesWrites() {
113  return true;
114  }
115 
116  public function execute( $par ) {
117  $this->useTransactionalTimeLimit();
118 
119  $this->checkPermissions();
120  $this->checkReadOnly();
121 
122  $output = $this->getOutput();
123  $user = $this->getUser();
124 
125  // Check blocks
126  if ( $user->isBlocked() ) {
127  throw new UserBlockedError( $user->getBlock() );
128  }
129 
130  $this->setHeaders();
131  $this->outputHeader();
132  $request = $this->getRequest();
133  $this->submitClicked = $request->wasPosted() && $request->getBool( 'wpSubmit' );
134  # Handle our many different possible input types.
135  $ids = $request->getVal( 'ids' );
136  if ( !is_null( $ids ) ) {
137  # Allow CSV, for backwards compatibility, or a single ID for show/hide links
138  $this->ids = explode( ',', $ids );
139  } else {
140  # Array input
141  $this->ids = array_keys( $request->getArray( 'ids', [] ) );
142  }
143  // $this->ids = array_map( 'intval', $this->ids );
144  $this->ids = array_unique( array_filter( $this->ids ) );
145 
146  $this->typeName = $request->getVal( 'type' );
147  $this->targetObj = Title::newFromText( $request->getText( 'target' ) );
148 
149  # For reviewing deleted files...
150  $this->archiveName = $request->getVal( 'file' );
151  $this->token = $request->getVal( 'token' );
152  if ( $this->archiveName && $this->targetObj ) {
153  $this->tryShowFile( $this->archiveName );
154 
155  return;
156  }
157 
158  $this->typeName = RevisionDeleter::getCanonicalTypeName( $this->typeName );
159 
160  # No targets?
161  if ( !$this->typeName || count( $this->ids ) == 0 ) {
162  throw new ErrorPageError( 'revdelete-nooldid-title', 'revdelete-nooldid-text' );
163  }
164 
165  # Allow the list type to adjust the passed target
166  $this->targetObj = RevisionDeleter::suggestTarget(
167  $this->typeName,
168  $this->targetObj,
169  $this->ids
170  );
171 
172  # We need a target page!
173  if ( $this->targetObj === null ) {
174  $output->addWikiMsg( 'undelete-header' );
175 
176  return;
177  }
178 
179  $this->typeLabels = self::$UILabels[$this->typeName];
180  $list = $this->getList();
181  $list->reset();
182  $this->mIsAllowed = $user->isAllowed( RevisionDeleter::getRestriction( $this->typeName ) );
183  $canViewSuppressedOnly = $this->getUser()->isAllowed( 'viewsuppressed' ) &&
184  !$this->getUser()->isAllowed( 'suppressrevision' );
185  $pageIsSuppressed = $list->areAnySuppressed();
186  $this->mIsAllowed = $this->mIsAllowed && !( $canViewSuppressedOnly && $pageIsSuppressed );
187 
188  $this->otherReason = $request->getVal( 'wpReason' );
189  # Give a link to the logs/hist for this page
190  $this->showConvenienceLinks();
191 
192  # Initialise checkboxes
193  $this->checks = [
194  # Messages: revdelete-hide-text, revdelete-hide-image, revdelete-hide-name
195  [ $this->typeLabels['check-label'], 'wpHidePrimary',
196  RevisionDeleter::getRevdelConstant( $this->typeName )
197  ],
198  [ 'revdelete-hide-comment', 'wpHideComment', Revision::DELETED_COMMENT ],
199  [ 'revdelete-hide-user', 'wpHideUser', Revision::DELETED_USER ]
200  ];
201  if ( $user->isAllowed( 'suppressrevision' ) ) {
202  $this->checks[] = [ 'revdelete-hide-restricted',
203  'wpHideRestricted', Revision::DELETED_RESTRICTED ];
204  }
205 
206  # Either submit or create our form
207  if ( $this->mIsAllowed && $this->submitClicked ) {
208  $this->submit( $request );
209  } else {
210  $this->showForm();
211  }
212 
213  if ( $user->isAllowed( 'deletedhistory' ) ) {
214  $qc = $this->getLogQueryCond();
215  # Show relevant lines from the deletion log
216  $deleteLogPage = new LogPage( 'delete' );
217  $output->addHTML( "<h2>" . $deleteLogPage->getName()->escaped() . "</h2>\n" );
219  $output,
220  'delete',
221  $this->targetObj,
222  '', /* user */
223  [ 'lim' => 25, 'conds' => $qc, 'useMaster' => $this->wasSaved ]
224  );
225  }
226  # Show relevant lines from the suppression log
227  if ( $user->isAllowed( 'suppressionlog' ) ) {
228  $suppressLogPage = new LogPage( 'suppress' );
229  $output->addHTML( "<h2>" . $suppressLogPage->getName()->escaped() . "</h2>\n" );
231  $output,
232  'suppress',
233  $this->targetObj,
234  '',
235  [ 'lim' => 25, 'conds' => $qc, 'useMaster' => $this->wasSaved ]
236  );
237  }
238  }
239 
243  protected function showConvenienceLinks() {
244  # Give a link to the logs/hist for this page
245  if ( $this->targetObj ) {
246  // Also set header tabs to be for the target.
247  $this->getSkin()->setRelevantTitle( $this->targetObj );
248 
249  $links = [];
250  $links[] = Linker::linkKnown(
251  SpecialPage::getTitleFor( 'Log' ),
252  $this->msg( 'viewpagelogs' )->escaped(),
253  [],
254  [ 'page' => $this->targetObj->getPrefixedText() ]
255  );
256  if ( !$this->targetObj->isSpecialPage() ) {
257  # Give a link to the page history
258  $links[] = Linker::linkKnown(
259  $this->targetObj,
260  $this->msg( 'pagehist' )->escaped(),
261  [],
262  [ 'action' => 'history' ]
263  );
264  # Link to deleted edits
265  if ( $this->getUser()->isAllowed( 'undelete' ) ) {
266  $undelete = SpecialPage::getTitleFor( 'Undelete' );
267  $links[] = Linker::linkKnown(
268  $undelete,
269  $this->msg( 'deletedhist' )->escaped(),
270  [],
271  [ 'target' => $this->targetObj->getPrefixedDBkey() ]
272  );
273  }
274  }
275  # Logs themselves don't have histories or archived revisions
276  $this->getOutput()->addSubtitle( $this->getLanguage()->pipeList( $links ) );
277  }
278  }
279 
284  protected function getLogQueryCond() {
285  $conds = [];
286  // Revision delete logs for these item
287  $conds['log_type'] = [ 'delete', 'suppress' ];
288  $conds['log_action'] = $this->getList()->getLogAction();
289  $conds['ls_field'] = RevisionDeleter::getRelationType( $this->typeName );
290  $conds['ls_value'] = $this->ids;
291 
292  return $conds;
293  }
294 
302  protected function tryShowFile( $archiveName ) {
303  $repo = RepoGroup::singleton()->getLocalRepo();
304  $oimage = $repo->newFromArchiveName( $this->targetObj, $archiveName );
305  $oimage->load();
306  // Check if user is allowed to see this file
307  if ( !$oimage->exists() ) {
308  $this->getOutput()->addWikiMsg( 'revdelete-no-file' );
309 
310  return;
311  }
312  $user = $this->getUser();
313  if ( !$oimage->userCan( File::DELETED_FILE, $user ) ) {
314  if ( $oimage->isDeleted( File::DELETED_RESTRICTED ) ) {
315  throw new PermissionsError( 'suppressrevision' );
316  } else {
317  throw new PermissionsError( 'deletedtext' );
318  }
319  }
320  if ( !$user->matchEditToken( $this->token, $archiveName ) ) {
321  $lang = $this->getLanguage();
322  $this->getOutput()->addWikiMsg( 'revdelete-show-file-confirm',
323  $this->targetObj->getText(),
324  $lang->userDate( $oimage->getTimestamp(), $user ),
325  $lang->userTime( $oimage->getTimestamp(), $user ) );
326  $this->getOutput()->addHTML(
327  Xml::openElement( 'form', [
328  'method' => 'POST',
329  'action' => $this->getPageTitle()->getLocalURL( [
330  'target' => $this->targetObj->getPrefixedDBkey(),
331  'file' => $archiveName,
332  'token' => $user->getEditToken( $archiveName ),
333  ] )
334  ]
335  ) .
336  Xml::submitButton( $this->msg( 'revdelete-show-file-submit' )->text() ) .
337  '</form>'
338  );
339 
340  return;
341  }
342  $this->getOutput()->disable();
343  # We mustn't allow the output to be CDN cached, otherwise
344  # if an admin previews a deleted image, and it's cached, then
345  # a user without appropriate permissions can toddle off and
346  # nab the image, and CDN will serve it
347  $this->getRequest()->response()->header( 'Expires: ' . gmdate( 'D, d M Y H:i:s', 0 ) . ' GMT' );
348  $this->getRequest()->response()->header(
349  'Cache-Control: no-cache, no-store, max-age=0, must-revalidate'
350  );
351  $this->getRequest()->response()->header( 'Pragma: no-cache' );
352 
353  $key = $oimage->getStorageKey();
354  $path = $repo->getZonePath( 'deleted' ) . '/' . $repo->getDeletedHashPath( $key ) . $key;
355  $repo->streamFile( $path );
356  }
357 
362  protected function getList() {
363  if ( is_null( $this->revDelList ) ) {
364  $this->revDelList = RevisionDeleter::createList(
365  $this->typeName, $this->getContext(), $this->targetObj, $this->ids
366  );
367  }
368 
369  return $this->revDelList;
370  }
371 
376  protected function showForm() {
377  $userAllowed = true;
378 
379  // Messages: revdelete-selected-text, revdelete-selected-file, logdelete-selected
380  $out = $this->getOutput();
381  $out->wrapWikiMsg( "<strong>$1</strong>", [ $this->typeLabels['selected'],
382  $this->getLanguage()->formatNum( count( $this->ids ) ), $this->targetObj->getPrefixedText() ] );
383 
384  $this->addHelpLink( 'Help:RevisionDelete' );
385  $out->addHTML( "<ul>" );
386 
387  $numRevisions = 0;
388  // Live revisions...
389  $list = $this->getList();
390  // @codingStandardsIgnoreStart Generic.CodeAnalysis.ForLoopWithTestFunctionCall.NotAllowed
391  for ( $list->reset(); $list->current(); $list->next() ) {
392  // @codingStandardsIgnoreEnd
393  $item = $list->current();
394 
395  if ( !$item->canView() ) {
396  if ( !$this->submitClicked ) {
397  throw new PermissionsError( 'suppressrevision' );
398  }
399  $userAllowed = false;
400  }
401 
402  $numRevisions++;
403  $out->addHTML( $item->getHTML() );
404  }
405 
406  if ( !$numRevisions ) {
407  throw new ErrorPageError( 'revdelete-nooldid-title', 'revdelete-nooldid-text' );
408  }
409 
410  $out->addHTML( "</ul>" );
411  // Explanation text
412  $this->addUsageText();
413 
414  // Normal sysops can always see what they did, but can't always change it
415  if ( !$userAllowed ) {
416  return;
417  }
418 
419  // Show form if the user can submit
420  if ( $this->mIsAllowed ) {
421  $out->addModuleStyles( 'mediawiki.special' );
422 
423  $form = Xml::openElement( 'form', [ 'method' => 'post',
424  'action' => $this->getPageTitle()->getLocalURL( [ 'action' => 'submit' ] ),
425  'id' => 'mw-revdel-form-revisions' ] ) .
426  Xml::fieldset( $this->msg( 'revdelete-legend' )->text() ) .
427  $this->buildCheckBoxes() .
428  Xml::openElement( 'table' ) .
429  "<tr>\n" .
430  '<td class="mw-label">' .
431  Xml::label( $this->msg( 'revdelete-log' )->text(), 'wpRevDeleteReasonList' ) .
432  '</td>' .
433  '<td class="mw-input">' .
434  Xml::listDropDown( 'wpRevDeleteReasonList',
435  $this->msg( 'revdelete-reason-dropdown' )->inContentLanguage()->text(),
436  $this->msg( 'revdelete-reasonotherlist' )->inContentLanguage()->text(),
437  $this->getRequest()->getText( 'wpRevDeleteReasonList', 'other' ), 'wpReasonDropDown'
438  ) .
439  '</td>' .
440  "</tr><tr>\n" .
441  '<td class="mw-label">' .
442  Xml::label( $this->msg( 'revdelete-otherreason' )->text(), 'wpReason' ) .
443  '</td>' .
444  '<td class="mw-input">' .
445  Xml::input(
446  'wpReason',
447  60,
448  $this->otherReason,
449  [ 'id' => 'wpReason', 'maxlength' => 100 ]
450  ) .
451  '</td>' .
452  "</tr><tr>\n" .
453  '<td></td>' .
454  '<td class="mw-submit">' .
455  Xml::submitButton( $this->msg( 'revdelete-submit', $numRevisions )->text(),
456  [ 'name' => 'wpSubmit' ] ) .
457  '</td>' .
458  "</tr>\n" .
459  Xml::closeElement( 'table' ) .
460  Html::hidden( 'wpEditToken', $this->getUser()->getEditToken() ) .
461  Html::hidden( 'target', $this->targetObj->getPrefixedText() ) .
462  Html::hidden( 'type', $this->typeName ) .
463  Html::hidden( 'ids', implode( ',', $this->ids ) ) .
464  Xml::closeElement( 'fieldset' ) . "\n" .
465  Xml::closeElement( 'form' ) . "\n";
466  // Show link to edit the dropdown reasons
467  if ( $this->getUser()->isAllowed( 'editinterface' ) ) {
469  $this->msg( 'revdelete-reason-dropdown' )->inContentLanguage()->getTitle(),
470  $this->msg( 'revdelete-edit-reasonlist' )->escaped(),
471  [],
472  [ 'action' => 'edit' ]
473  );
474  $form .= Xml::tags( 'p', [ 'class' => 'mw-revdel-editreasons' ], $link ) . "\n";
475  }
476  } else {
477  $form = '';
478  }
479  $out->addHTML( $form );
480  }
481 
486  protected function addUsageText() {
487  // Messages: revdelete-text-text, revdelete-text-file, logdelete-text
488  $this->getOutput()->wrapWikiMsg(
489  "<strong>$1</strong>\n$2", $this->typeLabels['text'],
490  'revdelete-text-others'
491  );
492 
493  if ( $this->getUser()->isAllowed( 'suppressrevision' ) ) {
494  $this->getOutput()->addWikiMsg( 'revdelete-suppress-text' );
495  }
496 
497  if ( $this->mIsAllowed ) {
498  $this->getOutput()->addWikiMsg( 'revdelete-confirm' );
499  }
500  }
501 
505  protected function buildCheckBoxes() {
506  $html = '<table>';
507  // If there is just one item, use checkboxes
508  $list = $this->getList();
509  if ( $list->length() == 1 ) {
510  $list->reset();
511  $bitfield = $list->current()->getBits(); // existing field
512 
513  if ( $this->submitClicked ) {
514  $bitfield = RevisionDeleter::extractBitfield( $this->extractBitParams(), $bitfield );
515  }
516 
517  foreach ( $this->checks as $item ) {
518  // Messages: revdelete-hide-text, revdelete-hide-image, revdelete-hide-name,
519  // revdelete-hide-comment, revdelete-hide-user, revdelete-hide-restricted
520  list( $message, $name, $field ) = $item;
521  $innerHTML = Xml::checkLabel(
522  $this->msg( $message )->text(),
523  $name,
524  $name,
525  $bitfield & $field
526  );
527 
528  if ( $field == Revision::DELETED_RESTRICTED ) {
529  $innerHTML = "<b>$innerHTML</b>";
530  }
531 
532  $line = Xml::tags( 'td', [ 'class' => 'mw-input' ], $innerHTML );
533  $html .= "<tr>$line</tr>\n";
534  }
535  } else {
536  // Otherwise, use tri-state radios
537  $html .= '<tr>';
538  $html .= '<th class="mw-revdel-checkbox">'
539  . $this->msg( 'revdelete-radio-same' )->escaped() . '</th>';
540  $html .= '<th class="mw-revdel-checkbox">'
541  . $this->msg( 'revdelete-radio-unset' )->escaped() . '</th>';
542  $html .= '<th class="mw-revdel-checkbox">'
543  . $this->msg( 'revdelete-radio-set' )->escaped() . '</th>';
544  $html .= "<th></th></tr>\n";
545  foreach ( $this->checks as $item ) {
546  // Messages: revdelete-hide-text, revdelete-hide-image, revdelete-hide-name,
547  // revdelete-hide-comment, revdelete-hide-user, revdelete-hide-restricted
548  list( $message, $name, $field ) = $item;
549  // If there are several items, use third state by default...
550  if ( $this->submitClicked ) {
551  $selected = $this->getRequest()->getInt( $name, 0 /* unchecked */ );
552  } else {
553  $selected = -1; // use existing field
554  }
555  $line = '<td class="mw-revdel-checkbox">' . Xml::radio( $name, -1, $selected == -1 ) . '</td>';
556  $line .= '<td class="mw-revdel-checkbox">' . Xml::radio( $name, 0, $selected == 0 ) . '</td>';
557  $line .= '<td class="mw-revdel-checkbox">' . Xml::radio( $name, 1, $selected == 1 ) . '</td>';
558  $label = $this->msg( $message )->escaped();
559  if ( $field == Revision::DELETED_RESTRICTED ) {
560  $label = "<b>$label</b>";
561  }
562  $line .= "<td>$label</td>";
563  $html .= "<tr>$line</tr>\n";
564  }
565  }
566 
567  $html .= '</table>';
568 
569  return $html;
570  }
571 
577  protected function submit() {
578  # Check edit token on submission
579  $token = $this->getRequest()->getVal( 'wpEditToken' );
580  if ( $this->submitClicked && !$this->getUser()->matchEditToken( $token ) ) {
581  $this->getOutput()->addWikiMsg( 'sessionfailure' );
582 
583  return false;
584  }
585  $bitParams = $this->extractBitParams();
586  // from dropdown
587  $listReason = $this->getRequest()->getText( 'wpRevDeleteReasonList', 'other' );
588  $comment = $listReason;
589  if ( $comment === 'other' ) {
591  } elseif ( $this->otherReason !== '' ) {
592  // Entry from drop down menu + additional comment
593  $comment .= $this->msg( 'colon-separator' )->inContentLanguage()->text()
595  }
596  # Can the user set this field?
597  if ( $bitParams[Revision::DELETED_RESTRICTED] == 1
598  && !$this->getUser()->isAllowed( 'suppressrevision' )
599  ) {
600  throw new PermissionsError( 'suppressrevision' );
601  }
602  # If the save went through, go to success message...
603  $status = $this->save( $bitParams, $comment );
604  if ( $status->isGood() ) {
605  $this->success();
606 
607  return true;
608  } else {
609  # ...otherwise, bounce back to form...
610  $this->failure( $status );
611  }
612 
613  return false;
614  }
615 
619  protected function success() {
620  // Messages: revdelete-success, logdelete-success
621  $this->getOutput()->setPageTitle( $this->msg( 'actioncomplete' ) );
622  $this->getOutput()->wrapWikiMsg(
623  "<div class=\"successbox\">\n$1\n</div>",
624  $this->typeLabels['success']
625  );
626  $this->wasSaved = true;
627  $this->revDelList->reloadFromMaster();
628  $this->showForm();
629  }
630 
635  protected function failure( $status ) {
636  // Messages: revdelete-failure, logdelete-failure
637  $this->getOutput()->setPageTitle( $this->msg( 'actionfailed' ) );
638  $this->getOutput()->addWikiText( '<div class="errorbox">' .
639  $status->getWikiText( $this->typeLabels['failure'] ) .
640  '</div>'
641  );
642  $this->showForm();
643  }
644 
650  protected function extractBitParams() {
651  $bitfield = [];
652  foreach ( $this->checks as $item ) {
653  list( /* message */, $name, $field ) = $item;
654  $val = $this->getRequest()->getInt( $name, 0 /* unchecked */ );
655  if ( $val < -1 || $val > 1 ) {
656  $val = -1; // -1 for existing value
657  }
658  $bitfield[$field] = $val;
659  }
660  if ( !isset( $bitfield[Revision::DELETED_RESTRICTED] ) ) {
661  $bitfield[Revision::DELETED_RESTRICTED] = 0;
662  }
663 
664  return $bitfield;
665  }
666 
673  protected function save( array $bitPars, $reason ) {
674  return $this->getList()->setVisibility(
675  [ 'value' => $bitPars, 'comment' => $reason ]
676  );
677  }
678 
679  protected function getGroupName() {
680  return 'pagetools';
681  }
682 }
string $archiveName
Archive name, for reviewing deleted files.
showConvenienceLinks()
Show some useful links in the subtitle.
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return an< a > element with HTML attributes $attribs and contents $html will be returned If you return $ret will be returned and may include noclasses & $html
Definition: hooks.txt:1936
deferred txt A few of the database updates required by various functions here can be deferred until after the result page is displayed to the user For updating the view updating the linked to tables after a etc PHP does not yet have any way to tell the server to actually return and disconnect while still running these but it might have such a feature in the future We handle these by creating a deferred update object and putting those objects on a global list
Definition: deferred.txt:11
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that probably a stub it is not rendered in wiki pages or galleries in category pages allow injecting custom HTML after the section Any uses of the hook need to handle escaping see BaseTemplate::getToolbox and BaseTemplate::makeListItem for details on the format of individual items inside of this array or by returning and letting standard HTTP rendering take place modifiable or by returning false and taking over the output $out
Definition: hooks.txt:802
the array() calling protocol came about after MediaWiki 1.4rc1.
string $typeName
Deletion type, may be revision, archive, oldimage, filearchive, logging.
tryShowFile($archiveName)
Show a deleted file version requested by the visitor.
Shortcut to construct a special page which is unlisted by default.
bool $mIsAllowed
Whether user is allowed to perform the action.
static getRevdelConstant($typeName)
Get the revision deletion constant for the RevDel type.
getContext()
Gets the context this SpecialPage is executed in.
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:82
if(!isset($args[0])) $lang
static hidden($name, $value, array $attribs=[])
Convenience function to produce an input element with type=hidden.
Definition: Html.php:758
$comment
static $UILabels
UI labels for each type.
static suggestTarget($typeName, $target, array $ids)
Suggest a target for the revision deletion.
static input($name, $size=false, $value=false, $attribs=[])
Convenience function to build an HTML text input field.
Definition: Xml.php:275
msg()
Wrapper around wfMessage that sets the current context.
getOutput()
Get the OutputPage being used for this instance.
static newFromText($text, $defaultNamespace=NS_MAIN)
Create a new Title from text, such as what one would find in a link.
Definition: Title.php:262
Title $targetObj
Title object for target parameter.
static submitButton($value, $attribs=[])
Convenience function to build an HTML submit button When $wgUseMediaWikiUIEverywhere is true it will ...
Definition: Xml.php:460
addHelpLink($to, $overrideBaseUrl=false)
Adds help link with an icon via page indicators.
showForm()
Show a list of items that we will operate on, and show a form with checkboxes which will allow the us...
static label($label, $id, $attribs=[])
Convenience function to build an HTML form label.
Definition: Xml.php:359
static showLogExtract(&$out, $types=[], $page= '', $user= '', $param=[])
Show log extract.
const DELETED_FILE
Definition: File.php:52
outputHeader($summaryMessageKey= '')
Outputs a summary message on top of special pages Per default the message key is the canonical name o...
Class to simplify the use of log pages.
Definition: LogPage.php:32
usually copyright or history_copyright This message must be in HTML not wikitext & $link
Definition: hooks.txt:2889
static fieldset($legend=false, $content=false, $attribs=[])
Shortcut for creating fieldsets.
Definition: Xml.php:578
static closeElement($element)
Shortcut to close an XML element.
Definition: Xml.php:118
Special page allowing users with the appropriate permissions to view and hide revisions.
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.
getLogQueryCond()
Get the condition used for fetching log snippets.
static singleton()
Get a RepoGroup instance.
Definition: RepoGroup.php:59
array $typeLabels
UI Labels about the current type.
static openElement($element, $attribs=null)
This opens an XML element.
Definition: Xml.php:109
getTitle($subpage=false)
Get a self-referential title object.
getSkin()
Shortcut to get the skin being used for this instance.
static extractBitfield(array $bitPars, $oldfield)
Put together a rev_deleted bitfield.
setHeaders()
Sets headers - this should be called from the execute() method of all derived classes! ...
const DELETED_RESTRICTED
Definition: Revision.php:88
static linkKnown($target, $html=null, $customAttribs=[], $query=[], $options=[ 'known'])
Identical to link(), except $options defaults to 'known'.
Definition: Linker.php:255
design txt This is a brief overview of the new design More thorough and up to date information is available on the documentation wiki at etc Handles the details of getting and saving to the user table of the and dealing with sessions and cookies OutputPage Encapsulates the entire HTML page that will be sent in response to any server request It is used by calling its functions to add text
Definition: design.txt:12
static getRelationType($typeName)
Get DB field name for URL param...
Show an error when the user tries to do something whilst blocked.
array $checks
Array of checkbox specs (message, name, deletion bits)
failure($status)
Report that the submit operation failed.
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
Definition: distributors.txt:9
please add to it if you re going to add events to the MediaWiki code where normally authentication against an external auth plugin would be creating a local account $user
Definition: hooks.txt:242
static radio($name, $value, $checked=false, $attribs=[])
Convenience function to build an HTML radio button.
Definition: Xml.php:342
const DELETED_RESTRICTED
Definition: File.php:55
extractBitParams()
Put together an array that contains -1, 0, or the *_deleted const for each bit.
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist e g Watchlist removed from all revisions and log entries to which it was applied This gives extensions a chance to take it off their books as the deletion has already been partly carried out by this point or something similar the user will be unable to create the tag set and then return false from the hook function Ensure you consume the ChangeTagAfterDelete hook to carry out custom deletion actions as context called by AbstractContent::getParserOutput May be used to override the normal model specific rendering of page content as context as context the output can only depend on parameters provided to this hook not on global state indicating whether full HTML should be generated If generation of HTML may be but other information should still be present in the ParserOutput object & $output
Definition: hooks.txt:1046
string $token
Edit token for securing image views against XSS.
array $ids
Target ID list.
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
Definition: injection.txt:35
static tags($element, $attribs=null, $contents)
Same as Xml::element(), but does not escape contents.
Definition: Xml.php:131
const DELETED_USER
Definition: Revision.php:87
error also a ContextSource you ll probably need to make sure the header is varied on $request
Definition: hooks.txt:2573
useTransactionalTimeLimit()
Call wfTransactionalTimeLimit() if this request was POSTed.
getUser()
Shortcut to get the User executing this instance.
$line
Definition: cdb.php:59
addUsageText()
Show some introductory text.
Show an error when a user tries to do something they do not have the necessary permissions for...
getLanguage()
Shortcut to get user's language.
save(array $bitPars, $reason)
Do the write operations.
getList()
Get the list object for this request.
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist e g Watchlist removed from all revisions and log entries to which it was applied This gives extensions a chance to take it off their books as the deletion has already been partly carried out by this point or something similar the user will be unable to create the tag set $status
Definition: hooks.txt:1046
static checkLabel($label, $name, $id, $checked=false, $attribs=[])
Convenience function to build an HTML checkbox with a label.
Definition: Xml.php:420
static createList($typeName, IContextSource $context, Title $title, array $ids)
Instantiate the appropriate list class for a given list of IDs.
static getCanonicalTypeName($typeName)
Gets the canonical type name, if any.
checkPermissions()
Checks if userCanExecute, and if not throws a PermissionsError.
const DELETED_COMMENT
Definition: Revision.php:86
getRequest()
Get the WebRequest being used for this instance.
RevDelList $revDelList
RevDelList object, storing the list of items to be deleted/undeleted.
checkReadOnly()
If the wiki is currently in readonly mode, throws a ReadOnlyError.
static listDropDown($name= '', $list= '', $other= '', $selected= '', $class= '', $tabindex=null)
Build a drop-down box from a textual list.
Definition: Xml.php:508
static getRestriction($typeName)
Get the user right required for the RevDel type.
success()
Report that the submit operation succeeded.
getPageTitle($subpage=false)
Get a self-referential title object.
Allows to change the fields on the form that will be generated $name
Definition: hooks.txt:300
submit()
UI entry point for form submission.