On Fri, Oct 3, 2008 at 6:29 PM, Brion Vibber brion@wikimedia.org wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Bryan Tong Minh wrote:
The problem currently is that in case you have your own special page overriding SpecialPage::execute, you have to do all setHeaders() and similar calls yourself, as well as the hooks. This basically means that your are copying code from the parent, which sucks and also is not futureproof in case somebody decides to add more magic to SpecialPage::execute.
Perhaps it would be better to fix the setHeaders() issue, so it's called prior to execute()?
Perhaps, but that would also require the hooks to move.
More generally, just slapping in a replacement for the entire execute() method sounds like a bad idea. If you're extending a base class, you probably want to *alter* its behavior, not replace it. The right way to do this is to factor the code sensibly in the first place, so you only have to replace the relevant parts instead of reimplenting the whole execute() method.
But that will break backwards compatibility for a really widely used interface. I think that is not worth the effort.
Adding a generic run() method doesn't help you there -- it saves you one line of boilerplate and makes you redo everything else.
Well, more like 5-6, but I get your point.
Bryan