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 ) {
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 :
'';
144 $config = $this->context->getConfig();
145 $services = MediaWikiServices::getInstance();
154 $watchlistNotificationManager = $services->getWatchlistNotificationManager();
155 $hasUnseenRevisionMarkers = $config->get(
'ShowUpdatedMarker' ) &&
156 $watchlistNotificationManager->getTitleNotificationTimestamp(
161 !$hasUnseenRevisionMarkers &&
162 $out->checkLastModified( $this->getWikiPage()->getTouched() )
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' ) ) {
186 $out->addModuleStyles( [
187 'mediawiki.ui.input',
188 'mediawiki.ui.checkbox',
193 $feedType = $request->getRawVal(
'feed' );
194 if ( $feedType !==
null ) {
195 $this->
feed( $feedType );
200 'https://meta.wikimedia.org/wiki/Special:MyLanguage/Help:Page_history',
208 $out->setStatusCode( 404 );
210 $out->addWikiMsg(
'nohistory' );
214 # show deletion/move log if there is an entry
217 [
'delete',
'move',
'protect' ],
221 'conds' => [
'log_action != ' .
$dbr->addQuotes(
'revision' ) ],
222 'showIfEmpty' =>
false,
223 'msgKey' => [
'moveddeleted-notice' ]
231 $tagFilter = $request->getVal(
'tagfilter' );
236 if ( $request->getBool(
'deleted' ) ) {
237 $conds = [
'rev_deleted != 0' ];
247 'default' => $this->
getTitle()->getPrefixedDBkey(),
252 'default' =>
'history',
257 'label' => $this->
msg(
'date-range-to' )->text(),
258 'name' =>
'date-range-to',
261 'label-raw' => $this->
msg(
'tag-filter' )->parse(),
262 'type' =>
'tagfilter',
264 'name' =>
'tagfilter',
265 'value' => $tagFilter,
268 $permissionManager = $services->getPermissionManager();
269 if ( $permissionManager->userHasRight( $this->getUser(),
'deletedhistory' ) ) {
272 'label' => $this->
msg(
'history-show-deleted' )->text(),
273 'default' => $request->getBool(
'deleted' ),
283 ->setCollapsibleOptions(
true )
284 ->setId(
'mw-history-searchform' )
285 ->setSubmitText( $this->
msg(
'historyaction-submit' )->text() )
286 ->setWrapperAttributes( [
'id' =>
'mw-history-search' ] )
287 ->setWrapperLegend( $this->
msg(
'history-fieldset-title' )->text() );
288 $htmlForm->loadData();
290 $out->addHTML( $htmlForm->getHTML(
false ) );
298 $dateComponents = explode(
'-', $ts );
299 if ( count( $dateComponents ) > 1 ) {
300 $y = $dateComponents[0];
301 $m = $dateComponents[1];
302 $d = $dateComponents[2];
315 $services->getLinkBatchFactory(),
316 $watchlistNotificationManager
319 $pager->getNavigationBar() .
321 $pager->getNavigationBar()
323 $out->preventClickjacking( $pager->getPreventClickjacking() );
346 if ( $direction === self::DIR_PREV ) {
347 list(
$dirs, $oper ) = [
"ASC",
">=" ];
349 list(
$dirs, $oper ) = [
"DESC",
"<=" ];
353 $offsets = [
"rev_timestamp $oper " .
$dbr->addQuotes(
$dbr->timestamp( $offset ) ) ];
360 $revQuery = MediaWikiServices::getInstance()->getRevisionStore()->getQueryInfo();
364 array_merge( [
'rev_page' => $page_id ], $offsets ),
367 'ORDER BY' =>
"rev_timestamp $dirs",
368 'USE INDEX' => [
'revision' =>
'page_timestamp' ],
386 $feedClasses = $this->context->getConfig()->get(
'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(
'FeedLimit' )
407 if ( $items->numRows() ) {
408 foreach ( $items as $row ) {
409 $feed->outItem( $this->
feedItem( $row ) );
419 $this->
msg(
'nohistory' )->inContentLanguage()->text(),
420 $this->
msg(
'history-feed-empty' )->inContentLanguage()->parseAsBlock(),
424 $this->
getTitle()->getTalkPage()->getFullURL()
437 $revisionStore = MediaWikiServices::getInstance()->getRevisionStore();
438 $rev = $revisionStore->newRevisionFromRow( $row, 0, $this->
getTitle() );
439 $prevRev = $revisionStore->getPreviousRevision( $rev );
440 $revComment = $rev->getComment() ===
null ? null : $rev->getComment()->text;
443 $prevRev ? $prevRev->getId() :
false,
445 $rev->getTimestamp(),
448 $revUserText = $rev->getUser() ? $rev->getUser()->getName() :
'';
449 if ( $revComment ==
'' ) {
450 $contLang = MediaWikiServices::getInstance()->getContentLanguage();
451 $title = $this->
msg(
'history-feed-item-nocomment',
453 $contLang->timeanddate( $rev->getTimestamp() ),
454 $contLang->date( $rev->getTimestamp() ),
455 $contLang->time( $rev->getTimestamp() )
456 )->inContentLanguage()->text();
459 $this->
msg(
'colon-separator' )->inContentLanguage()->text() .
466 $this->
getTitle()->getFullURL(
'diff=' . $rev->getId() .
'&oldid=prev' ),
467 $rev->getTimestamp(),
469 $this->getTitle()->getTalkPage()->getFullURL()