76 return $this->historyPage->getArticle();
81 return 'history page filtered';
83 return 'history page unfiltered';
92 'conds' => array_merge(
95 'options' => [
'USE INDEX' => [
'revision' =>
'page_timestamp' ] ],
100 $queryInfo[
'fields'],
102 $queryInfo[
'join_conds'],
103 $queryInfo[
'options'],
108 $historyPager = $this;
109 Hooks::run(
'PageHistoryPager::getQueryInfo', [ &$historyPager, &$queryInfo ] );
115 return 'rev_timestamp';
123 if ( $this->lastRow ) {
125 $firstInList = $this->counter == 1;
128 $notifTimestamp = $this->
getConfig()->get(
'ShowUpdatedMarker' )
133 $this->lastRow, $row, $notifTimestamp, $latest, $firstInList );
137 $this->lastRow = $row;
143 if ( !Hooks::run(
'PageHistoryPager::doBatchLookups', [ $this, $this->mResult ] ) ) {
147 # Do a link batch query
148 $this->mResult->seek( 0 );
151 foreach ( $this->mResult
as $row ) {
152 if ( $row->rev_parent_id ) {
153 $revIds[] = $row->rev_parent_id;
155 if ( $row->user_name !==
null ) {
165 $this->mResult->seek( 0 );
174 $this->lastRow =
false;
176 $this->oldIdChecked = 0;
178 $this->
getOutput()->wrapWikiMsg(
"<div class='mw-history-legend'>\n$1\n</div>",
'histlegend' );
179 $s = Html::openElement(
'form', [
'action' =>
wfScript(),
180 'id' =>
'mw-history-compare' ] ) .
"\n";
181 $s .= Html::hidden(
'title', $this->
getTitle()->getPrefixedDBkey() ) .
"\n";
182 $s .= Html::hidden(
'action',
'historysubmit' ) .
"\n";
183 $s .= Html::hidden(
'type',
'revision' ) .
"\n";
186 $this->buttons = Html::openElement(
'div', [
'class' =>
'mw-history-compareselectedversions' ] );
187 $className =
'historysubmit mw-history-compareselectedversions-button';
188 $attrs = [
'class' => $className ]
196 if (
$user->isAllowed(
'deleterevision' ) ) {
197 $actionButtons .= $this->
getRevisionButton(
'revisiondelete',
'showhideselectedversions' );
199 if ( $this->showTagEditUI ) {
200 $actionButtons .= $this->
getRevisionButton(
'editchangetags',
'history-edit-tags' );
202 if ( $actionButtons ) {
203 $this->buttons .= Xml::tags(
'div', [
'class' =>
204 'mw-history-revisionactions' ], $actionButtons );
207 if (
$user->isAllowed(
'deleterevision' ) || $this->showTagEditUI ) {
211 $this->buttons .=
'</div>';
214 $s .=
'<ul id="pagehistory">' .
"\n";
221 # Note T22966, <button> is non-standard in IE<8
222 $element = Html::element(
228 'class' =>
"historysubmit mw-history-$name-button",
236 if ( $this->lastRow ) {
238 $firstInList = $this->counter == 1;
239 if ( $this->mIsBackwards ) {
240 # Next row is unknown, but for UI reasons, probably exists if an offset has been specified
241 if ( $this->mOffset ==
'' ) {
247 # The next row is the past-the-end row
252 $notifTimestamp = $this->
getConfig()->get(
'ShowUpdatedMarker' )
257 $this->lastRow, $next, $notifTimestamp, $latest, $firstInList );
262 # Add second buttons only if there is more than one rev
279 # Disable submit button if history has 1 revision only
281 return Html::submitButton( $message, $attributes );
301 function historyLine( $row, $next, $notificationtimestamp =
false,
302 $latest =
false, $firstInList =
false ) {
305 if ( is_object( $next ) ) {
313 $curLastlinks = Html::rawElement(
'span', [], $curlink ) .
314 Html::rawElement(
'span', [], $lastlink );
315 $histLinks = Html::rawElement(
317 [
'class' =>
'mw-history-histlinks mw-changeslist-links' ],
322 $s = $histLinks . $diffButtons;
329 $canRevDelete =
$user->isAllowed(
'deleterevision' );
332 if ( $canRevDelete || $this->showTagEditUI ) {
337 $del = Xml::check(
'deleterevisions',
false, [
'disabled' =>
'disabled' ] );
340 $del = Xml::check(
'showhiderevisions',
false,
341 [
'name' =>
'ids[' .
$rev->getId() .
']' ] );
344 } elseif (
$rev->getVisibility() &&
$user->isAllowed(
'deletedhistory' ) ) {
350 $query = [
'type' =>
'revision',
351 'target' => $this->
getTitle()->getPrefixedDBkey(),
'ids' =>
$rev->getId() ];
361 $dirmark =
$lang->getDirMark();
365 $s .=
" <span class='history-user'>" .
369 if (
$rev->isMinor() ) {
373 # Sometimes rev_len isn't populated
374 if (
$rev->getSize() !==
null ) {
375 # Size is always public data
376 $prevSize = $this->parentLens[$row->rev_parent_id] ?? 0;
379 $s .=
' <span class="mw-changeslist-separator"></span> ' .
"$fSize $sDiff";
382 # Text following the character difference is added just before running hooks
385 if ( $notificationtimestamp && ( $row->rev_timestamp >= $notificationtimestamp ) ) {
386 $s2 .=
' <span class="updatedmarker">' . $this->
msg(
'updatedmarker' )->escaped() .
'</span>';
387 $classes[] =
'mw-history-line-updated';
392 # Rollback and undo links
393 if ( $prevRev && $this->
getTitle()->quickUserCan(
'edit',
$user ) ) {
394 if ( $latest && $this->
getTitle()->quickUserCan(
'rollback',
$user ) ) {
399 [
'verify',
'noBrackets' ]
401 if ( $rollbackLink ) {
403 $tools[] = $rollbackLink;
410 # Create undo tooltip for the first (=latest) line only
411 $undoTooltip = $latest
412 ? [
'title' => $this->
msg(
'tooltip-undo' )->text() ]
414 $undolink = MediaWikiServices::getInstance()->getLinkRenderer()->makeKnownLink(
416 $this->
msg(
'editundo' )->
text(),
420 'undoafter' => $prevRev->getId(),
421 'undo' =>
$rev->getId()
424 $tools[] =
"<span class=\"mw-history-undo\">{$undolink}</span>";
428 Hooks::run(
'HistoryRevisionTools', [
$rev, &$tools, $prevRev,
$user ] );
431 $s2 .=
' ' . Html::openElement(
'span', [
'class' =>
'mw-changeslist-links' ] );
432 foreach ( $tools
as $tool ) {
433 $s2 .= Html::rawElement(
'span', [], $tool );
435 $s2 .= Html::closeElement(
'span' );
444 $classes = array_merge( $classes, $newClasses );
445 if ( $tagSummary !==
'' ) {
446 $s2 .=
" $tagSummary";
449 # Include separator between character difference and following text
451 $s .=
' <span class="mw-changeslist-separator"></span> ' . $s2;
456 Hooks::run(
'PageHistoryLineEnding', [ $this, &$row, &
$s, &$classes, &
$attribs ] );
458 [ Sanitizer::class,
'isReservedDataAttribute' ],
463 $attribs[
'class'] = implode(
' ', $classes );
466 return Xml::tags(
'li',
$attribs,
$s ) .
"\n";
488 $cur = $this->historyPage->message[
'cur'];
492 return MediaWikiServices::getInstance()->getLinkRenderer()->makeKnownLink(
498 'oldid' =>
$rev->getId()
514 $last = $this->historyPage->message[
'last'];
516 if ( $next ===
null ) {
517 # Probably no next row
521 $linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer();
522 if ( $next ===
'unknown' ) {
523 # Next row probably exists but is unknown, use an oldid=prev link
529 'diff' => $prevRev->getId(),
548 'diff' => $prevRev->getId(),
549 'oldid' => $next->rev_id
565 $radio = [
'type' =>
'radio',
'value' => $id ];
567 if ( $firstInList ) {
568 $first = Xml::element(
'input',
569 array_merge( $radio, [
570 'style' =>
'visibility:hidden',
572 'id' =>
'mw-oldid-null' ] )
574 $checkmark = [
'checked' =>
'checked' ];
576 # Check visibility of old revisions
578 $radio[
'disabled'] =
'disabled';
580 } elseif ( !$this->oldIdChecked ) {
581 $checkmark = [
'checked' =>
'checked' ];
582 $this->oldIdChecked = $id;
586 $first = Xml::element(
'input',
587 array_merge( $radio, $checkmark, [
589 'id' =>
"mw-oldid-$id" ] ) );
592 $second = Xml::element(
'input',
593 array_merge( $radio, $checkmark, [
595 'id' =>
"mw-diff-$id" ] ) );
597 return $first . $second;
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for use
This list may contain false positives That usually means there is additional text with links below the first Each row contains links to the first and second as well as the first line of the second redirect text
wfScript( $script='index')
Get the path to a specified script file, respecting file extensions; this is a wrapper around $wgScri...
static showCharacterDifference( $old, $new, IContextSource $context=null)
Show formatted char difference.
static flag( $flag, IContextSource $context=null)
Make an "<abbr>" element for a given change flag.
static revDateLink(Revision $rev, User $user, Language $lang, $title=null)
Render the date and time of a revision in the current user language based on whether the user is able...
msg( $key)
Get a Message object with context set Parameters are the same as wfMessage()
getWikiPage()
Get the WikiPage object.
getContext()
Get the base IContextSource object.
This class handles printing the history page for an article.
Marks HTML that shouldn't be escaped.
Class representing a list of titles The execute() method checks them all for existence and adds them ...
static generateRollback( $rev, IContextSource $context=null, $options=[ 'verify'])
Generate a rollback link for a given revision.
static revComment(Revision $rev, $local=false, $isPublic=false, $useParentheses=true)
Wrap and format the given revision's comment block, if the current user is allowed to view it.
static revDeleteLinkDisabled( $delete=true)
Creates a dead (show/hide) link for deleting revisions/log entries.
static formatRevisionSize( $size)
static revUserTools( $rev, $isPublic=false, $useParentheses=true)
Generate a user tool link cluster if the current user is allowed to view it.
static tooltipAndAccesskeyAttribs( $name, array $msgParams=[], $options=null)
Returns the attributes for the tooltip and access key.
static revDeleteLink( $query=[], $restricted=false, $delete=true)
Creates a (show/hide) link for deleting revisions/log entries.
Class for generating clickable toggle links for a list of checkboxes.
static getQueryInfo( $options=[])
Return the tables, fields, and join conditions to be selected to create a new revision object.
static getParentLengths( $db, array $revIds)
Do a batched query to get the parent revision lengths.
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
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
globals txt Globals are evil The original MediaWiki code relied on globals for processing context far too often MediaWiki development since then has been a story of slowly moving context out of global variables and into objects Storing processing context in object member variables allows those objects to be reused in a much more flexible way Consider the elegance of
database rows
usually copyright or history_copyright This message must be in HTML not wikitext & $link
Allows to change the fields on the form that will be generated $name
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
null for the local wiki Added should default to null in handler for backwards compatibility add a value to it if you want to add a cookie that have to vary cache options can modify $query
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 after in associative array form before processing starts Return false to skip default processing and return $ret $linkRenderer
return true to allow those checks to and false if checking is done & $user
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
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
The wiki should then use memcached to cache various data To use multiple just add more items to the array To increase the weight of a make its entry a array("192.168.0.1:11211", 2))
In both all secondary updates will be triggered handle like object that caches derived data representing a and can trigger updates of cached copies of that e g in the links the and the CDN layer DerivedPageDataUpdater is used by PageUpdater when creating new revisions
if(!isset( $args[0])) $lang