MediaWiki  1.32.0
McrUndoAction.php
Go to the documentation of this file.
1 <?php
12 
29 class McrUndoAction extends FormAction {
30 
31  protected $undo = 0, $undoafter = 0, $cur = 0;
32 
34  protected $curRev = null;
35 
36  public function getName() {
37  return 'mcrundo';
38  }
39 
40  public function getDescription() {
41  return '';
42  }
43 
44  public function show() {
45  // Send a cookie so anons get talk message notifications
46  // (copied from SubmitAction)
48 
49  // Some stuff copied from EditAction
51 
52  $out = $this->getOutput();
53  $out->setRobotPolicy( 'noindex,nofollow' );
54  if ( $this->getContext()->getConfig()->get( 'UseMediaWikiUIEverywhere' ) ) {
55  $out->addModuleStyles( [
56  'mediawiki.ui.input',
57  'mediawiki.ui.checkbox',
58  ] );
59  }
60 
61  // IP warning headers copied from EditPage
62  // (should more be copied?)
63  if ( wfReadOnly() ) {
64  $out->wrapWikiMsg(
65  "<div id=\"mw-read-only-warning\">\n$1\n</div>",
66  [ 'readonlywarning', wfReadOnlyReason() ]
67  );
68  } elseif ( $this->context->getUser()->isAnon() ) {
69  if ( !$this->getRequest()->getCheck( 'wpPreview' ) ) {
70  $out->wrapWikiMsg(
71  "<div id='mw-anon-edit-warning' class='warningbox'>\n$1\n</div>",
72  [ 'anoneditwarning',
73  // Log-in link
74  SpecialPage::getTitleFor( 'Userlogin' )->getFullURL( [
75  'returnto' => $this->getTitle()->getPrefixedDBkey()
76  ] ),
77  // Sign-up link
78  SpecialPage::getTitleFor( 'CreateAccount' )->getFullURL( [
79  'returnto' => $this->getTitle()->getPrefixedDBkey()
80  ] )
81  ]
82  );
83  } else {
84  $out->wrapWikiMsg( "<div id=\"mw-anon-preview-warning\" class=\"warningbox\">\n$1</div>",
85  'anonpreviewwarning'
86  );
87  }
88  }
89 
90  parent::show();
91  }
92 
93  protected function initFromParameters() {
94  $this->undoafter = $this->getRequest()->getInt( 'undoafter' );
95  $this->undo = $this->getRequest()->getInt( 'undo' );
96 
97  if ( $this->undo == 0 || $this->undoafter == 0 ) {
98  throw new ErrorPageError( 'mcrundofailed', 'mcrundo-missingparam' );
99  }
100 
101  $curRev = $this->page->getRevision();
102  if ( !$curRev ) {
103  throw new ErrorPageError( 'mcrundofailed', 'nopagetext' );
104  }
105  $this->curRev = $curRev->getRevisionRecord();
106  $this->cur = $this->getRequest()->getInt( 'cur', $this->curRev->getId() );
107  }
108 
109  protected function checkCanExecute( User $user ) {
110  parent::checkCanExecute( $user );
111 
112  $this->initFromParameters();
113 
114  $revisionLookup = MediaWikiServices::getInstance()->getRevisionLookup();
115 
116  $undoRev = $revisionLookup->getRevisionById( $this->undo );
117  $oldRev = $revisionLookup->getRevisionById( $this->undoafter );
118 
119  if ( $undoRev === null || $oldRev === null ||
120  $undoRev->isDeleted( RevisionRecord::DELETED_TEXT ) ||
121  $oldRev->isDeleted( RevisionRecord::DELETED_TEXT )
122  ) {
123  throw new ErrorPageError( 'mcrundofailed', 'undo-norev' );
124  }
125 
126  return true;
127  }
128 
132  private function getNewRevision() {
133  $revisionLookup = MediaWikiServices::getInstance()->getRevisionLookup();
134 
135  $undoRev = $revisionLookup->getRevisionById( $this->undo );
136  $oldRev = $revisionLookup->getRevisionById( $this->undoafter );
138 
139  $isLatest = $curRev->getId() === $undoRev->getId();
140 
141  if ( $undoRev === null || $oldRev === null ||
142  $undoRev->isDeleted( RevisionRecord::DELETED_TEXT ) ||
143  $oldRev->isDeleted( RevisionRecord::DELETED_TEXT )
144  ) {
145  throw new ErrorPageError( 'mcrundofailed', 'undo-norev' );
146  }
147 
148  if ( $isLatest ) {
149  // Short cut! Undoing the current revision means we just restore the old.
150  return MutableRevisionRecord::newFromParentRevision( $oldRev );
151  }
152 
153  $newRev = MutableRevisionRecord::newFromParentRevision( $curRev );
154 
155  // Figure out the roles that need merging by first collecting all roles
156  // and then removing the ones that don't.
157  $rolesToMerge = array_unique( array_merge(
158  $oldRev->getSlotRoles(),
159  $undoRev->getSlotRoles(),
160  $curRev->getSlotRoles()
161  ) );
162 
163  // Any roles with the same content in $oldRev and $undoRev can be
164  // inherited because undo won't change them.
165  $rolesToMerge = array_intersect(
166  $rolesToMerge, $oldRev->getSlots()->getRolesWithDifferentContent( $undoRev->getSlots() )
167  );
168  if ( !$rolesToMerge ) {
169  throw new ErrorPageError( 'mcrundofailed', 'undo-nochange' );
170  }
171 
172  // Any roles with the same content in $oldRev and $curRev were already reverted
173  // and so can be inherited.
174  $rolesToMerge = array_intersect(
175  $rolesToMerge, $oldRev->getSlots()->getRolesWithDifferentContent( $curRev->getSlots() )
176  );
177  if ( !$rolesToMerge ) {
178  throw new ErrorPageError( 'mcrundofailed', 'undo-nochange' );
179  }
180 
181  // Any roles with the same content in $undoRev and $curRev weren't
182  // changed since and so can be reverted to $oldRev.
183  $diffRoles = array_intersect(
184  $rolesToMerge, $undoRev->getSlots()->getRolesWithDifferentContent( $curRev->getSlots() )
185  );
186  foreach ( array_diff( $rolesToMerge, $diffRoles ) as $role ) {
187  if ( $oldRev->hasSlot( $role ) ) {
188  $newRev->inheritSlot( $oldRev->getSlot( $role, RevisionRecord::RAW ) );
189  } else {
190  $newRev->removeSlot( $role );
191  }
192  }
193  $rolesToMerge = $diffRoles;
194 
195  // Any slot additions or removals not handled by the above checks can't be undone.
196  // There will be only one of the three revisions missing the slot:
197  // - !old means it was added in the undone revisions and modified after.
198  // Should it be removed entirely for the undo, or should the modified version be kept?
199  // - !undo means it was removed in the undone revisions and then readded with different content.
200  // Which content is should be kept, the old or the new?
201  // - !cur means it was changed in the undone revisions and then deleted after.
202  // Did someone delete vandalized content instead of undoing (meaning we should ideally restore
203  // it), or should it stay gone?
204  foreach ( $rolesToMerge as $role ) {
205  if ( !$oldRev->hasSlot( $role ) || !$undoRev->hasSlot( $role ) || !$curRev->hasSlot( $role ) ) {
206  throw new ErrorPageError( 'mcrundofailed', 'undo-failure' );
207  }
208  }
209 
210  // Try to merge anything that's left.
211  foreach ( $rolesToMerge as $role ) {
212  $oldContent = $oldRev->getSlot( $role, RevisionRecord::RAW )->getContent();
213  $undoContent = $undoRev->getSlot( $role, RevisionRecord::RAW )->getContent();
214  $curContent = $curRev->getSlot( $role, RevisionRecord::RAW )->getContent();
215  $newContent = $undoContent->getContentHandler()
216  ->getUndoContent( $curContent, $undoContent, $oldContent, $isLatest );
217  if ( !$newContent ) {
218  throw new ErrorPageError( 'mcrundofailed', 'undo-failure' );
219  }
220  $newRev->setSlot( SlotRecord::newUnsaved( $role, $newContent ) );
221  }
222 
223  return $newRev;
224  }
225 
226  private function generateDiffOrPreview() {
227  $newRev = $this->getNewRevision();
228  if ( $newRev->hasSameContent( $this->curRev ) ) {
229  throw new ErrorPageError( 'mcrundofailed', 'undo-nochange' );
230  }
231 
232  $diffEngine = new DifferenceEngine( $this->context );
233  $diffEngine->setRevisions( $this->curRev, $newRev );
234 
235  $oldtitle = $this->context->msg( 'currentrev' )->parse();
236  $newtitle = $this->context->msg( 'yourtext' )->parse();
237 
238  if ( $this->getRequest()->getCheck( 'wpPreview' ) ) {
239  $this->showPreview( $newRev );
240  return '';
241  } else {
242  $diffText = $diffEngine->getDiff( $oldtitle, $newtitle );
243  $diffEngine->showDiffStyle();
244  return '<div id="wikiDiff">' . $diffText . '</div>';
245  }
246  }
247 
248  private function showPreview( RevisionRecord $rev ) {
249  // Mostly copied from EditPage::getPreviewText()
250  $out = $this->getOutput();
251 
252  try {
253  $previewHTML = '';
254 
255  # provide a anchor link to the form
256  $continueEditing = '<span class="mw-continue-editing">' .
257  '[[#mw-mcrundo-form|' .
258  $this->context->getLanguage()->getArrow() . ' ' .
259  $this->context->msg( 'continue-editing' )->text() . ']]</span>';
260 
261  $note = $this->context->msg( 'previewnote' )->plain() . ' ' . $continueEditing;
262 
263  $parserOptions = $this->page->makeParserOptions( $this->context );
264  $parserOptions->setIsPreview( true );
265  $parserOptions->setIsSectionPreview( false );
266  $parserOptions->enableLimitReport();
267 
268  $parserOutput = MediaWikiServices::getInstance()->getRevisionRenderer()
269  ->getRenderedRevision( $rev, $parserOptions, $this->context->getUser() )
270  ->getRevisionParserOutput();
271  $previewHTML = $parserOutput->getText( [ 'enableSectionEditLinks' => false ] );
272 
273  $out->addParserOutputMetadata( $parserOutput );
274  if ( count( $parserOutput->getWarnings() ) ) {
275  $note .= "\n\n" . implode( "\n\n", $parserOutput->getWarnings() );
276  }
277  } catch ( MWContentSerializationException $ex ) {
278  $m = $this->context->msg(
279  'content-failed-to-parse',
280  $ex->getMessage()
281  );
282  $note .= "\n\n" . $m->parse();
283  $previewHTML = '';
284  }
285 
286  $previewhead = "<div class='previewnote'>\n" .
287  '<h2 id="mw-previewheader">' . $this->context->msg( 'preview' )->escaped() . "</h2>" .
288  $out->parse( $note, true, /* interface */true ) . "<hr /></div>\n";
289 
290  $pageViewLang = $this->getTitle()->getPageViewLanguage();
291  $attribs = [ 'lang' => $pageViewLang->getHtmlCode(), 'dir' => $pageViewLang->getDir(),
292  'class' => 'mw-content-' . $pageViewLang->getDir() ];
293  $previewHTML = Html::rawElement( 'div', $attribs, $previewHTML );
294 
295  $out->addHtml( $previewhead . $previewHTML );
296  }
297 
298  public function onSubmit( $data ) {
299  global $wgUseRCPatrol;
300 
301  if ( !$this->getRequest()->getCheck( 'wpSave' ) ) {
302  // Diff or preview
303  return false;
304  }
305 
306  $updater = $this->page->getPage()->newPageUpdater( $this->context->getUser() );
307  $curRev = $updater->grabParentRevision();
308  if ( !$curRev ) {
309  throw new ErrorPageError( 'mcrundofailed', 'nopagetext' );
310  }
311 
312  if ( $this->cur !== $curRev->getId() ) {
313  return Status::newFatal( 'mcrundo-changed' );
314  }
315 
316  $newRev = $this->getNewRevision();
317  if ( !$newRev->hasSameContent( $curRev ) ) {
318  // Copy new slots into the PageUpdater, and remove any removed slots.
319  // TODO: This interface is awful, there should be a way to just pass $newRev.
320  // TODO: MCR: test this once we can store multiple slots
321  foreach ( $newRev->getSlots()->getSlots() as $slot ) {
322  $updater->setSlot( $slot );
323  }
324  foreach ( $curRev->getSlotRoles() as $role ) {
325  if ( !$newRev->hasSlot( $role ) ) {
326  $updater->removeSlot( $role );
327  }
328  }
329 
330  $updater->setOriginalRevisionId( false );
331  $updater->setUndidRevisionId( $this->undo );
332 
333  // TODO: Ugh.
334  if ( $wgUseRCPatrol && $this->getTitle()->userCan( 'autopatrol', $this->getUser() ) ) {
335  $updater->setRcPatrolStatus( RecentChange::PRC_AUTOPATROLLED );
336  }
337 
338  $updater->saveRevision(
339  CommentStoreComment::newUnsavedComment( trim( $this->getRequest()->getVal( 'wpSummary' ) ) ),
341  );
342 
343  return $updater->getStatus();
344  }
345 
346  return Status::newGood();
347  }
348 
349  protected function usesOOUI() {
350  return true;
351  }
352 
353  protected function getFormFields() {
354  $request = $this->getRequest();
355  $config = $this->context->getConfig();
356  $oldCommentSchema = $config->get( 'CommentTableSchemaMigrationStage' ) === MIGRATION_OLD;
357  $ret = [
358  'diff' => [
359  'type' => 'info',
360  'vertical-label' => true,
361  'raw' => true,
362  'default' => function () {
363  return $this->generateDiffOrPreview();
364  }
365  ],
366  'summary' => [
367  'type' => 'text',
368  'id' => 'wpSummary',
369  'name' => 'wpSummary',
370  'cssclass' => 'mw-summary',
371  'label-message' => 'summary',
372  'maxlength' => $oldCommentSchema ? 200 : CommentStore::COMMENT_CHARACTER_LIMIT,
373  'value' => $request->getVal( 'wpSummary', '' ),
374  'size' => 60,
375  'spellcheck' => 'true',
376  ],
377  'summarypreview' => [
378  'type' => 'info',
379  'label-message' => 'summary-preview',
380  'raw' => true,
381  ],
382  ];
383 
384  if ( $request->getCheck( 'wpSummary' ) ) {
385  $ret['summarypreview']['default'] = Xml::tags( 'div', [ 'class' => 'mw-summary-preview' ],
386  Linker::commentBlock( trim( $request->getVal( 'wpSummary' ) ), $this->getTitle(), false )
387  );
388  } else {
389  unset( $ret['summarypreview'] );
390  }
391 
392  return $ret;
393  }
394 
395  protected function alterForm( HTMLForm $form ) {
396  $form->setWrapperLegendMsg( 'confirm-mcrundo-title' );
397 
398  $labelAsPublish = $this->context->getConfig()->get( 'EditSubmitButtonLabelPublish' );
399 
400  $form->setId( 'mw-mcrundo-form' );
401  $form->setSubmitName( 'wpSave' );
402  $form->setSubmitTooltip( $labelAsPublish ? 'publish' : 'save' );
403  $form->setSubmitTextMsg( $labelAsPublish ? 'publishchanges' : 'savechanges' );
404  $form->showCancel( true );
405  $form->setCancelTarget( $this->getTitle() );
406  $form->addButton( [
407  'name' => 'wpPreview',
408  'value' => '1',
409  'label-message' => 'showpreview',
410  'attribs' => Linker::tooltipAndAccesskeyAttribs( 'preview' ),
411  ] );
412  $form->addButton( [
413  'name' => 'wpDiff',
414  'value' => '1',
415  'label-message' => 'showdiff',
416  'attribs' => Linker::tooltipAndAccesskeyAttribs( 'diff' ),
417  ] );
418 
419  $this->addStatePropagationFields( $form );
420  }
421 
422  protected function addStatePropagationFields( HTMLForm $form ) {
423  $form->addHiddenField( 'undo', $this->undo );
424  $form->addHiddenField( 'undoafter', $this->undoafter );
425  $form->addHiddenField( 'cur', $this->curRev->getId() );
426  }
427 
428  public function onSuccess() {
429  $this->getOutput()->redirect( $this->getTitle()->getFullURL() );
430  }
431 
432  protected function preText() {
433  return '<div style="clear:both"></div>';
434  }
435 }
McrUndoAction\$undoafter
$undoafter
Definition: McrUndoAction.php:31
CommentStoreComment\newUnsavedComment
static newUnsavedComment( $comment, array $data=null)
Create a new, unsaved CommentStoreComment.
Definition: CommentStoreComment.php:66
$user
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 account $user
Definition: hooks.txt:244
McrUndoAction\generateDiffOrPreview
generateDiffOrPreview()
Definition: McrUndoAction.php:226
Revision\RevisionRecord
Page revision base class.
Definition: RevisionRecord.php:45
false
processing should stop and the error should be shown to the user * false
Definition: hooks.txt:187
HTMLForm\setSubmitName
setSubmitName( $name)
Definition: HTMLForm.php:1398
Action\getRequest
getRequest()
Get the WebRequest being used for this instance.
Definition: Action.php:199
HTMLForm\setSubmitTooltip
setSubmitTooltip( $name)
Definition: HTMLForm.php:1409
captcha-old.count
count
Definition: captcha-old.py:249
McrUndoAction\preText
preText()
Add pre- or post-text to the form.
Definition: McrUndoAction.php:432
McrUndoAction\show
show()
The basic pattern for actions is to display some sort of HTMLForm UI, maybe with some stuff underneat...
Definition: McrUndoAction.php:44
HTMLForm\showCancel
showCancel( $show=true)
Show a cancel button (or prevent it).
Definition: HTMLForm.php:1472
StatusValue\newFatal
static newFatal( $message)
Factory function for fatal errors.
Definition: StatusValue.php:68
HTMLForm\setCancelTarget
setCancelTarget( $target)
Sets the target where the user is redirected to after clicking cancel.
Definition: HTMLForm.php:1483
FormAction
An action which shows a form and does something based on the input from the form.
Definition: FormAction.php:28
wfReadOnly
wfReadOnly()
Check whether the wiki is in read-only mode.
Definition: GlobalFunctions.php:1237
McrUndoAction\alterForm
alterForm(HTMLForm $form)
Play with the HTMLForm if you need to more substantially.
Definition: McrUndoAction.php:395
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:82
page
target page
Definition: All_system_messages.txt:1267
McrUndoAction\getFormFields
getFormFields()
Get an HTMLForm descriptor array.
Definition: McrUndoAction.php:353
McrUndoAction\$curRev
$curRev
Definition: McrUndoAction.php:34
McrUndoAction
Temporary action for MCR undos.
Definition: McrUndoAction.php:29
$wgUseRCPatrol
$wgUseRCPatrol
Use RC Patrolling to check for vandalism (from recent changes and watchlists) New pages and new files...
Definition: DefaultSettings.php:6933
php
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
Linker\tooltipAndAccesskeyAttribs
static tooltipAndAccesskeyAttribs( $name, array $msgParams=[], $options=null)
Returns the attributes for the tooltip and access key.
Definition: Linker.php:2133
Action\getContext
getContext()
Get the IContextSource in use here.
Definition: Action.php:180
McrUndoAction\getDescription
getDescription()
Returns the description that goes below the <h1> tag.
Definition: McrUndoAction.php:40
undo
presenting them properly to the user as errors is done by the caller return true use this to change the list i e undo
Definition: hooks.txt:1808
$newRev
$newRev
Definition: pageupdater.txt:66
HTMLForm\addButton
addButton( $data)
Add a button to the form.
Definition: HTMLForm.php:963
McrUndoAction\addStatePropagationFields
addStatePropagationFields(HTMLForm $form)
Definition: McrUndoAction.php:422
HTMLForm\addHiddenField
addHiddenField( $name, $value, array $attribs=[])
Add a hidden field to the output.
Definition: HTMLForm.php:914
McrUndoAction\$cur
$cur
Definition: McrUndoAction.php:31
$attribs
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 after processing & $attribs
Definition: hooks.txt:2036
MWContentSerializationException
Exception representing a failure to serialize or unserialize a content object.
Definition: MWContentSerializationException.php:7
McrUndoAction\usesOOUI
usesOOUI()
Whether the form should use OOUI.
Definition: McrUndoAction.php:349
use
as see the revision history and available at free of to any person obtaining a copy of this software and associated documentation to deal in the Software without including without limitation the rights to use
Definition: MIT-LICENSE.txt:10
McrUndoAction\getNewRevision
getNewRevision()
Definition: McrUndoAction.php:132
McrUndoAction\getName
getName()
Return the name of the action this object responds to.
Definition: McrUndoAction.php:36
MIGRATION_OLD
const MIGRATION_OLD
Definition: Defines.php:315
$request
do that in ParserLimitReportFormat instead use this to modify the parameters of the image all existing parser cache entries will be invalid To avoid you ll need to handle that somehow(e.g. with the RejectParserCacheValue hook) because MediaWiki won 't do it for you. & $defaults also a ContextSource after deleting those rows but within the same transaction you ll probably need to make sure the header is varied on $request
Definition: hooks.txt:2675
Action\getUser
getUser()
Shortcut to get the User being used for this instance.
Definition: Action.php:219
MediaWiki\Session\SessionManager\getGlobalSession
static getGlobalSession()
Get the "global" session.
Definition: SessionManager.php:107
EDIT_UPDATE
const EDIT_UPDATE
Definition: Defines.php:153
StatusValue\newGood
static newGood( $value=null)
Factory function for good results.
Definition: StatusValue.php:81
HTMLForm\setId
setId( $id)
Definition: HTMLForm.php:1508
Revision\MutableRevisionRecord
Mutable RevisionRecord implementation, for building new revision entries programmatically.
Definition: MutableRevisionRecord.php:41
Xml\tags
static tags( $element, $attribs, $contents)
Same as Xml::element(), but does not escape contents.
Definition: Xml.php:132
$ret
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 & $ret
Definition: hooks.txt:2036
Action\getTitle
getTitle()
Shortcut to get the Title object from the page.
Definition: Action.php:248
RecentChange\PRC_AUTOPATROLLED
const PRC_AUTOPATROLLED
Definition: RecentChange.php:79
CommentStore\COMMENT_CHARACTER_LIMIT
const COMMENT_CHARACTER_LIMIT
Maximum length of a comment in UTF-8 characters.
Definition: CommentStore.php:37
HTMLForm\setSubmitTextMsg
setSubmitTextMsg( $msg)
Set the text for the submit button to a message.
Definition: HTMLForm.php:1376
EDIT_AUTOSUMMARY
const EDIT_AUTOSUMMARY
Definition: Defines.php:158
wfReadOnlyReason
wfReadOnlyReason()
Check if the site is in read-only mode and return the message if so.
Definition: GlobalFunctions.php:1250
McrUndoAction\onSubmit
onSubmit( $data)
Process the form on POST submission.
Definition: McrUndoAction.php:298
HTMLForm\setWrapperLegendMsg
setWrapperLegendMsg( $msg)
Prompt the whole form to be wrapped in a "<fieldset>", with this message as its "<legend>" element.
Definition: HTMLForm.php:1550
$rev
presenting them properly to the user as errors is done by the caller return true use this to change the list i e etc $rev
Definition: hooks.txt:1808
as
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
McrUndoAction\checkCanExecute
checkCanExecute(User $user)
Checks if the given user (identified by an object) can perform this action.
Definition: McrUndoAction.php:109
McrUndoAction\initFromParameters
initFromParameters()
Definition: McrUndoAction.php:93
Html\rawElement
static rawElement( $element, $attribs=[], $contents='')
Returns an HTML element in a string.
Definition: Html.php:210
DifferenceEngine
DifferenceEngine is responsible for rendering the difference between two revisions as HTML.
Definition: DifferenceEngine.php:49
McrUndoAction\showPreview
showPreview(RevisionRecord $rev)
Definition: McrUndoAction.php:248
Linker\commentBlock
static commentBlock( $comment, $title=null, $local=false, $wikiId=null)
Wrap a comment in standard punctuation and formatting if it's non-empty, otherwise return empty strin...
Definition: Linker.php:1441
$updater
$page->newPageUpdater($user) $updater
Definition: pageupdater.txt:63
Action\getOutput
getOutput()
Get the OutputPage being used for this instance.
Definition: Action.php:209
Action\useTransactionalTimeLimit
useTransactionalTimeLimit()
Call wfTransactionalTimeLimit() if this request was POSTed.
Definition: Action.php:417
McrUndoAction\$undo
$undo
Definition: McrUndoAction.php:31
McrUndoAction\onSuccess
onSuccess()
Do something exciting on successful processing of the form.
Definition: McrUndoAction.php:428
MediaWikiServices
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 MediaWikiServices
Definition: injection.txt:23
ErrorPageError
An error page which can definitely be safely rendered using the OutputPage.
Definition: ErrorPageError.php:27
User
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
Definition: User.php:47
Revision\SlotRecord
Value object representing a content slot associated with a page revision.
Definition: SlotRecord.php:39
HTMLForm
Object handling generic submission, CSRF protection, layout and other logic for UI forms.
Definition: HTMLForm.php:136
$out
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:813