Go to the documentation of this file.
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 );
97 if ( !isset( $this->message ) ) {
99 $msgs = [
'cur',
'last',
'pipe-separator' ];
100 foreach ( $msgs as $msg ) {
101 $this->message[$msg] = $this->
msg( $msg )->escaped();
112 $year = $request->
getInt(
'year' );
113 $month = $request->
getInt(
'month' );
115 if ( $year !== 0 || $month !== 0 ) {
119 if ( $month < 1 || $month > 12 ) {
124 $day = cal_days_in_month( CAL_GREGORIAN, $month, $year );
127 $month = str_pad( $month, 2,
"0", STR_PAD_LEFT );
128 $day = str_pad( $day, 2,
"0", STR_PAD_LEFT );
131 $before = $request->
getVal(
'date-range-to' );
133 $parts = explode(
'-', $before );
136 if ( count( $parts ) === 3 ) {
141 return $year && $month && $day ? $year .
'-' . $month .
'-' . $day :
'';
161 $out->checkLastModified( $this->page->getTouched() )
167 $config = $this->context->getConfig();
169 # Fill in the file cache if not set already
172 if ( !
$cache->isCacheGood( ) ) {
173 ob_start( [ &
$cache,
'saveToFileCache' ] );
178 $out->setFeedAppendQuery(
'action=history' );
179 $out->addModules(
'mediawiki.action.history' );
180 $out->addModuleStyles( [
181 'mediawiki.interface.helpers.styles',
182 'mediawiki.action.history.styles',
183 'mediawiki.special.changeslist',
185 if ( $config->get(
'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',
206 if ( !$this->page->exists() ) {
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' => $this->
getTitle()->getPrefixedDBkey(),
253 'default' =>
'history',
258 'label' => $this->
msg(
'date-range-to' )->text(),
259 'name' =>
'date-range-to',
262 'label-raw' => $this->
msg(
'tag-filter' )->parse(),
263 'type' =>
'tagfilter',
265 'name' =>
'tagfilter',
266 'value' => $tagFilter,
269 $permissionManager = MediaWikiServices::getInstance()->getPermissionManager();
270 if ( $permissionManager->userHasRight( $this->getUser(),
'deletedhistory' ) ) {
273 'label' => $this->
msg(
'history-show-deleted' )->text(),
274 'default' => $request->getBool(
'deleted' ),
284 ->setCollapsibleOptions(
true )
285 ->setId(
'mw-history-searchform' )
286 ->setSubmitText( $this->
msg(
'historyaction-submit' )->text() )
287 ->setWrapperAttributes( [
'id' =>
'mw-history-search' ] )
288 ->setWrapperLegend( $this->
msg(
'history-fieldset-title' )->text() );
289 $htmlForm->loadData();
291 $out->addHTML( $htmlForm->getHTML(
false ) );
296 $dateComponents = explode(
'-', $ts );
297 if ( count( $dateComponents ) > 1 ) {
298 $y = $dateComponents[0];
299 $m = $dateComponents[1];
300 $d = $dateComponents[2];
306 $pager =
new HistoryPager( $this, $y, $m, $tagFilter, $conds, $d );
308 $pager->getNavigationBar() .
310 $pager->getNavigationBar()
312 $out->preventClickjacking( $pager->getPreventClickjacking() );
322 $this->
getContext()->getConfig()->
get(
'ShowUpdatedMarker' ) &&
345 if ( $direction === self::DIR_PREV ) {
346 list(
$dirs, $oper ) = [
"ASC",
">=" ];
348 list(
$dirs, $oper ) = [
"DESC",
"<=" ];
352 $offsets = [
"rev_timestamp $oper " .
$dbr->addQuotes(
$dbr->timestamp( $offset ) ) ];
357 $page_id = $this->page->getId();
363 array_merge( [
'rev_page' => $page_id ], $offsets ),
366 'ORDER BY' =>
"rev_timestamp $dirs",
367 'USE INDEX' => [
'revision' =>
'page_timestamp' ],
385 $feedClasses = $this->context->getConfig()->get(
'FeedClasses' );
387 $feed =
new $feedClasses[
$type](
388 $this->
getTitle()->getPrefixedText() .
' - ' .
389 $this->
msg(
'history-feed-title' )->inContentLanguage()->text(),
390 $this->
msg(
'history-feed-description' )->inContentLanguage()->text(),
391 $this->
getTitle()->getFullURL(
'action=history' )
396 $limit = $request->getInt(
'limit', 10 );
399 $this->context->getConfig()->get(
'FeedLimit' )
406 if ( $items->numRows() ) {
407 foreach ( $items as $row ) {
408 $feed->outItem( $this->
feedItem( $row ) );
418 $this->
msg(
'nohistory' )->inContentLanguage()->text(),
419 $this->
msg(
'history-feed-empty' )->inContentLanguage()->parseAsBlock(),
423 $this->
getTitle()->getTalkPage()->getFullURL()
436 $revisionStore = MediaWikiServices::getInstance()->getRevisionStore();
437 $rev = $revisionStore->newRevisionFromRow( $row, 0, $this->
getTitle() );
438 $prevRev = $revisionStore->getPreviousRevision( $rev );
439 $revComment = $rev->getComment() ===
null ? null : $rev->getComment()->text;
442 $prevRev ? $prevRev->getId() :
false,
444 $rev->getTimestamp(),
447 $revUserText = $rev->getUser() ? $rev->getUser()->getName() :
'';
448 if ( $revComment ==
'' ) {
449 $contLang = MediaWikiServices::getInstance()->getContentLanguage();
450 $title = $this->
msg(
'history-feed-item-nocomment',
452 $contLang->timeanddate( $rev->getTimestamp() ),
453 $contLang->date( $rev->getTimestamp() ),
454 $contLang->time( $rev->getTimestamp() )
455 )->inContentLanguage()->text();
458 $this->
msg(
'colon-separator' )->inContentLanguage()->text() .
465 $this->
getTitle()->getFullURL(
'diff=' . $rev->getId() .
'&oldid=prev' ),
466 $rev->getTimestamp(),
468 $this->getTitle()->getTalkPage()->getFullURL()
$wgSend404Code
Some web hosts attempt to rewrite all responses with a 404 (not found) status code,...
array $message
Array of message keys and strings.
static useFileCache(IContextSource $context, $mode=self::MODE_NORMAL)
Check if pages can be cached for this request/user.
A base class for outputting syndication feeds (e.g.
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...
Page view caching in the file system.
requiresWrite()
Whether this action requires the wiki not to be locked.
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.
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 If you don't need a full Title object,...
getDescription()
Returns the description that goes below the <h1> tag.
getContext()
Get the IContextSource in use here.
static getQueryInfo( $options=[])
Return the tables, fields, and join conditions to be selected to create a new revision object.
wfScript( $script='index')
Get the path to a specified script file, respecting file extensions; this is a wrapper around $wgScri...
This class handles printing the history page for an article.
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
preCacheMessages()
As we use the same small set of messages in various methods and that they are called often,...
static showLogExtract(&$out, $types=[], $page='', $user='', $param=[])
Show log extract.
getTimestampFromRequest(WebRequest $request)
getUser()
Shortcut to get the User being used for this instance.
addHelpLink( $to, $overrideBaseUrl=false)
Adds help link with an icon via page indicators.
getTitle()
Shortcut to get the Title object from the page.
The WebRequest class encapsulates getting at data passed in the URL or via a POSTed form stripping il...
getName()
Return the name of the action this object responds to.
static exists( $name)
Check if a given action is recognised, even if it's disabled.
hasUnseenRevisionMarkers()
$page
Page on which we're performing the action.
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.
msg( $key,... $params)
Get a Message object with context set Parameters are the same as wfMessage()
requiresUnblock()
Whether this action can still be executed by a blocked user.
feed( $type)
Output a subscription feed listing recent edits to this page.
static rawElement( $element, $attribs=[], $contents='')
Returns an HTML element in a string.
getLanguage()
Shortcut to get the user Language being used for this instance.
$fields
The fields used to create the HTMLForm.
getOutput()
Get the OutputPage being used for this instance.
static checkFeedOutput( $type)
Check whether feeds can be used and that $type is a valid feed type.
static run( $event, array $args=[], $deprecatedVersion=null)
Call hook functions defined in Hooks::register and $wgHooks.
static getLocalInstance( $ts=false)
Get a timestamp instance in the server local timezone ($wgLocaltimezone)