Continuing with my changes to $wgOut, $wgUser, Skin, and SpecialPage 
patterns.

The Linker is now static, $sk->link will still work, however you should 
not be requiring a Skin anymore to use linker methods. Please use 
Linker::link directly.
The only exception is the method to create an editsection link, that 
method IS part of Skin itself now.
Also there is some compat for hooks that were passed the linker as an 
instance, and `$parserOptions->getSkin();` However note that 
ParserOptions::getSkin no longer returns an actual Skin, it now returns 
a plain linker instance and makes a depreciated call.
((for reference the 'instance' of Linker which is static is actually a 
"DummyLinker" class which has a __call that forwards old method calls to 
static calls to the linker))

So nearly EVERY case you are currently grabbing a Skin for, you should 
no longer be fetching a skin.


Now, if you really do need a skin, the the new way to get a skin is 
`$context->getSkin()`, OutputPage has a helper `$out->getSkin()` if you 
happen to be working on OutputPage related stuff and need to interact 
with the skin. `$wgUser->getSkin();` has some BackCompat to keep 
working, however please avoid using it, it uses the main RequestContext, 
not whatever the RequestContext for whatever context you are in is.

Also, there is no equivalent to `$wgUser->getSkin( $title );`. Skin no 
longer has a mTitle of it's own, it gets the title used in the attached 
RequestContext, which is the same one that OutputPage uses, and is 
essentially the replacement to $wgTitle. So you don't need to work 
around bugs like that in Skin, nor in OutputPage anymore. Additionally 
that format was never actually used right, nearly every call to that was 
actually made in contexts where one was using the Linker methods (which 
don't use mTitle) and was not interacting with the skin.

I started a page on the RequestContext object: 
http://www.mediawiki.org/wiki/Request_Context

---- some extra ----
I'm still contemplating skin setting and relation to context right now. 
I would like to make it possible to do something like 
`$context->setSkin( new DummyOfflineSkin );` but also want to avoid bugs 
where you try to set the same skin onto two contexts and get an error.
I examined the code paths, and Skin doesn't actually make any 
RequestContext dependent calls except inside calls made from the 
Skin::outputPage( $out ); entrypoint which is called by 
OutputPage::output();, in other words theoretically I could avoid tying 
a Skin instance to any specific context by setting the context at the 
start of Skin::outputPage( $out ) ($out provides the RequestContext), 
and exiting that context when it's done. However there is one instance 
where this rule is broken, ApiParse which makes a direct call outside of 
that context when you use categoryhtml or languagehtml (which I wanted 
to stop from being released from the start).

-- 
~Daniel Friesen (Dantman, Nadir-Seen-Fire) [http://daniel.friesen.name]


_______________________________________________
Wikitech-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Reply via email to