On 25.05.2008, 22:20 Bryan wrote:
I think I added that hook on the wrong place. It should probably somewhere after the title has been set.
Bryan
...or not. It appears that the error occurs because $wgTitle is not set. It should probably be set to something sensible or $wgOut should be set to a fake object that does nothing.
Bryan
Probably, something like FauxOutputPage should relly be made, but it would add extra time to load it and actual OutputPage from which it will inherit. So my proposed patch modifies AssertEdit's behaviour to depend on entry point and not to output anything if it's called from API.
-- Best regards, Max Semenik ([[User:MaxSem]])
Thanks for the patch, but I don't really like how it depends on $GLOBAL['processor'] to check whether we are running through the api. There should be a more sane way to detect runnage via the API and if there is not, it really should be made.
Bryan
How about define( 'API' ); in api.php just before constructing ApiMain?
Max Semenik schreef:
How about define( 'API' ); in api.php just before constructing ApiMain?
Should also be done.
About this whole hooks in the API thing: the problem with the AlternateEdit hook is that it's used to provide an alternate edit form. It's a UI-oriented hook, which is exactly why it *shouldn't* be run from the API. IMO the best way to do all this is to create brand new hooks such as APIEditBeforeSave, which extensions can use to override the result (ConfirmEdit does this already). Hooks in lower-level codepaths (such as Title::moveTo()) preferably shouldn't be able to do anything UI-related. I'll investigate which hooks are currently run on write API requests, and post a proposal as to what to do about them at wikitech-l.
Roan Kattouw (Catrope)
mediawiki-api@lists.wikimedia.org