* @return string Return the text of this revision
*/
public function getContent() {
- wfDeprecated( __METHOD__, '1.21' );
+ ContentHandler::deprecated( __METHOD__, '1.21' );
$content = $this->getContentObject();
return ContentHandler::getContentText( $content );
}
* @deprecated in 1.21, use WikiPage::getContent() instead
*/
function fetchContent() { #BC cruft!
- wfDeprecated( __METHOD__, '1.21' );
+ ContentHandler::deprecated( __METHOD__, '1.21' );
if ( $this->mContentLoaded && $this->mContent ) {
return $this->mContent;
* page of the given title.
*/
public function view() {
- global $wgParser, $wgUseFileCache, $wgUseETag, $wgDebugToolbar;
+ global $wgUseFileCache, $wgUseETag, $wgDebugToolbar;
wfProfileIn( __METHOD__ );
$outputDone = true;
} else {
$content = $this->getContentObject();
- $rt = $content->getRedirectChain();
+ $rt = $content ? $content->getRedirectChain() : null;
if ( $rt ) {
wfDebug( __METHOD__ . ": showing redirect=no page\n" );
# Viewing a redirect page (e.g. with parameter redirect=no)
# Run the parse, protected by a pool counter
wfDebug( __METHOD__ . ": doing uncached parse\n" );
- // @todo: shouldn't we be passing $this->getPage() to PoolWorkArticleView instead of plain $this?
- $poolArticleView = new PoolWorkArticleView( $this, $parserOptions,
- $this->getRevIdFetched(), $useParserCache, $this->getContentObject(), $this->getContext() );
+ $poolArticleView = new PoolWorkArticleView( $this->getPage(), $parserOptions,
+ $this->getRevIdFetched(), $useParserCache, $this->getContentObject() );
if ( !$poolArticleView->execute() ) {
$error = $poolArticleView->getError();
* @param bool $showCacheHint whether to show a message telling the user to clear the browser cache (default: true).
*/
protected function showCssOrJsPage( $showCacheHint = true ) {
+ $outputPage = $this->getContext()->getOutput();
+
if ( $showCacheHint ) {
$dir = $this->getContext()->getLanguage()->getDir();
$lang = $this->getContext()->getLanguage()->getCode();
- $outputPage = $this->getContext()->getOutput();
$outputPage->wrapWikiMsg( "<div id='mw-clearyourcache' lang='$lang' dir='$dir' class='mw-content-$dir'>\n$1\n</div>",
'clearyourcache' );
}
- // Give hooks a chance to customise the output
- if ( ContentHandler::runLegacyHooks( 'ShowRawCssJs', array( $this->fetchContentObject(), $this->getTitle(), $wgOut ) ) ) {
- $po = $this->mContentObject->getParserOutput( $this->getTitle() );
- $wgOut->addHTML( $po->getText() );
+ $this->fetchContentObject();
+
+ if ( $this->mContentObject ) {
+ // Give hooks a chance to customise the output
+ if ( ContentHandler::runLegacyHooks( 'ShowRawCssJs', array( $this->mContentObject, $this->getTitle(), $outputPage ) ) ) {
+ $po = $this->mContentObject->getParserOutput( $this->getTitle() );
+ $outputPage->addHTML( $po->getText() );
+ }
}
}
* If patrol is possible, output a patrol UI box. This is called from the
* footer section of ordinary page views. If patrol is not possible or not
* desired, does nothing.
+ * Side effect: When the patrol link is build, this method will call
+ * OutputPage::preventClickjacking() and load mediawiki.page.patrol.ajax.
*/
public function showPatrolFooter() {
$request = $this->getContext()->getRequest();
}
$token = $user->getEditToken( $rcid );
+
$outputPage->preventClickjacking();
+ $outputPage->addModules( 'mediawiki.page.patrol.ajax' );
$link = Linker::linkKnown(
$this->getTitle(),
* @return bool
*/
public function updateRestrictions( $limit = array(), $reason = '', &$cascade = 0, $expiry = array() ) {
- return $this->mPage->updateRestrictions( $limit, $reason, $cascade, $expiry );
+ return $this->mPage->doUpdateRestrictions(
+ $limit,
+ $expiry,
+ $cascade,
+ $reason,
+ $this->getContext()->getUser()
+ );
}
/**