Last modified: 2012-04-12 13:55:09 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T24969, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 22969 - External API passes the 'Api.php' title object to the userCan hook
External API passes the 'Api.php' title object to the userCan hook
Status: RESOLVED INVALID
Product: MediaWiki
Classification: Unclassified
API (Other open bugs)
1.16.x
All All
: High major (vote)
: ---
Assigned To: Roan Kattouw
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2010-03-26 20:00 UTC by Jim Keener
Modified: 2012-04-12 13:55 UTC (History)
4 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Jim Keener 2010-03-26 20:00:41 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.
Comment 1 Bryan Tong Minh 2010-03-26 20:20:05 UTC
I just logged that hook, and it passes the correct title for me.
Comment 2 Jim Keener 2010-03-26 20:24:36 UTC
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};
Comment 3 Jim Keener 2010-03-26 22:00:08 UTC
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.)

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links