[MediaWiki-commits] [Gerrit] mediawiki...LiquidThreads[master]: Override main context in addition to globals
jenkins-bot has submitted this change and it was merged. Change subject: Override main context in addition to globals .. Override main context in addition to globals Ideally the proper solution here would be to refactor all of this code to pass around context instead of monkey-patching global state like this. But I don't think anyone wants to do that. Bug: T143889 Change-Id: I561d1c314c950034bf16868153e7a5287f9a54ce --- M classes/View.php 1 file changed, 11 insertions(+), 0 deletions(-) Approvals: Tim Starling: Looks good to me, approved jenkins-bot: Verified diff --git a/classes/View.php b/classes/View.php index efe401a..e4caca1 100644 --- a/classes/View.php +++ b/classes/View.php @@ -382,6 +382,14 @@ $oldOut = $wgOut; $oldRequest = $wgRequest; $oldTitle = $wgTitle; + // And override the main context too... (T143889) + $context = RequestContext::getMain(); + $oldCOut = $context->getOutput(); + $oldCRequest = $context->getRequest(); + $oldCTitle = $context->getTitle(); + $context->setOutput( $this->output ); + $context->setRequest( $this->request ); + $context->setTitle( $this->title ); $wgOut = $this->output; $wgRequest = $this->request; $wgTitle = $this->title; @@ -408,6 +416,9 @@ $wgOut = $oldOut; $wgRequest = $oldRequest; $wgTitle = $oldTitle; + $context->setOutput( $oldCOut ); + $context->setRequest( $oldCRequest ); + $context->setTitle( $oldCTitle ); $this->output->setArticleBodyOnly( true ); } -- To view, visit https://gerrit.wikimedia.org/r/307549 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I561d1c314c950034bf16868153e7a5287f9a54ce Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/LiquidThreads Gerrit-Branch: master Gerrit-Owner: LegoktmGerrit-Reviewer: Nikerabbit Gerrit-Reviewer: Tim Starling Gerrit-Reviewer: jenkins-bot <> ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki...LiquidThreads[master]: Override main context in addition to globals
Legoktm has uploaded a new change for review. https://gerrit.wikimedia.org/r/307549 Change subject: Override main context in addition to globals .. Override main context in addition to globals Ideally the proper solution here would be to refactor all of this code to pass around context instead of monkey-patching global state like this. But I don't think anyone wants to do that. Bug: T143889 Change-Id: I561d1c314c950034bf16868153e7a5287f9a54ce --- M classes/View.php 1 file changed, 11 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/LiquidThreads refs/changes/49/307549/1 diff --git a/classes/View.php b/classes/View.php index efe401a..e4caca1 100644 --- a/classes/View.php +++ b/classes/View.php @@ -382,6 +382,14 @@ $oldOut = $wgOut; $oldRequest = $wgRequest; $oldTitle = $wgTitle; + // And override the main context too... (T143889) + $context = RequestContext::getMain(); + $oldCOut = $context->getOutput(); + $oldCRequest = $context->getRequest(); + $oldCTitle = $context->getTitle(); + $context->setOutput( $this->output ); + $context->setRequest( $this->request ); + $context->setTitle( $this->title ); $wgOut = $this->output; $wgRequest = $this->request; $wgTitle = $this->title; @@ -408,6 +416,9 @@ $wgOut = $oldOut; $wgRequest = $oldRequest; $wgTitle = $oldTitle; + $context->setOutput( $oldCOut ); + $context->setRequest( $oldCRequest ); + $context->setTitle( $oldCTitle ); $this->output->setArticleBodyOnly( true ); } -- To view, visit https://gerrit.wikimedia.org/r/307549 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I561d1c314c950034bf16868153e7a5287f9a54ce Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/LiquidThreads Gerrit-Branch: master Gerrit-Owner: Legoktm___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits