On Thu, 03 Mar 2005 11:53:28 +0100, Sebastien BARRE sebastien.barre@kitware.com wrote:
Is is still time to request specific events for 1.4 ? I'm trying to force a specific skin to be used for specific pages (I know it's evil, but trust me on this one). No way to do it with the current extension mechanism. I assume it's in OutputPage::output(), around $sk = $wgUser->getSkin(); ? Could you eventually add a hook at the beginning and end of OutputPage::output() ?
Note that the skin is stored as a member of the User object, and "got" from there whenever it's needed (i.e. all over the place). So you couldn't just change the code in one place where it's retrieved, you'd have to change it in User::getSkin itself (which seemingly loads the option on first request), or override the member variable in some other way (and do it very early on in the code, so that other things haven't already used the 'wrong' one). But maybe that latter option is what you're trying to do already.
This is actually even more important because of the way you implemented the pattern: it seems the event/hook signature is not "frozen": each event/hook can have a different number of arguments attached to it. So unless I'm wrong, any change made to an event/hook signature in the MediaWiki code will break people's hooks. In C++, we "avoided" that problem by passing a void* (that you would cast to whatever, int*, float*, object*, etc).
I thought that when I first heard of the hooks system. Wouldn't it be better to pass an associative array, so that the number and order of arguments could be varied with reasonable safety? (The order being irrelevant, and new or obsolete ones being ignorable if you didn't actually need them). AIUI, associative arrays are pretty basic data in PHP, what with all arrays being associative by nature, etc...