60 return $this->
msg(
'history-title', $this->
getTitle()->getPrefixedText() )->text();
65 $linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer();
67 SpecialPage::getTitleFor(
'Log' ),
68 $this->
msg(
'viewpagelogs' )->
text(),
70 [
'page' => $this->
getTitle()->getPrefixedText() ]
78 . $this->
msg(
'word-separator' )->escaped()
79 . $this->
msg(
'parentheses' )
80 ->rawParams( $this->
getLanguage()->pipeList( $links ) )
99 if ( !isset( $this->message ) ) {
100 $msgs = [
'cur',
'last',
'pipe-separator' ];
101 foreach ( $msgs as $msg ) {
102 $this->message[$msg] = $this->
msg( $msg )->escaped();
117 if (
$out->checkLastModified( $this->page->getTouched() ) ) {
122 $config = $this->context->getConfig();
124 # Fill in the file cache if not set already
127 if ( !
$cache->isCacheGood( ) ) {
128 ob_start( [ &
$cache,
'saveToFileCache' ] );
133 $out->setFeedAppendQuery(
'action=history' );
134 $out->addModules(
'mediawiki.action.history' );
135 $out->addModuleStyles( [
136 'mediawiki.action.history.styles',
137 'mediawiki.special.changeslist',
139 if ( $config->get(
'UseMediaWikiUIEverywhere' ) ) {
141 $out->addModuleStyles( [
142 'mediawiki.ui.input',
143 'mediawiki.ui.checkbox',
148 $feedType =
$request->getVal(
'feed' );
150 $this->
feed( $feedType );
155 $this->
addHelpLink(
'//meta.wikimedia.org/wiki/Special:MyLanguage/Help:Page_history',
true );
158 if ( !$this->page->exists() ) {
161 $out->setStatusCode( 404 );
163 $out->addWikiMsg(
'nohistory' );
167 # show deletion/move log if there is an entry
170 [
'delete',
'move',
'protect' ],
174 'conds' => [
'log_action != ' .
$dbr->addQuotes(
'revision' ) ],
175 'showIfEmpty' =>
false,
176 'msgKey' => [
'moveddeleted-notice' ]
187 $month =
$request->getInt(
'month' );
188 $tagFilter =
$request->getVal(
'tagfilter' );
189 $tagSelector = ChangeTags::buildTagFilterSelector( $tagFilter,
false, $this->
getContext() );
194 if (
$request->getBool(
'deleted' ) ) {
195 $conds = [
'rev_deleted != 0' ];
199 if ( $this->
getUser()->isAllowed(
'deletedhistory' ) ) {
200 $checkDeleted = Xml::checkLabel( $this->
msg(
'history-show-deleted' )->
text(),
201 'deleted',
'mw-show-deleted-only',
$request->getBool(
'deleted' ) ) .
"\n";
207 $action = htmlspecialchars(
wfScript() );
208 $content = Html::hidden(
'title', $this->
getTitle()->getPrefixedDBkey() ) .
"\n";
209 $content .= Html::hidden(
'action',
'history' ) .
"\n";
211 ( $year ==
null ? MWTimestamp::getLocalInstance()->
format(
'Y' ) : $year ),
214 $content .= $tagSelector ? ( implode(
"\u{00A0}", $tagSelector ) .
"\u{00A0}" ) :
'';
215 $content .= $checkDeleted . Html::submitButton(
216 $this->
msg(
'historyaction-submit' )->
text(),
218 [
'mw-ui-progressive' ]
221 "<form action=\"$action\" method=\"get\" id=\"mw-history-searchform\">" .
223 $this->
msg(
'history-fieldset-title' )->
text(),
225 [
'id' =>
'mw-history-search' ]
230 Hooks::run(
'PageHistoryBeforeList', [ &$this->page, $this->
getContext() ] );
233 $pager =
new HistoryPager( $this, $year, $month, $tagFilter, $conds );
235 $pager->getNavigationBar() .
237 $pager->getNavigationBar()
239 $out->preventClickjacking( $pager->getPreventClickjacking() );
260 if ( $direction === self::DIR_PREV ) {
267 $offsets = [
"rev_timestamp $oper " .
$dbr->addQuotes(
$dbr->timestamp( $offset ) ) ];
272 $page_id = $this->page->getId();
278 array_merge( [
'rev_page' => $page_id ], $offsets ),
281 'ORDER BY' =>
"rev_timestamp $dirs",
282 'USE INDEX' => [
'revision' =>
'page_timestamp' ],
300 $feedClasses = $this->context->getConfig()->get(
'FeedClasses' );
302 $feed =
new $feedClasses[
$type](
303 $this->
getTitle()->getPrefixedText() .
' - ' .
304 $this->
msg(
'history-feed-title' )->inContentLanguage()->text(),
305 $this->
msg(
'history-feed-description' )->inContentLanguage()->text(),
306 $this->
getTitle()->getFullURL(
'action=history' )
311 $limit =
$request->getInt(
'limit', 10 );
314 $this->context->getConfig()->get(
'FeedLimit' )
321 if ( $items->numRows() ) {
322 foreach ( $items as $row ) {
323 $feed->outItem( $this->
feedItem( $row ) );
333 $this->
msg(
'nohistory' )->inContentLanguage()->
text(),
334 $this->
msg(
'history-feed-empty' )->inContentLanguage()->parseAsBlock(),
338 $this->
getTitle()->getTalkPage()->getFullURL()
355 $this->
getTitle()->getPreviousRevisionID(
$rev->getId() ),
357 $rev->getTimestamp(),
360 if (
$rev->getComment() ==
'' ) {
361 $contLang = MediaWikiServices::getInstance()->getContentLanguage();
362 $title = $this->
msg(
'history-feed-item-nocomment',
364 $contLang->timeanddate(
$rev->getTimestamp() ),
365 $contLang->date(
$rev->getTimestamp() ),
366 $contLang->time(
$rev->getTimestamp() )
367 )->inContentLanguage()->text();
369 $title =
$rev->getUserText() .
370 $this->
msg(
'colon-separator' )->inContentLanguage()->text() .
377 $this->
getTitle()->getFullURL(
'diff=' .
$rev->getId() .
'&oldid=prev' ),
378 $rev->getTimestamp(),
380 $this->getTitle()->getTalkPage()->getFullURL()
424 $this->showTagEditUI = ChangeTags::showTagEditingUI( $this->
getUser() );
429 return $this->historyPage->getArticle();
433 if ( $this->conds ) {
434 return 'history page filtered';
436 return 'history page unfiltered';
445 'conds' => array_merge(
448 'options' => [
'USE INDEX' => [
'revision' =>
'page_timestamp' ] ],
451 ChangeTags::modifyDisplayQuery(
452 $queryInfo[
'tables'],
453 $queryInfo[
'fields'],
455 $queryInfo[
'join_conds'],
456 $queryInfo[
'options'],
461 $historyPager = $this;
462 Hooks::run(
'PageHistoryPager::getQueryInfo', [ &$historyPager, &$queryInfo ] );
468 return 'rev_timestamp';
476 if ( $this->lastRow ) {
478 $firstInList = $this->counter == 1;
481 $notifTimestamp = $this->
getConfig()->get(
'ShowUpdatedMarker' )
486 $this->lastRow, $row, $notifTimestamp, $latest, $firstInList );
490 $this->lastRow = $row;
496 if ( !Hooks::run(
'PageHistoryPager::doBatchLookups', [ $this, $this->mResult ] ) ) {
500 # Do a link batch query
501 $this->mResult->seek( 0 );
504 foreach ( $this->mResult as $row ) {
505 if ( $row->rev_parent_id ) {
506 $revIds[] = $row->rev_parent_id;
508 if ( !is_null( $row->user_name ) ) {
509 $batch->add( NS_USER, $row->user_name );
511 }
else { #
for anons or usernames of imported revisions
512 $batch->add( NS_USER, $row->rev_user_text );
518 $this->mResult->seek( 0 );
527 $this->lastRow =
false;
529 $this->oldIdChecked = 0;
531 $this->
getOutput()->wrapWikiMsg(
"<div class='mw-history-legend'>\n$1\n</div>",
'histlegend' );
532 $s = Html::openElement(
'form', [
'action' =>
wfScript(),
533 'id' =>
'mw-history-compare' ] ) .
"\n";
534 $s .= Html::hidden(
'title', $this->
getTitle()->getPrefixedDBkey() ) .
"\n";
535 $s .= Html::hidden(
'action',
'historysubmit' ) .
"\n";
536 $s .= Html::hidden(
'type',
'revision' ) .
"\n";
539 $this->buttons =
'<div>';
540 $className =
'historysubmit mw-history-compareselectedversions-button';
541 $attrs = [
'class' => $className ]
549 if ( $user->isAllowed(
'deleterevision' ) ) {
550 $actionButtons .= $this->
getRevisionButton(
'revisiondelete',
'showhideselectedversions' );
552 if ( $this->showTagEditUI ) {
553 $actionButtons .= $this->
getRevisionButton(
'editchangetags',
'history-edit-tags' );
555 if ( $actionButtons ) {
556 $this->buttons .= Xml::tags(
'div', [
'class' =>
557 'mw-history-revisionactions' ], $actionButtons );
560 if ( $user->isAllowed(
'deleterevision' ) || $this->showTagEditUI ) {
564 $this->buttons .=
'</div>';
567 $s .=
'<ul id="pagehistory">' .
"\n";
574 # Note T22966, <button> is non-standard in IE<8
575 $element = Html::element(
581 'class' =>
"historysubmit mw-history-$name-button",
589 if ( $this->lastRow ) {
591 $firstInList = $this->counter == 1;
592 if ( $this->mIsBackwards ) {
593 # Next row is unknown, but for UI reasons, probably exists if an offset has been specified
594 if ( $this->mOffset ==
'' ) {
600 # The next row is the past-the-end row
605 $notifTimestamp = $this->
getConfig()->get(
'ShowUpdatedMarker' )
610 $this->lastRow, $next, $notifTimestamp, $latest, $firstInList );
615 # Add second buttons only if there is more than one rev
632 # Disable submit button if history has 1 revision only
634 return Html::submitButton( $message, $attributes );
654 function historyLine( $row, $next, $notificationtimestamp =
false,
655 $latest =
false, $firstInList =
false ) {
658 if ( is_object( $next ) ) {
666 $curLastlinks = $curlink . $this->historyPage->message[
'pipe-separator'] . $lastlink;
667 $histLinks = Html::rawElement(
669 [
'class' =>
'mw-history-histlinks' ],
670 $this->
msg(
'parentheses' )->rawParams( $curLastlinks )->escaped()
674 $s = $histLinks . $diffButtons;
681 $canRevDelete = $user->isAllowed(
'deleterevision' );
684 if ( $canRevDelete || $this->showTagEditUI ) {
689 $del = Xml::check(
'deleterevisions',
false, [
'disabled' =>
'disabled' ] );
692 $del = Xml::check(
'showhiderevisions',
false,
693 [
'name' =>
'ids[' .
$rev->getId() .
']' ] );
696 } elseif (
$rev->getVisibility() && $user->isAllowed(
'deletedhistory' ) ) {
702 $query = [
'type' =>
'revision',
703 'target' => $this->
getTitle()->getPrefixedDBkey(),
'ids' =>
$rev->getId() ];
713 $dirmark =
$lang->getDirMark();
717 $s .=
" <span class='history-user'>" .
721 if (
$rev->isMinor() ) {
725 # Sometimes rev_len isn't populated
726 if (
$rev->getSize() !==
null ) {
727 # Size is always public data
728 $prevSize = $this->parentLens[$row->rev_parent_id] ?? 0;
731 $s .=
' <span class="mw-changeslist-separator">. .</span> ' .
"$fSize $sDiff";
734 # Text following the character difference is added just before running hooks
737 if ( $notificationtimestamp && ( $row->rev_timestamp >= $notificationtimestamp ) ) {
738 $s2 .=
' <span class="updatedmarker">' . $this->
msg(
'updatedmarker' )->escaped() .
'</span>';
739 $classes[] =
'mw-history-line-updated';
744 # Rollback and undo links
745 if ( $prevRev && $this->
getTitle()->quickUserCan(
'edit', $user ) ) {
746 if ( $latest && $this->
getTitle()->quickUserCan(
'rollback', $user ) ) {
751 [
'verify',
'noBrackets' ]
753 if ( $rollbackLink ) {
755 $tools[] = $rollbackLink;
762 # Create undo tooltip for the first (=latest) line only
763 $undoTooltip = $latest
764 ? [
'title' => $this->
msg(
'tooltip-undo' )->text() ]
766 $undolink = MediaWikiServices::getInstance()->getLinkRenderer()->makeKnownLink(
768 $this->
msg(
'editundo' )->
text(),
772 'undoafter' => $prevRev->getId(),
773 'undo' =>
$rev->getId()
776 $tools[] =
"<span class=\"mw-history-undo\">{$undolink}</span>";
780 Hooks::run(
'HistoryRevisionTools', [
$rev, &$tools, $prevRev, $user ] );
783 $s2 .=
' ' . $this->
msg(
'parentheses' )->rawParams(
$lang->pipeList( $tools ) )->escaped();
787 list( $tagSummary, $newClasses ) = ChangeTags::formatSummaryRow(
792 $classes = array_merge( $classes, $newClasses );
793 if ( $tagSummary !==
'' ) {
794 $s2 .=
" $tagSummary";
797 # Include separator between character difference and following text
799 $s .=
' <span class="mw-changeslist-separator">. .</span> ' . $s2;
804 Hooks::run(
'PageHistoryLineEnding', [ $this, &$row, &
$s, &$classes, &
$attribs ] );
806 [ Sanitizer::class,
'isReservedDataAttribute' ],
811 $attribs[
'class'] = implode(
' ', $classes );
814 return Xml::tags(
'li',
$attribs,
$s ) .
"\n";
824 $date = $this->
getLanguage()->userTimeAndDate(
$rev->getTimestamp(), $this->getUser() );
826 $link = MediaWikiServices::getInstance()->getLinkRenderer()->makeKnownLink(
829 [
'class' =>
'mw-changeslist-date' ],
830 [
'oldid' =>
$rev->getId() ]
833 $link = htmlspecialchars( $date );
836 $link =
"<span class=\"history-deleted\">$link</span>";
850 $cur = $this->historyPage->message[
'cur'];
854 return MediaWikiServices::getInstance()->getLinkRenderer()->makeKnownLink(
860 'oldid' =>
$rev->getId()
876 $last = $this->historyPage->message[
'last'];
878 if ( $next ===
null ) {
879 # Probably no next row
883 $linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer();
884 if ( $next ===
'unknown' ) {
885 # Next row probably exists but is unknown, use an oldid=prev link
891 'diff' => $prevRev->getId(),
910 'diff' => $prevRev->getId(),
911 'oldid' => $next->rev_id
927 $radio = [
'type' =>
'radio',
'value' => $id ];
929 if ( $firstInList ) {
930 $first = Xml::element(
'input',
931 array_merge( $radio, [
932 'style' =>
'visibility:hidden',
934 'id' =>
'mw-oldid-null' ] )
936 $checkmark = [
'checked' =>
'checked' ];
938 # Check visibility of old revisions
940 $radio[
'disabled'] =
'disabled';
942 } elseif ( !$this->oldIdChecked ) {
943 $checkmark = [
'checked' =>
'checked' ];
944 $this->oldIdChecked = $id;
948 $first = Xml::element(
'input',
949 array_merge( $radio, $checkmark, [
951 'id' =>
"mw-oldid-$id" ] ) );
954 $second = Xml::element(
'input',
955 array_merge( $radio, $checkmark, [
957 'id' =>
"mw-diff-$id" ] ) );
959 return $first . $second;
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
$wgSend404Code
Some web hosts attempt to rewrite all responses with a 404 (not found) status code,...
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
wfScript( $script='index')
Get the path to a specified script file, respecting file extensions; this is a wrapper around $wgScri...
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
$page
Page on which we're performing the action.
addHelpLink( $to, $overrideBaseUrl=false)
Adds help link with an icon via page indicators.
getTitle()
Shortcut to get the Title object from the page.
getContext()
Get the IContextSource in use here.
getOutput()
Get the OutputPage being used for this instance.
msg( $key)
Get a Message object with context set Parameters are the same as wfMessage()
getUser()
Shortcut to get the User being used for this instance.
static exists( $name)
Check if a given action is recognised, even if it's disabled.
getLanguage()
Shortcut to get the user Language being used for this instance.
getRequest()
Get the WebRequest being used for this instance.
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.
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.
A base class for basic support for outputting syndication feeds in RSS and other formats.
static stripComment( $text)
Quickie hack... strip out wikilinks to more legible form from the comment.
static checkFeedOutput( $type)
Check whether feeds can be used and that $type is a valid feed type.
static formatDiffRow( $title, $oldid, $newid, $timestamp, $comment, $actiontext='')
Really format a diff for the newsfeed.
Page view caching in the file system.
static useFileCache(IContextSource $context, $mode=self::MODE_NORMAL)
Check if pages can be cached for this request/user.
This class handles printing the history page for an article.
onView()
Print the history page for an article.
feed( $type)
Output a subscription feed listing recent edits to this page.
preCacheMessages()
As we use the same small set of messages in various methods and that they are called often,...
array $message
Array of message keys and strings.
getName()
Return the name of the action this object responds to.
requiresWrite()
Whether this action requires the wiki not to be locked.
getPageTitle()
Returns the name that goes in the <h1> page title.
fetchRevisions( $limit, $offset, $direction)
Fetch an array of revisions, specified by a given limit, offset and direction.
feedItem( $row)
Generate a FeedItem object from a given revision table row Borrows Recent Changes' feed generation fu...
getDescription()
Returns the description that goes below the <h1> tag.
requiresUnblock()
Whether this action can still be executed by a blocked user.
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 revDeleteLinkDisabled( $delete=true)
Creates a dead (show/hide) link for deleting revisions/log entries.
static revComment(Revision $rev, $local=false, $isPublic=false)
Wrap and format the given revision's comment block, if the current user is allowed to view it.
static revUserTools( $rev, $isPublic=false)
Generate a user tool link cluster if the current user is allowed to view it.
static formatRevisionSize( $size)
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 showLogExtract(&$out, $types=[], $page='', $user='', $param=[])
Show log extract.
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
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
if the prop value should be in the metadata multi language array format
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
usually copyright or history_copyright This message must be in HTML not wikitext & $link
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
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
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))
if(!isset( $args[0])) $lang