On Fri, Oct 3, 2008 at 10:24 PM, Brion Vibber brion@wikimedia.org wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Bryan Tong Minh wrote:
On Fri, Oct 3, 2008 at 6:29 PM, Brion Vibber brion@wikimedia.org wrote:
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.
What hooks are you referring to?
SpecialPageExecuteBeforePage and SpecialPageExecuteAfterPage
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.
It sounds like you're not working with an interface that's designed to be extended, so nothing you do in a child class is going to be nice.
I would recommend refactoring whatever specific interface you're looking at (some particular special page, I can only assume?) so it's sanely extensible.
Perhaps I was not clear enough, but the interface I am referring to is the SpecialPage base class itself.