From: jeroendedauw Date: Tue, 17 Apr 2012 15:55:20 +0000 (+0200) Subject: pass context instead of title to getParserOutput X-Git-Tag: 1.31.0-rc.0~22097^2^2~243^2 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/banques/ajouter.php?a=commitdiff_plain;h=48caa48acba9156dff7e7395635c39056ee7e4e2;p=lhc%2Fweb%2Fwiklou.git pass context instead of title to getParserOutput Change-Id: I5787b523a871b0a73f4ca174a761f22aa394c9fd --- diff --git a/includes/Article.php b/includes/Article.php index 31c0ac48ce..dbdae4c8b1 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -638,7 +638,7 @@ class Article extends Page { # Viewing a redirect page (e.g. with parameter redirect=no) $wgOut->addHTML( $this->viewRedirect( $rt ) ); # Parse just to get categories, displaytitle, etc. - $this->mParserOutput = $content->getParserOutput( $this->getTitle(), $oldid, $parserOptions, false ); + $this->mParserOutput = $content->getParserOutput( $this->getContext(), $oldid, $parserOptions, false ); $wgOut->addParserOutputNoText( $this->mParserOutput ); $outputDone = true; } diff --git a/includes/EditPage.php b/includes/EditPage.php index d1ba6744ac..5ba6cdc277 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -2794,7 +2794,9 @@ HTML #XXX: For CSS/JS pages, we should have called the ShowRawCssJs hook here. But it's now deprecated, so never mind $content = $content->preSaveTransform( $this->mTitle, $wgUser, $parserOptions ); - $parserOutput = $content->getParserOutput( $this->mTitle, null, $parserOptions ); + + // TODO: might be a saner way to get a meaningfull context here? + $parserOutput = $content->getParserOutput( $this->getArticle()->getContext(), null, $parserOptions ); $previewHTML = $parserOutput->getText(); $this->mParserOutput = $parserOutput; diff --git a/includes/WikiPage.php b/includes/WikiPage.php index 46385464ae..fdbea04b5f 100644 --- a/includes/WikiPage.php +++ b/includes/WikiPage.php @@ -1687,7 +1687,11 @@ class WikiPage extends Page { $edit->format = $serialization_format; $edit->popts = $this->makeParserOptions( 'canonical' ); - $edit->output = $edit->pstContent->getParserOutput( $this->mTitle, $revid, $edit->popts ); + + // TODO: is there no better way to obtain a context here? + $context = RequestContext::getMain(); + $context->setTitle( $this->mTitle ); + $edit->output = $edit->pstContent->getParserOutput( $context, $revid, $edit->popts ); $edit->newContent = $content; $edit->oldContent = $this->getContent( Revision::RAW ); @@ -3088,7 +3092,8 @@ class PoolWorkArticleView extends PoolCounterWork { } $time = - microtime( true ); - $this->parserOutput = $content->getParserOutput( $this->page->getTitle(), $this->revid, $this->parserOptions ); + // TODO: page might not have this method? Hard to tell what page is supposed to be here... + $this->parserOutput = $content->getParserOutput( $this->page->getContext(), $this->revid, $this->parserOptions ); $time += microtime( true ); # Timing hack