// @todo FIXME: Horrible, horrible! This content-loading interface just plain sucks.
// We should instead work with the Revision object when we need it...
// Loads if user is allowed
- $this->mContentObject = $this->mRevision->getContent(
+ $content = $this->mRevision->getContent(
Revision::FOR_THIS_USER,
$this->getContext()->getUser()
);
+
+ if ( !$content ) {
+ wfDebug( __METHOD__ . " failed to retrieve content of revision " .
+ $this->mRevision->getId() . "\n" );
+ return false;
+ }
+
+ $this->mContentObject = $content;
$this->mRevIdFetched = $this->mRevision->getId();
Hooks::run( 'ArticleAfterFetchContentObject', array( &$this, &$this->mContentObject ) );
$this->mParserOutput = $poolArticleView->getParserOutput();
$outputPage->addParserOutput( $this->mParserOutput );
if ( $content->getRedirectTarget() ) {
- $outputPage->addSubtitle(
- "<span id=\"redirectsub\">" . wfMessage( 'redirectpagesub' )->parse() . "</span>"
- );
+ $outputPage->addSubtitle( "<span id=\"redirectsub\">" .
+ $this->getContext()->msg( 'redirectpagesub' )->parse() . "</span>" );
}
# Don't cache a dirty ParserOutput object
}
# Get the ParserOutput actually *displayed* here.
- # Note that $this->mParserOutput is the *current* version output.
+ # Note that $this->mParserOutput is the *current*/oldid version output.
$pOutput = ( $outputDone instanceof ParserOutput )
? $outputDone // object fetched by hook
: $this->mParserOutput;
* Show a diff page according to current request variables. For use within
* Article::view() only, other callers should use the DifferenceEngine class.
*
- * @todo Make protected
*/
- public function showDiffPage() {
+ protected function showDiffPage() {
$request = $this->getContext()->getRequest();
$user = $this->getContext()->getUser();
$diff = $request->getVal( 'diff' );
*/
public function showRedirectedFromHeader() {
global $wgRedirectSources;
- $outputPage = $this->getContext()->getOutput();
- $request = $this->getContext()->getRequest();
+ $context = $this->getContext();
+ $outputPage = $context->getOutput();
+ $request = $context->getRequest();
$rdfrom = $request->getVal( 'rdfrom' );
// Construct a URL for the current page view, but with the target title
);
$outputPage->addSubtitle( "<span class=\"mw-redirectedfrom\">" .
- wfMessage( 'redirectedfrom' )->rawParams( $redir )->parse()
+ $context->msg( 'redirectedfrom' )->rawParams( $redir )->parse()
. "</span>" );
// Add the script to update the displayed URL and
if ( $wgRedirectSources && preg_match( $wgRedirectSources, $rdfrom ) ) {
$redir = Linker::makeExternalLink( $rdfrom, $rdfrom );
$outputPage->addSubtitle( "<span class=\"mw-redirectedfrom\">" .
- wfMessage( 'redirectedfrom' )->rawParams( $redir )->parse()
+ $context->msg( 'redirectedfrom' )->rawParams( $redir )->parse()
. "</span>" );
// Add the script to update the displayed URL
return false;
}
- if ( $rc->getPerformer()->getName() == $user->getName() ) {
+ if ( $rc->getPerformer()->equals( $user ) ) {
// Don't show a patrol link for own creations. If the user could
// patrol them, they already would be patrolled
return false;
return;
}
- $unhide = $this->getContext()->getRequest()->getInt( 'unhide' ) == 1;
+ $context = $this->getContext();
+ $unhide = $context->getRequest()->getInt( 'unhide' ) == 1;
# Cascade unhide param in links for easy deletion browsing
$extraParams = array();
$timestamp = $revision->getTimestamp();
$current = ( $oldid == $this->mPage->getLatest() );
- $language = $this->getContext()->getLanguage();
- $user = $this->getContext()->getUser();
+ $language = $context->getLanguage();
+ $user = $context->getUser();
$td = $language->userTimeAndDate( $timestamp, $user );
$tddate = $language->userDate( $timestamp, $user );
# Show user links if allowed to see them. If hidden, then show them only if requested...
$userlinks = Linker::revUserTools( $revision, !$unhide );
- $infomsg = $current && !wfMessage( 'revision-info-current' )->isDisabled()
+ $infomsg = $current && !$context->msg( 'revision-info-current' )->isDisabled()
? 'revision-info-current'
: 'revision-info';
- $outputPage = $this->getContext()->getOutput();
+ $outputPage = $context->getOutput();
$outputPage->addSubtitle( "<div id=\"mw-{$infomsg}\">" .
- wfMessage( $infomsg, $td )
+ $context->msg( $infomsg, $td )
->rawParams( $userlinks )
->params( $revision->getID(), $tddate, $tdtime, $revision->getUserText() )
->rawParams( Linker::revComment( $revision, true, true ) )
);
$lnk = $current
- ? wfMessage( 'currentrevisionlink' )->escaped()
+ ? $context->msg( 'currentrevisionlink' )->escaped()
: Linker::linkKnown(
$this->getTitle(),
- wfMessage( 'currentrevisionlink' )->escaped(),
+ $context->msg( 'currentrevisionlink' )->escaped(),
array(),
$extraParams
);
$curdiff = $current
- ? wfMessage( 'diff' )->escaped()
+ ? $context->msg( 'diff' )->escaped()
: Linker::linkKnown(
$this->getTitle(),
- wfMessage( 'diff' )->escaped(),
+ $context->msg( 'diff' )->escaped(),
array(),
array(
'diff' => 'cur',
$prevlink = $prev
? Linker::linkKnown(
$this->getTitle(),
- wfMessage( 'previousrevision' )->escaped(),
+ $context->msg( 'previousrevision' )->escaped(),
array(),
array(
'direction' => 'prev',
'oldid' => $oldid
) + $extraParams
)
- : wfMessage( 'previousrevision' )->escaped();
+ : $context->msg( 'previousrevision' )->escaped();
$prevdiff = $prev
? Linker::linkKnown(
$this->getTitle(),
- wfMessage( 'diff' )->escaped(),
+ $context->msg( 'diff' )->escaped(),
array(),
array(
'diff' => 'prev',
'oldid' => $oldid
) + $extraParams
)
- : wfMessage( 'diff' )->escaped();
+ : $context->msg( 'diff' )->escaped();
$nextlink = $current
- ? wfMessage( 'nextrevision' )->escaped()
+ ? $context->msg( 'nextrevision' )->escaped()
: Linker::linkKnown(
$this->getTitle(),
- wfMessage( 'nextrevision' )->escaped(),
+ $context->msg( 'nextrevision' )->escaped(),
array(),
array(
'direction' => 'next',
) + $extraParams
);
$nextdiff = $current
- ? wfMessage( 'diff' )->escaped()
+ ? $context->msg( 'diff' )->escaped()
: Linker::linkKnown(
$this->getTitle(),
- wfMessage( 'diff' )->escaped(),
+ $context->msg( 'diff' )->escaped(),
array(),
array(
'diff' => 'next',
}
$outputPage->addSubtitle( "<div id=\"mw-revision-nav\">" . $cdel .
- wfMessage( 'revision-nav' )->rawParams(
+ $context->msg( 'revision-nav' )->rawParams(
$prevdiff, $prevlink, $lnk, $curdiff, $nextlink, $nextdiff
)->escaped() . "</div>" );
}
$lang = $this->getTitle()->getPageLanguage();
$out = $this->getContext()->getOutput();
if ( $appendSubtitle ) {
- $out->addSubtitle( wfMessage( 'redirectpagesub' )->parse() );
+ $out->addSubtitle( wfMessage( 'redirectpagesub' ) );
}
$out->addModuleStyles( 'mediawiki.action.view.redirectPage' );
return static::getRedirectHeaderHtml( $lang, $target, $forceKnown );
( $forceKnown ? array( 'known', 'noclasses' ) : array() )
) . '</li>';
}
+ $html .= '</ul>';
- $redirectToText = wfMessage( 'redirectto' )->inLanguage( $lang )->text();
+ $redirectToText = wfMessage( 'redirectto' )->inLanguage( $lang )->escaped();
return '<div class="redirectMsg">' .
'<p>' . $redirectToText . '</p>' .