Last modified: 2013-12-17 09:32:19 UTC
This hook seems to be very generic and very dangerous - it allows any extension to redefine template variables in a skin and as a result change the behaviour of a skin. We are running into various problems in the skin in MobileFrontend where language_urls in the context of our skin means a list of languages but that seems to differ from core. I believe we should understand the existing uses of it and provide more generic hooks to guide usage. e.g. in the case of languages a SkinAddLanguageUrl hook would be better as this would also change the return result of getLanguages. Can someone make a case for the existing use cases of this hook and why the hook runs so close to the outputting of the HTML as I'm struggling to see why a generic hook like this would be better then a more specific one.
For reference: [[mw:Category:SkinTemplateOutputPageBeforeExec extensions]]
Around 60 usages identified in MediaWiki extensions in Gerrit.
> MediaWiki hook > Allows extension to change functionality That's the purpose of hooks. The issue here is not with the hook, but with extensions that are misusing the hook. For example, let's say we make the hook more specific in an attempt to make it less "generic and dangerous", and instead the hook allows extensions to *only* change language_urls. Extension developers could still misuse the hook and insert non-language URLs into the template. The problem is that the template parameters are not well-defined enough, and because of that extension developers are misusing the template parameters. It would be ridiculous to instead make fifty different hooks, each for a different template parameter that needs to be altered.
By all means encourage extension authors to use more relevant hooks, but the SkinTemplateOutputPageBeforeExec hook is used for more than just changing language_urls. - Sometimes extensions have a need to modify other template attributes, such as bodytext at the last moment. - This hook is currently the only way to modify the sidebar with things that you do not want to be cached. - It's also the only method of adding footerlinks and changing it's contents. See https://www.mediawiki.org/wiki/Manual:Footer I'm going to have to -1 this idea.
This is what I'm getting at. There should be explicit hooks that encourage adding links to footer, transforming body text before display and adding things to side bar. A generic hook like this adds all sorts of complexity. In my opinion it's way too powerful in it's current form and cannot possibly be skin agnostic.
We should definitely move towards narrower and more precisely defined interfaces. A lot of extension functionality can also be implemented client-side without the need for hooks at all.