Last modified: 2012-04-12 13:55:09 UTC
When the external API is used to edit a page, the userCan hook is called with a title object representing 'Api.php', not the page the edit is to take place on.
I just logged that hook, and it passes the correct title for me.
How do you use the API? I'm using the PERL lib MediaWiki::API. I lifted it straight from the CPAN docs. Here is my code: #!/usr/bin/perl -w use MediaWiki::API; my $mw = MediaWiki::API->new( { api_url => 'http://mw116.mallory/api.php' } ); $mw->login( {lgname => 'Tester', lgpassword => 'tester123' } ) || die $mw->{error}->{code} . ': ' . $mw->{error}->{details}; my $pagename = "Test"; my $ref = $mw->get_page( { title => $pagename } ); print $ref->{'*'}; $mw->edit( { action => 'edit', title => $pagename, basetimestamp => $ref->{timestamp}, text => "Additional text" } ) || die $mw->{error}->{code} . ': ' . $mw->{error}->{details};
Stemmed from an unsupported set-up. (Rewriting in the same directory the install was in. Once the install was moved to /w and the rewrite rules set to /wiki it all worked as expected.)