59 return $this->
msg(
'history-title', $this->
getTitle()->getPrefixedText() )->text();
64 $linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer();
65 $subtitle = $linkRenderer->makeKnownLink(
67 $this->
msg(
'viewpagelogs' )->text(),
69 [
'page' => $this->
getTitle()->getPrefixedText() ]
77 . $this->
msg(
'word-separator' )->escaped()
78 . $this->
msg(
'parentheses' )
79 ->rawParams( $this->
getLanguage()->pipeList( $links ) )
82 return Html::rawElement(
'div', [
'class' =>
'mw-history-subtitle' ], $subtitle );
91 if ( !isset( $this->message ) ) {
93 $msgs = [
'cur',
'tooltip-cur',
'last',
'tooltip-last',
'pipe-separator' ];
94 foreach ( $msgs as $msg ) {
95 $this->message[$msg] = $this->
msg( $msg )->escaped();
106 $year = $request->
getInt(
'year' );
107 $month = $request->
getInt(
'month' );
109 if ( $year !== 0 || $month !== 0 ) {
113 if ( $month < 1 || $month > 12 ) {
118 $day = cal_days_in_month( CAL_GREGORIAN, $month, $year );
121 $month = str_pad( (
string)$month, 2,
"0", STR_PAD_LEFT );
122 $day = str_pad( (
string)$day, 2,
"0", STR_PAD_LEFT );
125 $before = $request->
getVal(
'date-range-to' );
127 $parts = explode(
'-', $before );
130 if ( count( $parts ) === 3 ) {
135 return $year && $month && $day ? $year .
'-' . $month .
'-' . $day :
'';
145 $config = $this->context->getConfig();
146 $services = MediaWikiServices::getInstance();
156 $hasUnseenRevisionMarkers = $config->get( MainConfigNames::ShowUpdatedMarker ) &&
162 !$hasUnseenRevisionMarkers &&
163 $out->checkLastModified( $this->getWikiPage()->getTouched() )
170 # Fill in the file cache if not set already
173 if ( !
$cache->isCacheGood( ) ) {
174 ob_start( [ &
$cache,
'saveToFileCache' ] );
179 $out->setFeedAppendQuery(
'action=history' );
180 $out->addModules(
'mediawiki.action.history' );
181 $out->addModuleStyles( [
182 'mediawiki.interface.helpers.styles',
183 'mediawiki.action.history.styles',
184 'mediawiki.special.changeslist',
186 if ( $config->get( MainConfigNames::UseMediaWikiUIEverywhere ) ) {
187 $out->addModuleStyles( [
188 'mediawiki.ui.input',
189 'mediawiki.ui.checkbox',
194 $feedType = $request->getRawVal(
'feed' );
195 if ( $feedType !==
null ) {
196 $this->
feed( $feedType );
201 'https://meta.wikimedia.org/wiki/Special:MyLanguage/Help:Page_history',
207 $send404Code = $config->get( MainConfigNames::Send404Code );
208 if ( $send404Code ) {
209 $out->setStatusCode( 404 );
211 $out->addWikiMsg(
'nohistory' );
215 # show deletion/move log if there is an entry
218 [
'delete',
'move',
'protect' ],
222 'conds' => [
'log_action != ' .
$dbr->addQuotes(
'revision' ) ],
223 'showIfEmpty' =>
false,
224 'msgKey' => [
'moveddeleted-notice' ]
232 $tagFilter = $request->getVal(
'tagfilter' );
237 if ( $request->getBool(
'deleted' ) ) {
238 $conds = [
'rev_deleted != 0' ];
248 'default' =>
'history',
253 'label' => $this->
msg(
'date-range-to' )->text(),
254 'name' =>
'date-range-to',
257 'label-message' =>
'tag-filter',
258 'type' =>
'tagfilter',
260 'name' =>
'tagfilter',
261 'value' => $tagFilter,
267 'label' => $this->
msg(
'history-show-deleted' )->text(),
268 'default' => $request->getBool(
'deleted' ),
278 ->setCollapsibleOptions(
true )
279 ->setId(
'mw-history-searchform' )
280 ->setSubmitTextMsg(
'historyaction-submit' )
281 ->setWrapperAttributes( [
'id' =>
'mw-history-search' ] )
282 ->setWrapperLegendMsg(
'history-fieldset-title' )
285 $out->addHTML( $htmlForm->getHTML(
false ) );
293 $dateComponents = explode(
'-', $ts );
294 if ( count( $dateComponents ) > 1 ) {
295 $y = (int)$dateComponents[0];
296 $m = (int)$dateComponents[1];
297 $d = (int)$dateComponents[2];
310 $services->getLinkBatchFactory(),
312 $services->getCommentFormatter()
315 $pager->getNavigationBar() .
317 $pager->getNavigationBar()
319 $out->setPreventClickjacking( $pager->getPreventClickjacking() );
342 if ( $direction === self::DIR_PREV ) {
343 list(
$dirs, $oper ) = [
"ASC",
">=" ];
345 list(
$dirs, $oper ) = [
"DESC",
"<=" ];
349 $offsets = [
"rev_timestamp $oper " .
$dbr->addQuotes(
$dbr->timestamp( $offset ) ) ];
356 $revQuery = MediaWikiServices::getInstance()->getRevisionStore()->getQueryInfo();
358 $revIndex =
$dbr->indexExists(
'revision',
'page_timestamp', __METHOD__ )
360 :
'rev_page_timestamp';
364 array_merge( [
'rev_page' => $page_id ], $offsets ),
367 'ORDER BY' =>
"rev_timestamp $dirs",
368 'USE INDEX' => [
'revision' => $revIndex ],
386 $feedClasses = $this->context->getConfig()->get( MainConfigNames::FeedClasses );
388 $feed =
new $feedClasses[
$type](
389 $this->
getTitle()->getPrefixedText() .
' - ' .
390 $this->
msg(
'history-feed-title' )->inContentLanguage()->text(),
391 $this->
msg(
'history-feed-description' )->inContentLanguage()->text(),
392 $this->
getTitle()->getFullURL(
'action=history' )
397 $limit = $request->getInt(
'limit', 10 );
400 $this->context->getConfig()->get( MainConfigNames::FeedLimit )
406 $formattedComments = MediaWikiServices::getInstance()->getRowCommentFormatter()
407 ->formatRows( $items,
'rev_comment' );
411 if ( $items->numRows() ) {
412 foreach ( $items as $i => $row ) {
413 $feed->outItem( $this->
feedItem( $row, $formattedComments[$i] ) );
423 $this->
msg(
'nohistory' )->inContentLanguage()->text(),
424 $this->
msg(
'history-feed-empty' )->inContentLanguage()->parseAsBlock(),
428 $this->
getTitle()->getTalkPage()->getFullURL()
441 private function feedItem( $row, $formattedComment ) {
442 $revisionStore = MediaWikiServices::getInstance()->getRevisionStore();
443 $rev = $revisionStore->newRevisionFromRow( $row, 0, $this->
getTitle() );
444 $prevRev = $revisionStore->getPreviousRevision( $rev );
445 $revComment = $rev->getComment() ===
null ? null : $rev->getComment()->text;
448 $prevRev ? $prevRev->getId() :
false,
450 $rev->getTimestamp(),
453 $revUserText = $rev->getUser() ? $rev->getUser()->getName() :
'';
454 if ( $revComment ==
'' ) {
455 $contLang = MediaWikiServices::getInstance()->getContentLanguage();
456 $title = $this->
msg(
'history-feed-item-nocomment',
458 $contLang->timeanddate( $rev->getTimestamp() ),
459 $contLang->date( $rev->getTimestamp() ),
460 $contLang->time( $rev->getTimestamp() )
461 )->inContentLanguage()->text();
464 $this->
msg(
'colon-separator' )->inContentLanguage()->text() .
471 $this->
getTitle()->getFullURL(
'diff=' . $rev->getId() .
'&oldid=prev' ),
472 $rev->getTimestamp(),
474 $this->getTitle()->getTalkPage()->getFullURL()
WatchlistManager $watchlistManager
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.
getWikiPage()
Get a WikiPage object.
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.
getUser()
Shortcut to get the User being used for this instance.
static exists(string $name)
Check if a given action is recognised, even if it's disabled.
getArticle()
Get a Article object.
msg( $key,... $params)
Get a Message object with context set Parameters are the same as wfMessage()
array $fields
The fields used to create the HTMLForm.
getLanguage()
Shortcut to get the user Language being used for this instance.
getRequest()
Get the WebRequest being used for this instance.
A base class for outputting syndication feeds (e.g.
static stripComment( $text)
Quickie hack...
static formatDiffRow2( $title, $oldid, $newid, $timestamp, $formattedComment, $actiontext='')
Really really format a diff for the newsfeed.
static checkFeedOutput( $type, $output=null)
Check whether feeds can be used and that $type is a valid feed type.
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,...
feedItem( $row, $formattedComment)
Generate a FeedItem object from a given revision table row Borrows Recent Changes' feed generation fu...
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.
getTimestampFromRequest(WebRequest $request)
getDescription()
Returns the description that goes below the <h1> element.
requiresUnblock()
Whether this action can still be executed by a blocked user.
static rawElement( $element, $attribs=[], $contents='')
Returns an HTML element in a string.
static showLogExtract(&$out, $types=[], $page='', $user='', $param=[])
Show log extract.
static getLocalInstance( $ts=false)
Get a timestamp instance in the server local timezone ($wgLocaltimezone)
A class containing constants representing the names of configuration variables.
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,...
The WebRequest class encapsulates getting at data passed in the URL or via a POSTed form stripping il...
getVal( $name, $default=null)
Fetch a text string and partially normalized it.
getInt( $name, $default=0)
Fetch an integer value from the input or return $default if not set.