Go to the documentation of this file.
56 return $this->
msg(
'history-title', $this->
getTitle()->getPrefixedText() )->text();
63 $this->
msg(
'viewpagelogs' )->escaped(),
83 if ( !isset( $this->
message ) ) {
84 $msgs =
array(
'cur',
'last',
'pipe-separator' );
85 foreach ( $msgs
as $msg ) {
86 $this->
message[$msg] = $this->
msg( $msg )->escaped();
95 global $wgScript, $wgUseFileCache;
103 if (
$out->checkLastModified( $this->page->getTouched() ) ) {
111 # Fill in the file cache if not set already
114 if ( !
$cache->isCacheGood( ) ) {
120 $out->setFeedAppendQuery(
'action=history' );
121 $out->addModules(
'mediawiki.action.history' );
124 $feedType = $request->getVal(
'feed' );
126 $this->
feed( $feedType );
133 if ( !$this->
page->exists() ) {
134 $out->addWikiMsg(
'nohistory' );
135 # show deletion/move log if there is an entry
138 array(
'delete',
'move' ),
142 'conds' =>
array(
"log_action != 'revision'" ),
143 'showIfEmpty' =>
false,
144 'msgKey' =>
array(
'moveddeleted-notice' )
155 $year = $request->getInt(
'year' );
156 $month = $request->getInt(
'month' );
157 $tagFilter = $request->getVal(
'tagfilter' );
163 if ( $request->getBool(
'deleted' ) ) {
164 $conds =
array(
'rev_deleted != 0' );
168 if ( $this->
getUser()->isAllowed(
'deletedhistory' ) ) {
170 'deleted',
'mw-show-deleted-only', $request->getBool(
'deleted' ) ) .
"\n";
176 $action = htmlspecialchars( $wgScript );
178 "<form action=\"$action\" method=\"get\" id=\"mw-history-searchform\">" .
180 $this->
msg(
'history-fieldset-title' )->
text(),
182 array(
'id' =>
'mw-history-search' )
190 ( $tagSelector ? ( implode(
' ', $tagSelector ) .
' ' ) :
'' ) .
199 $pager =
new HistoryPager( $this, $year, $month, $tagFilter, $conds );
201 $pager->getNavigationBar() .
203 $pager->getNavigationBar()
205 $out->preventClickjacking( $pager->getPreventClickjacking() );
235 $offsets =
array(
"rev_timestamp $oper " .
$dbr->addQuotes(
$dbr->timestamp( $offset ) ) );
240 $page_id = $this->
page->getId();
242 return $dbr->select(
'revision',
244 array_merge(
array(
'rev_page' => $page_id ), $offsets ),
246 array(
'ORDER BY' =>
"rev_timestamp $dirs",
247 'USE INDEX' =>
'page_timestamp',
'LIMIT' =>
$limit )
257 global $wgFeedClasses, $wgFeedLimit;
264 $feed =
new $wgFeedClasses[
$type](
265 $this->
getTitle()->getPrefixedText() .
' - ' .
266 $this->
msg(
'history-feed-title' )->inContentLanguage()->text(),
267 $this->
msg(
'history-feed-description' )->inContentLanguage()->text(),
268 $this->
getTitle()->getFullURL(
'action=history' )
273 $limit = $request->getInt(
'limit', 10 );
280 if ( $items->numRows() ) {
281 foreach ( $items
as $row ) {
282 $feed->outItem( $this->
feedItem( $row ) );
292 $this->
msg(
'nohistory' )->inContentLanguage()->
text(),
293 $this->
msg(
'history-feed-empty' )->inContentLanguage()->parseAsBlock(),
297 $this->
getTitle()->getTalkPage()->getFullURL()
314 $this->
getTitle()->getPreviousRevisionID(
$rev->getId() ),
316 $rev->getTimestamp(),
319 if (
$rev->getComment() ==
'' ) {
321 $title = $this->
msg(
'history-feed-item-nocomment',
323 $wgContLang->timeanddate(
$rev->getTimestamp() ),
325 $wgContLang->time(
$rev->getTimestamp() ) )->inContentLanguage()->text();
328 $this->
msg(
'colon-separator' )->inContentLanguage()->text() .
335 $this->
getTitle()->getFullURL(
'diff=' .
$rev->getId() .
'&oldid=prev' ),
336 $rev->getTimestamp(),
338 $this->
getTitle()->getTalkPage()->getFullURL()
373 $this->tagFilter = $tagFilter;
380 return $this->historyPage->getArticle();
384 if ( $this->conds ) {
385 return 'history page filtered';
387 return 'history page unfiltered';
393 'tables' =>
array(
'revision',
'user' ),
395 'conds' => array_merge(
398 'options' =>
array(
'USE INDEX' =>
array(
'revision' =>
'page_timestamp' ) ),
402 $queryInfo[
'tables'],
403 $queryInfo[
'fields'],
405 $queryInfo[
'join_conds'],
406 $queryInfo[
'options'],
409 wfRunHooks(
'PageHistoryPager::getQueryInfo',
array( &$this, &$queryInfo ) );
415 return 'rev_timestamp';
423 if ( $this->lastRow ) {
425 $firstInList = $this->counter == 1;
428 $this->
getTitle()->getNotificationTimestamp( $this->
getUser() ), $latest, $firstInList );
432 $this->lastRow = $row;
438 # Do a link batch query
439 $this->mResult->seek( 0 );
442 foreach ( $this->mResult
as $row ) {
443 if ( $row->rev_parent_id ) {
444 $revIds[] = $row->rev_parent_id;
446 if ( !is_null( $row->user_name ) ) {
449 }
else { #
for anons or usernames
of imported revisions
456 $this->mResult->seek( 0 );
466 $this->lastRow =
false;
468 $this->oldIdChecked = 0;
470 $this->
getOutput()->wrapWikiMsg(
"<div class='mw-history-legend'>\n$1\n</div>",
'histlegend' );
472 'id' =>
'mw-history-compare' ) ) .
"\n";
477 $this->buttons =
'<div>';
479 array(
'class' =>
'historysubmit mw-history-compareselectedversions-button' )
483 if ( $this->
getUser()->isAllowed(
'deleterevision' ) ) {
484 $this->buttons .= $this->
getRevisionButton(
'revisiondelete',
'showhideselectedversions' );
486 $this->buttons .=
'</div>';
489 $s .=
'<ul id="pagehistory">' .
"\n";
496 # Note bug #20966, <button> is non-standard in IE<8
503 'class' =>
"historysubmit mw-history-$name-button",
511 if ( $this->lastRow ) {
513 $firstInList = $this->counter == 1;
514 if ( $this->mIsBackwards ) {
515 # Next row is unknown, but for UI reasons, probably exists if an offset has been specified
516 if ( $this->mOffset ==
'' ) {
522 # The next row is the past-the-end row
527 $this->
getTitle()->getNotificationTimestamp( $this->
getUser() ), $latest, $firstInList );
532 # Add second buttons only if there is more than one rev
549 # Disable submit button if history has 1 revision only
571 function historyLine( $row, $next, $notificationtimestamp =
false,
572 $latest =
false, $firstInList =
false ) {
576 if ( is_object( $next ) ) {
578 $prevRev->setTitle( $this->
getTitle() );
585 $curLastlinks = $curlink . $this->historyPage->message[
'pipe-separator'] . $lastlink;
588 array(
'class' =>
'mw-history-histlinks' ),
589 $this->
msg(
'parentheses' )->rawParams( $curLastlinks )->escaped()
593 $s = $histLinks . $diffButtons;
601 if (
$user->isAllowed(
'deleterevision' ) ) {
605 $del =
Xml::check(
'deleterevisions',
false,
array(
'disabled' =>
'disabled' ) );
608 $del =
Xml::check(
'showhiderevisions',
false,
609 array(
'name' =>
'ids[' .
$rev->getId() .
']' ) );
612 } elseif (
$rev->getVisibility() &&
$user->isAllowed(
'deletedhistory' ) ) {
619 'target' => $this->
getTitle()->getPrefixedDBkey(),
'ids' =>
$rev->getId() );
629 $dirmark = $lang->getDirMark();
633 $s .=
" <span class='history-user'>" .
637 if (
$rev->isMinor() ) {
641 # Sometimes rev_len isn't populated
642 if (
$rev->getSize() !== null ) {
643 # Size is always public data
644 $prevSize = isset( $this->parentLens[$row->rev_parent_id] )
645 ? $this->parentLens[$row->rev_parent_id]
649 $s .=
' <span class="mw-changeslist-separator">. .</span> ' .
"$fSize $sDiff";
652 # Text following the character difference is added just before running hooks
655 if ( $notificationtimestamp && ( $row->rev_timestamp >= $notificationtimestamp ) ) {
656 $s2 .=
' <span class="updatedmarker">' . $this->
msg(
'updatedmarker' )->escaped() .
'</span>';
657 $classes[] =
'mw-history-line-updated';
662 # Rollback and undo links
663 if ( $prevRev && $this->
getTitle()->quickUserCan(
'edit',
$user ) ) {
664 if ( $latest && $this->
getTitle()->quickUserCan(
'rollback',
$user ) ) {
669 array(
'verify',
'noBrackets' )
671 if ( $rollbackLink ) {
680 # Create undo tooltip for the first (=latest) line only
681 $undoTooltip = $latest
682 ?
array(
'title' => $this->
msg(
'tooltip-undo' )->
text() )
686 $this->
msg(
'editundo' )->escaped(),
690 'undoafter' => $prevRev->getId(),
691 'undo' =>
$rev->getId()
694 $tools[] =
"<span class=\"mw-history-undo\">{$undolink}</span>";
701 $s2 .=
' ' . $this->
msg(
'parentheses' )->rawParams( $lang->pipeList(
$tools ) )->escaped();
706 $classes = array_merge( $classes, $newClasses );
707 if ( $tagSummary !==
'' ) {
708 $s2 .=
" $tagSummary";
711 # Include separator between character difference and following text
713 $s .=
' <span class="mw-changeslist-separator">. .</span> ' . $s2;
720 $attribs[
'class'] = implode(
' ', $classes );
734 $date = htmlspecialchars( $date );
739 array(
'class' =>
'mw-changeslist-date' ),
746 $link =
"<span class=\"history-deleted\">$link</span>";
760 $cur = $this->historyPage->message[
'cur'];
770 'oldid' =>
$rev->getId()
783 function lastLink( $prevRev, $next ) {
784 $last = $this->historyPage->message[
'last'];
785 # $next may either be a Row, null, or "unkown"
786 $nextRev = is_object( $next ) ?
new Revision( $next ) : $next;
787 if ( is_null( $next ) ) {
788 # Probably no next row
790 } elseif ( $next ===
'unknown' ) {
791 # Next row probably exists but is unknown, use an oldid=prev link
797 'diff' => $prevRev->getId(),
811 'diff' => $prevRev->getId(),
812 'oldid' => $next->rev_id
829 $radio =
array(
'type' =>
'radio',
'value' => $id );
831 if ( $firstInList ) {
833 array_merge( $radio,
array(
834 'style' =>
'visibility:hidden',
836 'id' =>
'mw-oldid-null' ) )
838 $checkmark =
array(
'checked' =>
'checked' );
840 # Check visibility of old revisions
842 $radio[
'disabled'] =
'disabled';
843 $checkmark =
array();
844 } elseif ( !$this->oldIdChecked ) {
845 $checkmark =
array(
'checked' =>
'checked' );
846 $this->oldIdChecked = $id;
848 $checkmark =
array();
851 array_merge( $radio, $checkmark,
array(
853 'id' =>
"mw-oldid-$id" ) ) );
854 $checkmark =
array();
857 array_merge( $radio, $checkmark,
array(
859 'id' =>
"mw-diff-$id" ) ) );
861 return $first . $second;
Backwards-compatibility alias.
array $message
Array of message keys and strings *.
static checkLabel( $label, $name, $id, $checked=false, $attribs=array())
Convenience function to build an HTML checkbox with a label.
Overloads the relevant methods of the real ResultsWrapper so it doesn't go anywhere near an actual da...
Abstract class for type hinting (accepts WikiPage, Article, ImagePage, CategoryPage)
static generateRollback( $rev, IContextSource $context=null, $options=array( 'verify'))
Generate a rollback link for a given revision.
A base class for basic support for outputting syndication feeds in RSS and other formats.
getContext()
Get the RequestContext object.
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
static revDeleteLink( $query=array(), $restricted=false, $delete=true)
Creates a (show/hide) link for deleting revisions/log entries.
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
msg()
Get a Message object with context set Parameters are the same as wfMessage()
Class representing a list of titles The execute() method checks them all for existence and adds them ...
static tags( $element, $attribs=null, $contents)
Same as Xml::element(), but does not escape contents.
getRequest()
Get the WebRequest being used for this instance.
onView()
Print the history page for an article.
feedItem( $row)
Generate a FeedItem object from a given revision table row Borrows Recent Changes' feed generation fu...
requiresWrite()
Whether this action requires the wiki not to be locked.
& wfGetDB( $db, $groups=array(), $wiki=false)
Get a Database object.
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
getPageTitle()
Returns the name that goes in the <h1> page title.
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
static formatDiffRow( $title, $oldid, $newid, $timestamp, $comment, $actiontext='')
Really format a diff for the newsfeed.
wfProfileIn( $functionname)
Begin profiling of a function.
static stripComment( $text)
Quickie hack...
fetchRevisions( $limit, $offset, $direction)
Fetch an array of revisions, specified by a given limit, offset and direction.
static getTitleFor( $name, $subpage=false, $fragment='')
Get a localised Title object for a specified special page name.
static hidden( $name, $value, $attribs=array())
Convenience function to produce an input element with type=hidden.
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 content language as $wgContLang
getDescription()
Returns the description that goes below the <h1> tag.
getUser()
Get the User object.
set to $title object and return false for a match for latest after cache objects are set use the ContentHandler facility to handle CSS and JavaScript for highlighting & $link
getTitle()
Get the Title object.
static linkKnown( $target, $html=null, $customAttribs=array(), $query=array(), $options=array( 'known', 'noclasses'))
Identical to link(), except $options defaults to 'known'.
static flag( $flag)
Provide the "<abbr>" element appropriate to a given abbreviated flag, namely the flag indicating a ne...
getLanguage()
Get the Language object.
static tooltipAndAccesskeyAttribs( $name)
Returns the attributes for the tooltip and access key.
getContext()
Get the IContextSource in use here.
static openElement( $element, $attribs=array())
Identical to rawElement(), but has no third parameter and omits the end tag (and the self-closing '/'...
static element( $element, $attribs=array(), $contents='')
Identical to rawElement(), but HTML-escapes $contents (like Xml::element()).
This class handles printing the history page for an article.
static useFileCache(IContextSource $context)
Check if pages can be cached for this request/user.
preCacheMessages()
As we use the same small set of messages in various methods and that they are called often,...
static revUserTools( $rev, $isPublic=false)
Generate a user tool link cluster if the current user is allowed to view it.
getOutput()
Get the OutputPage object.
getWikiPage()
Get the WikiPage object.
wfProfileOut( $functionname='missing')
Stop profiling of a function.
static element( $element, $attribs=null, $contents='', $allowShortTag=true)
Format an XML element with given attributes and, optionally, text content.
wfRunHooks( $event, array $args=array(), $deprecatedVersion=null)
Call hook functions defined in $wgHooks.
static revDeleteLinkDisabled( $delete=true)
Creates a dead (show/hide) link for deleting revisions/log entries.
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
when a variable name is used in a it is silently declared as a new masking the global
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
processing should stop and the error should be shown to the user * false
__construct(Page $article)
const TS_MW
MediaWiki concatenated string timestamp (YYYYMMDDHHMMSS)
getUser()
Shortcut to get the User being used for this instance.
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.
presenting them properly to the user as errors is done by the caller $title
Allows to change the fields on the form that will be generated $name
static check( $name, $checked=false, $attribs=array())
Convenience function to build an HTML checkbox.
static getParentLengths( $db, array $revIds)
Do a batched query to get the parent revision lengths.
static configuration should be added through ResourceLoaderGetConfigVars instead can be used to get the real title after the basic globals have been set but before ordinary actions take place change it to the message you want to define which works for all SkinTemplate type skins $tools
static newFromTitle( $title, $action)
Construct an ObjectFileCache from a Title and an action.
static formatRevisionSize( $size)
static showCharacterDifference( $old, $new, IContextSource $context=null)
Show formatted char difference.
getTitle()
Shortcut to get the Title object from the page.
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
getName()
Return the name of the action this object responds to.
msg()
Get a Message object with context set Parameters are the same as wfMessage()
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
static exists( $name)
Check if a given action is recognised, even if it's disabled.
WikiPage Article ImagePage CategoryPage Page $page
Page on which we're performing the action $page.
requiresUnblock()
Whether this action can still be executed by a blocked user.
if the prop value should be in the metadata multi language array format
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
static dateMenu( $year, $month)
static userJoinCond()
Return the value of a select() JOIN conds array for the user table.
feed( $type)
Output a subscription feed listing recent edits to this page.
getOutput()
Get the OutputPage being used for this instance.
static submitButton( $value, $attribs=array())
Convenience function to build an HTML submit button.
static checkFeedOutput( $type)
Check whether feeds can be used and that $type is a valid feed type.
static selectUserFields()
Return the list of user fields that should be selected from user table.
static rawElement( $element, $attribs=array(), $contents='')
Returns an HTML element in a string.
static selectFields()
Return the list of revision fields that should be selected to create a new revision.
return true to allow those checks to and false if checking is done use this to change the tables headers temp or archived zone change it to an object instance and return false override the list derivative used the name of the old file when set the default code will be skipped 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 & $attribs
Using a hook running we can avoid having all this option specific stuff in our mainline code Using the function array $article
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 externallinks including delete and has completed for all link tables default is conds Array Extra conditions for the No matching items in log is displayed if loglist is empty msgKey Array If you want a nice box with a message
getArticle()
Get the Article object we are working on.
static getLocalInstance( $ts=false)
Get a timestamp instance in the server local timezone ($wgLocaltimezone)
static fieldset( $legend=false, $content=false, $attribs=array())
Shortcut for creating fieldsets.
static showLogExtract(&$out, $types=array(), $page='', $user='', $param=array())
Show log extract.
do that in ParserLimitReportFormat instead use this to modify the parameters of the image and a DIV can begin in one section and end in another Make sure your code can handle that case gracefully See the EditSectionClearerLink extension for an example zero but section is usually empty its values are the globals values my talk page