* Print the history page for an article.
*/
function onView() {
- global $wgScript, $wgUseFileCache;
-
$out = $this->getOutput();
$request = $this->getRequest();
wfProfileIn( __METHOD__ );
$this->preCacheMessages();
+ $config = $this->context->getConfig();
# Fill in the file cache if not set already
- if ( $wgUseFileCache && HTMLFileCache::useFileCache( $this->getContext() ) ) {
+ $useFileCache = $config->get( 'UseFileCache' );
+ if ( $useFileCache && HTMLFileCache::useFileCache( $this->getContext() ) ) {
$cache = HTMLFileCache::newFromTitle( $this->getTitle(), 'history' );
if ( !$cache->isCacheGood( /* Assume up to date */ ) ) {
ob_start( array( &$cache, 'saveToFileCache' ) );
// Setup page variables.
$out->setFeedAppendQuery( 'action=history' );
$out->addModules( 'mediawiki.action.history' );
+ if ( $config->get( 'UseMediaWikiUIEverywhere' ) ) {
+ $out = $this->getOutput();
+ $out->addModuleStyles( array(
+ 'mediawiki.ui.input',
+ 'mediawiki.ui.checkbox',
+ ) );
+ }
// Handle atom/RSS feeds.
$feedType = $request->getVal( 'feed' );
}
// Add the general form
- $action = htmlspecialchars( $wgScript );
+ $action = htmlspecialchars( wfScript() );
$out->addHTML(
"<form action=\"$action\" method=\"get\" id=\"mw-history-searchform\">" .
Xml::fieldset(
/**
* Output a subscription feed listing recent edits to this page.
*
- * @param string $type feed type
+ * @param string $type Feed type
*/
function feed( $type ) {
- global $wgFeedClasses, $wgFeedLimit;
if ( !FeedUtils::checkFeedOutput( $type ) ) {
return;
}
$request = $this->getRequest();
+ $feedClasses = $this->context->getConfig()->get( 'FeedClasses' );
/** @var RSSFeed|AtomFeed $feed */
- $feed = new $wgFeedClasses[$type](
+ $feed = new $feedClasses[$type](
$this->getTitle()->getPrefixedText() . ' - ' .
$this->msg( 'history-feed-title' )->inContentLanguage()->text(),
$this->msg( 'history-feed-description' )->inContentLanguage()->text(),
// Get a limit on number of feed entries. Provide a sane default
// of 10 if none is defined (but limit to $wgFeedLimit max)
$limit = $request->getInt( 'limit', 10 );
- $limit = min( max( $limit, 1 ), $wgFeedLimit );
+ $limit = min(
+ max( $limit, 1 ),
+ $this->context->getConfig()->get( 'FeedLimit' )
+ );
$items = $this->fetchRevisions( $limit, 0, self::DIR_NEXT );
* Borrows Recent Changes' feed generation functions for formatting;
* includes a diff to the previous revision (if any).
*
- * @param stdClass|array $row database row
+ * @param stdClass|array $row Database row
* @return FeedItem
*/
function feedItem( $row ) {
* @return string HTML output
*/
function getStartBody() {
- global $wgScript;
+ global $wgUseMediaWikiUIEverywhere;
$this->lastRow = false;
$this->counter = 1;
$this->oldIdChecked = 0;
$this->getOutput()->wrapWikiMsg( "<div class='mw-history-legend'>\n$1\n</div>", 'histlegend' );
- $s = Html::openElement( 'form', array( 'action' => $wgScript,
+ $s = Html::openElement( 'form', array( 'action' => wfScript(),
'id' => 'mw-history-compare' ) ) . "\n";
$s .= Html::hidden( 'title', $this->getTitle()->getPrefixedDBkey() ) . "\n";
$s .= Html::hidden( 'action', 'historysubmit' ) . "\n";
// Button container stored in $this->buttons for re-use in getEndBody()
$this->buttons = '<div>';
+ $className = 'historysubmit mw-history-compareselectedversions-button';
+ if ( $wgUseMediaWikiUIEverywhere ) {
+ $className .= ' mw-ui-button mw-ui-constructive';
+ }
$this->buttons .= $this->submitButton( $this->msg( 'compareselectedversions' )->text(),
- array( 'class' => 'historysubmit mw-history-compareselectedversions-button' )
+ array( 'class' => $className )
+ Linker::tooltipAndAccesskeyAttribs( 'compareselectedversions' )
) . "\n";
/**
* Create a diff-to-previous link for this revision for this page.
*
- * @param Revision $prevRev The previous revision
- * @param mixed $next The newer revision
+ * @param Revision $prevRev The revision being displayed
+ * @param stdClass|string|null $next The next revision in list (that is
+ * the previous one in chronological order).
+ * May either be a row, "unknown" or null.
* @return string
*/
function lastLink( $prevRev, $next ) {
$last = $this->historyPage->message['last'];
- # $next may either be a Row, null, or "unknown"
- $nextRev = is_object( $next ) ? new Revision( $next ) : $next;
- if ( is_null( $next ) ) {
+
+ if ( $next === null ) {
# Probably no next row
return $last;
- } elseif ( $next === 'unknown' ) {
+ }
+
+ if ( $next === 'unknown' ) {
# Next row probably exists but is unknown, use an oldid=prev link
return Linker::linkKnown(
$this->getTitle(),
'oldid' => 'prev'
)
);
- } elseif ( !$prevRev->userCan( Revision::DELETED_TEXT, $this->getUser() )
+ }
+
+ $nextRev = new Revision( $next );
+
+ if ( !$prevRev->userCan( Revision::DELETED_TEXT, $this->getUser() )
|| !$nextRev->userCan( Revision::DELETED_TEXT, $this->getUser() )
) {
return $last;
- } else {
- return Linker::linkKnown(
- $this->getTitle(),
- $last,
- array(),
- array(
- 'diff' => $prevRev->getId(),
- 'oldid' => $next->rev_id
- )
- );
}
+
+ return Linker::linkKnown(
+ $this->getTitle(),
+ $last,
+ array(),
+ array(
+ 'diff' => $prevRev->getId(),
+ 'oldid' => $next->rev_id
+ )
+ );
}
/**
/**
* This is called if a write operation is possible from the generated HTML
+ * @param bool $enable
*/
function preventClickjacking( $enable = true ) {
$this->preventClickjacking = $enable;