60 return $this->
msg(
'history-title', $this->
getTitle()->getPrefixedText() )->text();
65 return MediaWikiServices::getInstance()->getLinkRenderer()->makeKnownLink(
66 SpecialPage::getTitleFor(
'Log' ),
67 $this->
msg(
'viewpagelogs' )->
text(),
69 [
'page' => $this->
getTitle()->getPrefixedText() ]
86 if ( !isset( $this->message ) ) {
87 $msgs = [
'cur',
'last',
'pipe-separator' ];
88 foreach ( $msgs as $msg ) {
89 $this->message[$msg] = $this->
msg( $msg )->escaped();
104 if (
$out->checkLastModified( $this->page->getTouched() ) ) {
109 $config = $this->context->getConfig();
111 # Fill in the file cache if not set already
114 if ( !
$cache->isCacheGood( ) ) {
115 ob_start( [ &
$cache,
'saveToFileCache' ] );
120 $out->setFeedAppendQuery(
'action=history' );
121 $out->addModules(
'mediawiki.action.history' );
122 $out->addModuleStyles( [
123 'mediawiki.action.history.styles',
124 'mediawiki.special.changeslist',
126 if ( $config->get(
'UseMediaWikiUIEverywhere' ) ) {
128 $out->addModuleStyles( [
129 'mediawiki.ui.input',
130 'mediawiki.ui.checkbox',
135 $feedType =
$request->getVal(
'feed' );
137 $this->
feed( $feedType );
142 $this->
addHelpLink(
'//meta.wikimedia.org/wiki/Special:MyLanguage/Help:Page_history',
true );
145 if ( !$this->page->exists() ) {
148 $out->setStatusCode( 404 );
150 $out->addWikiMsg(
'nohistory' );
154 # show deletion/move log if there is an entry
157 [
'delete',
'move',
'protect' ],
161 'conds' => [
'log_action != ' .
$dbr->addQuotes(
'revision' ) ],
162 'showIfEmpty' =>
false,
163 'msgKey' => [
'moveddeleted-notice' ]
174 $month =
$request->getInt(
'month' );
175 $tagFilter =
$request->getVal(
'tagfilter' );
181 if (
$request->getBool(
'deleted' ) ) {
182 $conds = [
'rev_deleted != 0' ];
186 if ( $this->
getUser()->isAllowed(
'deletedhistory' ) ) {
187 $checkDeleted = Xml::checkLabel( $this->
msg(
'history-show-deleted' )->
text(),
188 'deleted',
'mw-show-deleted-only',
$request->getBool(
'deleted' ) ) .
"\n";
194 $action = htmlspecialchars(
wfScript() );
195 $content = Html::hidden(
'title', $this->
getTitle()->getPrefixedDBkey() ) .
"\n";
196 $content .= Html::hidden(
'action',
'history' ) .
"\n";
197 $content .= Xml::dateMenu(
198 ( $year ==
null ? MWTimestamp::getLocalInstance()->
format(
'Y' ) : $year ),
201 $content .= $tagSelector ? ( implode(
' ', $tagSelector ) .
' ' ) :
'';
202 $content .= $checkDeleted . Html::submitButton(
203 $this->
msg(
'historyaction-submit' )->
text(),
205 [
'mw-ui-progressive' ]
208 "<form action=\"$action\" method=\"get\" id=\"mw-history-searchform\">" .
210 $this->
msg(
'history-fieldset-title' )->
text(),
212 [
'id' =>
'mw-history-search' ]
217 Hooks::run(
'PageHistoryBeforeList', [ &$this->page, $this->
getContext() ] );
220 $pager =
new HistoryPager( $this, $year, $month, $tagFilter, $conds );
222 $pager->getNavigationBar() .
224 $pager->getNavigationBar()
226 $out->preventClickjacking( $pager->getPreventClickjacking() );
247 if ( $direction === self::DIR_PREV ) {
254 $offsets = [
"rev_timestamp $oper " .
$dbr->addQuotes(
$dbr->timestamp( $offset ) ) ];
259 $page_id = $this->page->getId();
265 array_merge( [
'rev_page' => $page_id ], $offsets ),
268 'ORDER BY' =>
"rev_timestamp $dirs",
269 'USE INDEX' => [
'revision' =>
'page_timestamp' ],
287 $feedClasses = $this->context->getConfig()->get(
'FeedClasses' );
289 $feed =
new $feedClasses[
$type](
290 $this->
getTitle()->getPrefixedText() .
' - ' .
291 $this->
msg(
'history-feed-title' )->inContentLanguage()->text(),
292 $this->
msg(
'history-feed-description' )->inContentLanguage()->text(),
293 $this->
getTitle()->getFullURL(
'action=history' )
298 $limit =
$request->getInt(
'limit', 10 );
301 $this->context->getConfig()->get(
'FeedLimit' )
308 if ( $items->numRows() ) {
309 foreach ( $items as $row ) {
310 $feed->outItem( $this->
feedItem( $row ) );
320 $this->
msg(
'nohistory' )->inContentLanguage()->
text(),
321 $this->
msg(
'history-feed-empty' )->inContentLanguage()->parseAsBlock(),
325 $this->
getTitle()->getTalkPage()->getFullURL()
342 $this->
getTitle()->getPreviousRevisionID(
$rev->getId() ),
344 $rev->getTimestamp(),
347 if (
$rev->getComment() ==
'' ) {
349 $title = $this->
msg(
'history-feed-item-nocomment',
351 $wgContLang->timeanddate(
$rev->getTimestamp() ),
353 $wgContLang->time(
$rev->getTimestamp() ) )->inContentLanguage()->text();
355 $title =
$rev->getUserText() .
356 $this->
msg(
'colon-separator' )->inContentLanguage()->text() .
363 $this->
getTitle()->getFullURL(
'diff=' .
$rev->getId() .
'&oldid=prev' ),
364 $rev->getTimestamp(),
366 $this->getTitle()->getTalkPage()->getFullURL()
415 return $this->historyPage->getArticle();
419 if ( $this->conds ) {
420 return 'history page filtered';
422 return 'history page unfiltered';
427 $revQuery = Revision::getQueryInfo( [
'user' ] );
431 'conds' => array_merge(
434 'options' => [
'USE INDEX' => [
'revision' =>
'page_timestamp' ] ],
438 $queryInfo[
'tables'],
439 $queryInfo[
'fields'],
441 $queryInfo[
'join_conds'],
442 $queryInfo[
'options'],
447 $historyPager = $this;
448 Hooks::run(
'PageHistoryPager::getQueryInfo', [ &$historyPager, &$queryInfo ] );
454 return 'rev_timestamp';
462 if ( $this->lastRow ) {
464 $firstInList = $this->counter == 1;
467 $notifTimestamp = $this->
getConfig()->get(
'ShowUpdatedMarker' )
472 $this->lastRow, $row, $notifTimestamp, $latest, $firstInList );
476 $this->lastRow = $row;
482 if ( !Hooks::run(
'PageHistoryPager::doBatchLookups', [ $this, $this->mResult ] ) ) {
486 # Do a link batch query
487 $this->mResult->seek( 0 );
490 foreach ( $this->mResult as $row ) {
491 if ( $row->rev_parent_id ) {
492 $revIds[] = $row->rev_parent_id;
494 if ( !is_null( $row->user_name ) ) {
495 $batch->add( NS_USER, $row->user_name );
497 }
else { #
for anons or usernames of imported revisions
498 $batch->add( NS_USER, $row->rev_user_text );
502 $this->parentLens = Revision::getParentLengths( $this->mDb, $revIds );
504 $this->mResult->seek( 0 );
513 $this->lastRow =
false;
515 $this->oldIdChecked = 0;
517 $this->
getOutput()->wrapWikiMsg(
"<div class='mw-history-legend'>\n$1\n</div>",
'histlegend' );
518 $s = Html::openElement(
'form', [
'action' =>
wfScript(),
519 'id' =>
'mw-history-compare' ] ) .
"\n";
520 $s .= Html::hidden(
'title', $this->
getTitle()->getPrefixedDBkey() ) .
"\n";
521 $s .= Html::hidden(
'action',
'historysubmit' ) .
"\n";
522 $s .= Html::hidden(
'type',
'revision' ) .
"\n";
525 $this->buttons =
'<div>';
526 $className =
'historysubmit mw-history-compareselectedversions-button';
527 $attrs = [
'class' => $className ]
535 if ( $user->isAllowed(
'deleterevision' ) ) {
536 $actionButtons .= $this->
getRevisionButton(
'revisiondelete',
'showhideselectedversions' );
538 if ( $this->showTagEditUI ) {
539 $actionButtons .= $this->
getRevisionButton(
'editchangetags',
'history-edit-tags' );
541 if ( $actionButtons ) {
542 $this->buttons .= Xml::tags(
'div', [
'class' =>
543 'mw-history-revisionactions' ], $actionButtons );
546 if ( $user->isAllowed(
'deleterevision' ) || $this->showTagEditUI ) {
550 $this->buttons .=
'</div>';
553 $s .=
'<ul id="pagehistory">' .
"\n";
560 # Note bug #20966, <button> is non-standard in IE<8
561 $element = Html::element(
567 'class' =>
"historysubmit mw-history-$name-button",
575 if ( $this->lastRow ) {
577 $firstInList = $this->counter == 1;
578 if ( $this->mIsBackwards ) {
579 # Next row is unknown, but for UI reasons, probably exists if an offset has been specified
580 if ( $this->mOffset ==
'' ) {
586 # The next row is the past-the-end row
591 $notifTimestamp = $this->
getConfig()->get(
'ShowUpdatedMarker' )
596 $this->lastRow, $next, $notifTimestamp, $latest, $firstInList );
601 # Add second buttons only if there is more than one rev
618 # Disable submit button if history has 1 revision only
620 return Html::submitButton( $message, $attributes );
640 function historyLine( $row, $next, $notificationtimestamp =
false,
641 $latest =
false, $firstInList =
false ) {
644 if ( is_object( $next ) ) {
652 $curLastlinks = $curlink . $this->historyPage->message[
'pipe-separator'] . $lastlink;
653 $histLinks = Html::rawElement(
655 [
'class' =>
'mw-history-histlinks' ],
656 $this->
msg(
'parentheses' )->rawParams( $curLastlinks )->escaped()
660 $s = $histLinks . $diffButtons;
667 $canRevDelete = $user->isAllowed(
'deleterevision' );
670 if ( $canRevDelete || $this->showTagEditUI ) {
674 if ( !$this->showTagEditUI && !
$rev->userCan( Revision::DELETED_RESTRICTED, $user ) ) {
675 $del = Xml::check(
'deleterevisions',
false, [
'disabled' =>
'disabled' ] );
678 $del = Xml::check(
'showhiderevisions',
false,
679 [
'name' =>
'ids[' .
$rev->getId() .
']' ] );
682 } elseif (
$rev->getVisibility() && $user->isAllowed(
'deletedhistory' ) ) {
684 if ( !
$rev->userCan( Revision::DELETED_RESTRICTED, $user ) ) {
688 $query = [
'type' =>
'revision',
689 'target' => $this->
getTitle()->getPrefixedDBkey(),
'ids' =>
$rev->getId() ];
691 $rev->isDeleted( Revision::DELETED_RESTRICTED ),
false );
699 $dirmark =
$lang->getDirMark();
703 $s .=
" <span class='history-user'>" .
707 if (
$rev->isMinor() ) {
711 # Sometimes rev_len isn't populated
712 if (
$rev->getSize() !==
null ) {
713 # Size is always public data
714 $prevSize = isset( $this->parentLens[$row->rev_parent_id] )
715 ? $this->parentLens[$row->rev_parent_id]
719 $s .=
' <span class="mw-changeslist-separator">. .</span> ' .
"$fSize $sDiff";
722 # Text following the character difference is added just before running hooks
725 if ( $notificationtimestamp && ( $row->rev_timestamp >= $notificationtimestamp ) ) {
726 $s2 .=
' <span class="updatedmarker">' . $this->
msg(
'updatedmarker' )->escaped() .
'</span>';
727 $classes[] =
'mw-history-line-updated';
732 # Rollback and undo links
733 if ( $prevRev && $this->
getTitle()->quickUserCan(
'edit', $user ) ) {
734 if ( $latest && $this->
getTitle()->quickUserCan(
'rollback', $user ) ) {
739 [
'verify',
'noBrackets' ]
741 if ( $rollbackLink ) {
743 $tools[] = $rollbackLink;
747 if ( !
$rev->isDeleted( Revision::DELETED_TEXT )
748 && !$prevRev->isDeleted( Revision::DELETED_TEXT )
750 # Create undo tooltip for the first (=latest) line only
751 $undoTooltip = $latest
752 ? [
'title' => $this->
msg(
'tooltip-undo' )->text() ]
754 $undolink = MediaWikiServices::getInstance()->getLinkRenderer()->makeKnownLink(
756 $this->
msg(
'editundo' )->
text(),
760 'undoafter' => $prevRev->getId(),
761 'undo' =>
$rev->getId()
764 $tools[] =
"<span class=\"mw-history-undo\">{$undolink}</span>";
768 Hooks::run(
'HistoryRevisionTools', [
$rev, &$tools, $prevRev, $user ] );
771 $s2 .=
' ' . $this->
msg(
'parentheses' )->rawParams(
$lang->pipeList( $tools ) )->escaped();
780 $classes = array_merge( $classes, $newClasses );
781 if ( $tagSummary !==
'' ) {
782 $s2 .=
" $tagSummary";
785 # Include separator between character difference and following text
787 $s .=
' <span class="mw-changeslist-separator">. .</span> ' . $s2;
792 Hooks::run(
'PageHistoryLineEnding', [ $this, &$row, &
$s, &$classes, &
$attribs ] );
796 $attribs[
'class'] = implode(
' ', $classes );
799 return Xml::tags(
'li',
$attribs,
$s ) .
"\n";
809 $date = $this->
getLanguage()->userTimeAndDate(
$rev->getTimestamp(), $this->getUser() );
810 if (
$rev->userCan( Revision::DELETED_TEXT, $this->getUser() ) ) {
811 $link = MediaWikiServices::getInstance()->getLinkRenderer()->makeKnownLink(
814 [
'class' =>
'mw-changeslist-date' ],
815 [
'oldid' =>
$rev->getId() ]
818 $link = htmlspecialchars( $date );
820 if (
$rev->isDeleted( Revision::DELETED_TEXT ) ) {
821 $link =
"<span class=\"history-deleted\">$link</span>";
835 $cur = $this->historyPage->message[
'cur'];
836 if ( $latest || !
$rev->userCan( Revision::DELETED_TEXT, $this->getUser() ) ) {
839 return MediaWikiServices::getInstance()->getLinkRenderer()->makeKnownLink(
845 'oldid' =>
$rev->getId()
861 $last = $this->historyPage->message[
'last'];
863 if ( $next ===
null ) {
864 # Probably no next row
868 $linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer();
869 if ( $next ===
'unknown' ) {
870 # Next row probably exists but is unknown, use an oldid=prev link
876 'diff' => $prevRev->getId(),
884 if ( !$prevRev->userCan( Revision::DELETED_TEXT, $this->getUser() )
885 || !$nextRev->userCan( Revision::DELETED_TEXT, $this->getUser() )
895 'diff' => $prevRev->getId(),
896 'oldid' => $next->rev_id
912 $radio = [
'type' =>
'radio',
'value' => $id ];
914 if ( $firstInList ) {
915 $first = Xml::element(
'input',
916 array_merge( $radio, [
917 'style' =>
'visibility:hidden',
919 'id' =>
'mw-oldid-null' ] )
921 $checkmark = [
'checked' =>
'checked' ];
923 # Check visibility of old revisions
924 if ( !
$rev->userCan( Revision::DELETED_TEXT, $this->getUser() ) ) {
925 $radio[
'disabled'] =
'disabled';
927 } elseif ( !$this->oldIdChecked ) {
928 $checkmark = [
'checked' =>
'checked' ];
929 $this->oldIdChecked = $id;
933 $first = Xml::element(
'input',
934 array_merge( $radio, $checkmark, [
936 'id' =>
"mw-oldid-$id" ] ) );
939 $second = Xml::element(
'input',
940 array_merge( $radio, $checkmark, [
942 'id' =>
"mw-diff-$id" ] ) );
944 return $first . $second;
$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.
wfArrayFilterByKey(array $arr, callable $callback)
Like array_filter with ARRAY_FILTER_USE_KEY, but works pre-5.6.
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.
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.
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.
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 class mediates it Skin Encapsulates a look and feel for the wiki All of the functions that render HTML and make choices about how to render it are here and are called from various other places when and is meant to be subclassed with other skins that may override some of its functions The User object contains a reference to a and so rather than having a global skin object we just rely on the global User and get the skin with $wgUser and also has some character encoding functions and other locale stuff The current user interface language is instantiated as and the local content language as $wgContLang
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
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
if(!isset( $args[0])) $lang