* @private
*/
var $mOldid, $mNewid;
+ /**
+ * @var Content
+ */
var $mOldContent, $mNewContent;
protected $mDiffLang;
if ( $samePage && $this->mNewPage->quickUserCan( 'edit', $user ) ) {
if ( $this->mNewRev->isCurrent() && $this->mNewPage->userCan( 'rollback', $user ) ) {
- $out->preventClickjacking();
- $rollback = '   ' . Linker::generateRollback( $this->mNewRev, $this->getContext() );
+ $rollbackLink = Linker::generateRollback( $this->mNewRev, $this->getContext() );
+ if ( $rollbackLink ) {
+ $out->preventClickjacking();
+ $rollback = '   ' . $rollbackLink;
+ }
}
if ( !$this->mOldRev->isDeleted( Revision::DELETED_TEXT ) && !$this->mNewRev->isDeleted( Revision::DELETED_TEXT ) ) {
$undoLink = ' ' . $this->msg( 'parentheses' )->rawParams(
/**
* Get a link to mark the change as patrolled, or '' if there's either no
* revision to patrol or the user is not allowed to to it.
- * Side effect: this method will call OutputPage::preventClickjacking()
- * when a link is builded.
+ * Side effect: When the patrol link is build, this method will call
+ * OutputPage::preventClickjacking() and load mediawiki.page.patrol.ajax.
*
* @return String
*/
// Build the link
if ( $rcid ) {
$this->getOutput()->preventClickjacking();
+ $this->getOutput()->addModules( 'mediawiki.page.patrol.ajax' );
+
$token = $this->getUser()->getEditToken( $rcid );
$this->mMarkPatrolledLink = ' <span class="patrollink">[' . Linker::linkKnown(
$this->mNewPage,
if ( ContentHandler::runLegacyHooks( 'ShowRawCssJs', array( $this->mNewContent, $this->mNewPage, $out ) ) ) {
// NOTE: deprecated hook, B/C only
// use the content object's own rendering
- $po = $this->mNewRev->getContent()->getParserOutput( $this->mNewRev->getTitle(), $this->mNewRev->getId() );
- $out->addHTML( $po->getText() );
+ $cnt = $this->mNewRev->getContent();
+ $po = $cnt ? $cnt->getParserOutput( $this->mNewRev->getTitle(), $this->mNewRev->getId() ) : null;
+ $txt = $po ? $po->getText() : '';
+ $out->addHTML( $txt );
}
} elseif( !wfRunHooks( 'ArticleContentViewCustom', array( $this->mNewContent, $this->mNewPage, $out ) ) ) {
// Handled by extension
$parserOutput = $this->getParserOutput( $wikiPage, $this->mNewRev );
# Also try to load it as a redirect
- $rt = $this->mNewContent->getRedirectTarget();
+ $rt = $this->mNewContent ? $this->mNewContent->getRedirectTarget() : null;
if ( $rt ) {
$article = Article::newFromTitle( $this->mNewPage, $this->getContext() );
/**
* Get complete diff table, including header
*
- * @param $otitle Title: old title
- * @param $ntitle Title: new title
+ * @param string|bool $otitle Header for old text or false
+ * @param string|bool $ntitle Header for new text or false
* @param $notice String: HTML between diff header and body
* @return mixed
*/
}
if ( $this->mOldRev ) {
$this->mOldContent = $this->mOldRev->getContent( Revision::FOR_THIS_USER, $this->getUser() );
- if ( $this->mOldContent === false ) {
+ if ( $this->mOldContent === null ) {
return false;
}
}
if ( $this->mNewRev ) {
$this->mNewContent = $this->mNewRev->getContent( Revision::FOR_THIS_USER, $this->getUser() );
- if ( $this->mNewContent === false ) {
+ if ( $this->mNewContent === null ) {
return false;
}
}