[Mediawiki-api] Using API within an extension causes a browser redirect?

Adam Nielsen a.nielsen at shikadi.net
Sat May 2 14:17:01 UTC 2009


Hi all,

I've just started on a MediaWiki extension that uses the MW API for
bulk-editing articles.  Unfortunately for some reason after making the call to
edit the pages, instead of the browser seeing whatever I have written with
$wgOut->addHTML(), the browser gets redirected to the last page that was edited.

This is the code I am using to perform the edit, where $p is a result returned
from a previous Query API call (to get the list of pages that need editing.)

  $req = new FauxRequest(array(
    'action' => 'edit',
    'bot' => true,
    'token' => $p['edittoken'],
    'title' => $p['title'],
    'summary' => $this->strSummary,
    'text' => $newContent,
    'basetimestamp' => $p['starttimestamp']
  ), true);
  $processor = new ApiMain($req, true);
  $processor->execute();

If I comment out the execute() line then I see my summary Special page, but
with execute() present I get pushed onto the last article edited instead
(although every edit does go through successfully.)  The other API call (for
querying the page content) works fine, it's only the Edit call that seems to
exhibit this behaviour.

Does anyone have any idea what's going on here?  I'm running MW 1.14.0.

Many thanks,
Adam.



More information about the Mediawiki-api mailing list