* (bug 31759) Undefined property notice in querypages API.
* (bug 32495) API should allow purge by pageids.
* (bug 33147) API examples should explain what they do.
+* Extensions can use the RequestContextCreateSkin hook to override what skin is
+ loaded in some contexts.
=== Languages updated in 1.19 ===
'RecentChange_save': called at the end of RecentChange::save()
$recentChange: RecentChange object
+'RequestContextCreateSkin': Called when RequestContext::getSkin creates a skin instance.
+Can be used by an extension override what skin is used in certain contexts.
+IContextSource $context: The RequestContext the skin is being created for.
+&$skin: A variable reference you may set a Skin instance or string key on to override the skin that will be used for the context.
+
'ResourceLoaderGetConfigVars': called at the end of
ResourceLoaderStartUpModule::getConfig(). Use this to export static
configuration variables to JavaScript. Things that depend on the current
if ( $this->skin === null ) {
wfProfileIn( __METHOD__ . '-createskin' );
- global $wgHiddenPrefs;
- if( !in_array( 'skin', $wgHiddenPrefs ) ) {
- # get the user skin
- $userSkin = $this->getUser()->getOption( 'skin' );
- $userSkin = $this->getRequest()->getVal( 'useskin', $userSkin );
- } else {
- # if we're not allowing users to override, then use the default
- global $wgDefaultSkin;
- $userSkin = $wgDefaultSkin;
+ $skin = null;
+ wfRunHooks( 'RequestContextCreateSkin', array( $this, &$skin ) );
+
+ // If the hook worked try to set a skin from it
+ if ( $skin instanceof Skin ) {
+ $this->skin = $skin;
+ } elseif ( is_string($skin) ) {
+ $this->skin = Skin::newFromKey( $skin );
+ }
+
+ // If this is still null (the hook didn't run or didn't work)
+ // then go through the normal processing to load a skin
+ if ( $this->skin === null ) {
+ global $wgHiddenPrefs;
+ if( !in_array( 'skin', $wgHiddenPrefs ) ) {
+ # get the user skin
+ $userSkin = $this->getUser()->getOption( 'skin' );
+ $userSkin = $this->getRequest()->getVal( 'useskin', $userSkin );
+ } else {
+ # if we're not allowing users to override, then use the default
+ global $wgDefaultSkin;
+ $userSkin = $wgDefaultSkin;
+ }
+
+ $this->skin = Skin::newFromKey( $userSkin );
}
- $this->skin = Skin::newFromKey( $userSkin );
+ // After all that set a context on whatever skin got created
$this->skin->setContext( $this );
wfProfileOut( __METHOD__ . '-createskin' );
}