From: Daniel Friesen Date: Mon, 4 Apr 2011 00:37:42 +0000 (+0000) Subject: Instead of creating an OutputPage and then setting a context start initializing Outpu... X-Git-Tag: 1.31.0-rc.0~31038 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/banques/?a=commitdiff_plain;h=3c48938f9fb38e56f3253c2ba2399f5c0c97c64a;p=lhc%2Fweb%2Fwiklou.git Instead of creating an OutputPage and then setting a context start initializing OutputPages 'with' a context and send depreciated calls to extensions directly creating OutputPage instances. Now that we've taken care of the mess of mTitle inside OutputPage and Skin and made RequestContext track Skin instead of $wgUser we don't need the hack in SpecialPage anymore. --- diff --git a/includes/OutputPage.php b/includes/OutputPage.php index 4c7b2e9440..03fc907d6b 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -190,11 +190,7 @@ class OutputPage { /// should be private. To include the variable {{REVISIONID}} var $mRevisionId = null; - /// Stores a Title object (of the current page). - protected $mTitle = null; - - /// Stores a User object (the one the page is being rendered for) - protected $mUser = null; + private $mContext; /** * An array of stylesheet filenames (relative from skins path), with options @@ -218,6 +214,19 @@ class OutputPage { 'Cookie' => null ); + /** + * Constructor for OutputPage. This should not be called directly. + * Instead a new RequestContext should be created and it will implicitly create + * a OutputPage tied to that context. + */ + function __construct( RequestContext $context=null ) { + if ( !isset($context) ) { + # Extensions should use `new RequestContext` instead of `new OutputPage` now. + wfDeprecated( __METHOD__ ); + } + $this->mContext = $context; + } + /** * Redirect to $url rather than displaying the normal page * @@ -751,15 +760,6 @@ class OutputPage { return $this->mPagetitle; } - /** - * Set the RequestContext used in this instance - * - * @param RequestContext $context - */ - public function setContext( RequestContext $context ) { - $this->mContext = $context; - } - /** * Get the RequestContext used in this instance * diff --git a/includes/RequestContext.php b/includes/RequestContext.php index 4fd7222467..d90ddd0f94 100644 --- a/includes/RequestContext.php +++ b/includes/RequestContext.php @@ -66,8 +66,7 @@ class RequestContext { */ public function getOutput() { if ( !isset( $this->mOutput ) ) { - $this->mOutput = new OutputPage; - $this->mOutput->setContext( $this ); + $this->mOutput = new OutputPage( $this ); } return $this->mOutput; } diff --git a/includes/SpecialPage.php b/includes/SpecialPage.php index 779edca0ff..44aaf569e7 100644 --- a/includes/SpecialPage.php +++ b/includes/SpecialPage.php @@ -609,14 +609,6 @@ class SpecialPage { static function capturePath( &$title ) { global $wgOut, $wgTitle; - // preload the skin - Sometimes the SpecialPage loads it at a bad point in time making a includable special page override the skin title - // This hack is ok for now. The plan is for - // - Skin to stop storing it's own title - // - includable special pages to stop using $wgTitle and $wgOut - // - and OutputPage to store it's own skin object instead of askin $wgUser - // Once just about any of those are implemented preloading will not be necessarily - $wgOut->getSkin(); - $oldTitle = $wgTitle; $oldOut = $wgOut;