$this->rcCacheIndex = 0;
$this->lastdate = '';
$this->rclistOpen = false;
- $this->getOutput()->addModuleStyles( 'mediawiki.special.changeslist' );
+ $this->getOutput()->addModuleStyles( [
+ 'mediawiki.interface.helpers.styles',
+ 'mediawiki.special.changeslist'
+ ] );
return '<div class="mw-changeslist">';
}
return $out;
}
+ /**
+ * Render the date and time of a revision in the current user language
+ * based on whether the user is able to view this information or not.
+ * @param Revision $rev
+ * @param User $user
+ * @param Language $lang
+ * @param Title|null $title (optional) where Title does not match
+ * the Title associated with the Revision
+ * @internal For usage by Pager classes only (e.g. HistoryPager and ContribsPager).
+ * @return string HTML
+ */
+ public static function revDateLink( Revision $rev, User $user, Language $lang, $title = null ) {
+ $ts = $rev->getTimestamp();
+ $date = $lang->userTimeAndDate( $ts, $user );
+ if ( $rev->userCan( Revision::DELETED_TEXT, $user ) ) {
+ $link = MediaWikiServices::getInstance()->getLinkRenderer()->makeKnownLink(
+ $title !== null ? $title : $rev->getTitle(),
+ $date,
+ [ 'class' => 'mw-changeslist-date' ],
+ [ 'oldid' => $rev->getId() ]
+ );
+ } else {
+ $link = htmlspecialchars( $date );
+ }
+ if ( $rev->isDeleted( Revision::DELETED_TEXT ) ) {
+ $link = "<span class=\"history-deleted mw-changeslist-date\">$link</span>";
+ }
+ return $link;
+ }
+
/**
* @param string &$s HTML to update
* @param mixed $rc_timestamp
' <span class="mw-changeslist-separator"></span> ';
}
- /**
- * @param string &$s Article link will be appended to this string, in place.
- * @param RecentChange $rc
- * @param bool $unpatrolled
- * @param bool $watched
- * @deprecated since 1.27, use getArticleLink instead.
- */
- public function insertArticleLink( &$s, RecentChange $rc, $unpatrolled, $watched ) {
- $s .= $this->getArticleLink( $rc, $unpatrolled, $watched );
- }
-
/**
* @param RecentChange &$rc
* @param bool $unpatrolled
* and a separator
*
* @param RecentChange $rc
+ * @deprecated use revDateLink instead.
* @return string HTML fragment
*/
public function getTimestamp( $rc ) {
return ' <span class="history-deleted">' .
$this->msg( 'rev-deleted-comment' )->escaped() . '</span>';
} else {
- return Linker::commentBlock( $rc->mAttribs['rc_comment'], $rc->getTitle() );
+ return Linker::commentBlock( $rc->mAttribs['rc_comment'], $rc->getTitle(),
+ // Whether section links should refer to local page (using default false)
+ false,
+ // wikid to generate links for (using default null) */
+ null,
+ // whether parentheses should be rendered as part of the message
+ false );
}
}