58 return $this->
msg(
'history-title', $this->
getTitle()->getPrefixedText() )->text();
63 $linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer();
64 $subtitle = $linkRenderer->makeKnownLink(
66 $this->
msg(
'viewpagelogs' )->text(),
68 [
'page' => $this->
getTitle()->getPrefixedText() ]
76 . $this->
msg(
'word-separator' )->escaped()
77 . $this->
msg(
'parentheses' )
78 ->rawParams( $this->
getLanguage()->pipeList( $links ) )
81 return Html::rawElement(
'div', [
'class' =>
'mw-history-subtitle' ], $subtitle );
90 if ( !isset( $this->message ) ) {
92 $msgs = [
'cur',
'last',
'pipe-separator' ];
93 foreach ( $msgs as $msg ) {
94 $this->message[$msg] = $this->
msg( $msg )->escaped();
105 $year = $request->
getInt(
'year' );
106 $month = $request->
getInt(
'month' );
108 if ( $year !== 0 || $month !== 0 ) {
110 $year = MWTimestamp::getLocalInstance()->format(
'Y' );
112 if ( $month < 1 || $month > 12 ) {
117 $day = cal_days_in_month( CAL_GREGORIAN, $month, $year );
120 $month = str_pad( $month, 2,
"0", STR_PAD_LEFT );
121 $day = str_pad( $day, 2,
"0", STR_PAD_LEFT );
124 $before = $request->
getVal(
'date-range-to' );
126 $parts = explode(
'-', $before );
129 if ( count( $parts ) === 3 ) {
134 return $year && $month && $day ? $year .
'-' . $month .
'-' . $day :
'';
154 $out->checkLastModified( $this->getWikiPage()->getTouched() )
160 $config = $this->context->getConfig();
162 # Fill in the file cache if not set already
165 if ( !
$cache->isCacheGood( ) ) {
166 ob_start( [ &
$cache,
'saveToFileCache' ] );
171 $out->setFeedAppendQuery(
'action=history' );
172 $out->addModules(
'mediawiki.action.history' );
173 $out->addModuleStyles( [
174 'mediawiki.interface.helpers.styles',
175 'mediawiki.action.history.styles',
176 'mediawiki.special.changeslist',
178 if ( $config->get(
'UseMediaWikiUIEverywhere' ) ) {
180 $out->addModuleStyles( [
181 'mediawiki.ui.input',
182 'mediawiki.ui.checkbox',
187 $feedType = $request->getRawVal(
'feed' );
188 if ( $feedType !==
null ) {
189 $this->
feed( $feedType );
194 'https://meta.wikimedia.org/wiki/Special:MyLanguage/Help:Page_history',
202 $out->setStatusCode( 404 );
204 $out->addWikiMsg(
'nohistory' );
208 # show deletion/move log if there is an entry
209 LogEventsList::showLogExtract(
211 [
'delete',
'move',
'protect' ],
215 'conds' => [
'log_action != ' .
$dbr->addQuotes(
'revision' ) ],
216 'showIfEmpty' =>
false,
217 'msgKey' => [
'moveddeleted-notice' ]
225 $tagFilter = $request->getVal(
'tagfilter' );
230 if ( $request->getBool(
'deleted' ) ) {
231 $conds = [
'rev_deleted != 0' ];
241 'default' => $this->
getTitle()->getPrefixedDBkey(),
246 'default' =>
'history',
251 'label' => $this->
msg(
'date-range-to' )->text(),
252 'name' =>
'date-range-to',
255 'label-raw' => $this->
msg(
'tag-filter' )->parse(),
256 'type' =>
'tagfilter',
258 'name' =>
'tagfilter',
259 'value' => $tagFilter,
262 $permissionManager = MediaWikiServices::getInstance()->getPermissionManager();
263 if ( $permissionManager->userHasRight( $this->getUser(),
'deletedhistory' ) ) {
266 'label' => $this->
msg(
'history-show-deleted' )->text(),
267 'default' => $request->getBool(
'deleted' ),
277 ->setCollapsibleOptions(
true )
278 ->setId(
'mw-history-searchform' )
279 ->setSubmitText( $this->
msg(
'historyaction-submit' )->text() )
280 ->setWrapperAttributes( [
'id' =>
'mw-history-search' ] )
281 ->setWrapperLegend( $this->
msg(
'history-fieldset-title' )->text() );
282 $htmlForm->loadData();
284 $out->addHTML( $htmlForm->getHTML(
false ) );
292 $dateComponents = explode(
'-', $ts );
293 if ( count( $dateComponents ) > 1 ) {
294 $y = $dateComponents[0];
295 $m = $dateComponents[1];
296 $d = $dateComponents[2];
302 $pager =
new HistoryPager( $this, $y, $m, $tagFilter, $conds, $d );
304 $pager->getNavigationBar() .
306 $pager->getNavigationBar()
308 $out->preventClickjacking( $pager->getPreventClickjacking() );
318 $this->
getContext()->getConfig()->
get(
'ShowUpdatedMarker' ) &&
341 if ( $direction === self::DIR_PREV ) {
342 list( $dirs, $oper ) = [
"ASC",
">=" ];
344 list( $dirs, $oper ) = [
"DESC",
"<=" ];
348 $offsets = [
"rev_timestamp $oper " .
$dbr->addQuotes(
$dbr->timestamp( $offset ) ) ];
355 $revQuery = MediaWikiServices::getInstance()->getRevisionStore()->getQueryInfo();
359 array_merge( [
'rev_page' => $page_id ], $offsets ),
362 'ORDER BY' =>
"rev_timestamp $dirs",
363 'USE INDEX' => [
'revision' =>
'page_timestamp' ],
381 $feedClasses = $this->context->getConfig()->get(
'FeedClasses' );
383 $feed =
new $feedClasses[
$type](
384 $this->
getTitle()->getPrefixedText() .
' - ' .
385 $this->
msg(
'history-feed-title' )->inContentLanguage()->text(),
386 $this->
msg(
'history-feed-description' )->inContentLanguage()->text(),
387 $this->
getTitle()->getFullURL(
'action=history' )
392 $limit = $request->getInt(
'limit', 10 );
395 $this->context->getConfig()->get(
'FeedLimit' )
402 if ( $items->numRows() ) {
403 foreach ( $items as $row ) {
404 $feed->outItem( $this->
feedItem( $row ) );
414 $this->
msg(
'nohistory' )->inContentLanguage()->text(),
415 $this->
msg(
'history-feed-empty' )->inContentLanguage()->parseAsBlock(),
419 $this->
getTitle()->getTalkPage()->getFullURL()
432 $revisionStore = MediaWikiServices::getInstance()->getRevisionStore();
433 $rev = $revisionStore->newRevisionFromRow( $row, 0, $this->
getTitle() );
434 $prevRev = $revisionStore->getPreviousRevision( $rev );
435 $revComment = $rev->getComment() ===
null ? null : $rev->getComment()->text;
438 $prevRev ? $prevRev->getId() :
false,
440 $rev->getTimestamp(),
443 $revUserText = $rev->getUser() ? $rev->getUser()->getName() :
'';
444 if ( $revComment ==
'' ) {
445 $contLang = MediaWikiServices::getInstance()->getContentLanguage();
446 $title = $this->
msg(
'history-feed-item-nocomment',
448 $contLang->timeanddate( $rev->getTimestamp() ),
449 $contLang->date( $rev->getTimestamp() ),
450 $contLang->time( $rev->getTimestamp() )
451 )->inContentLanguage()->text();
454 $this->
msg(
'colon-separator' )->inContentLanguage()->text() .
455 FeedItem::stripComment( $revComment );
461 $this->
getTitle()->getFullURL(
'diff=' . $rev->getId() .
'&oldid=prev' ),
462 $rev->getTimestamp(),
464 $this->getTitle()->getTalkPage()->getFullURL()
$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.
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 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...
hasUnseenRevisionMarkers()
getTimestampFromRequest(WebRequest $request)
getDescription()
Returns the description that goes below the <h1> tag.
requiresUnblock()
Whether this action can still be executed by a blocked user.
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 scalar from the input or return $default if it's not set.
getInt( $name, $default=0)
Fetch an integer value from the input or return $default if not set.